From 874d750a1cec3bf99ec4181933666d7c214abc32 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 29 Nov 2023 11:37:49 +0000 Subject: [PATCH 001/143] Fix #30665 (EVSE) - Changed to use amperage_mA, energy_mWh - removed max on epoch_s - removed access for operate - removed side for events --- .../data-model/chip/energy-evse-cluster.xml | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 8eed118f9ef953..6cd2a47dab50c5 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -71,7 +71,7 @@ limitations under the License. - + Energy EVSE @@ -88,15 +88,15 @@ limitations under the License. State SupplyState FaultState - ChargingEnabledUntil + ChargingEnabledUntil - DischargingEnabledUntil - CircuitCapacity - MinimumChargeCurrent - MaximumChargeCurrent + DischargingEnabledUntil + CircuitCapacity + MinimumChargeCurrent + MaximumChargeCurrent - MaximumDischargeCurrent - + MaximumDischargeCurrent + UserMaximumChargeCurrent @@ -115,7 +115,7 @@ limitations under the License. NextChargeTargetTime - NextChargeRequiredEnergy + NextChargeRequiredEnergy NextChargeTargetSoC @@ -127,48 +127,41 @@ limitations under the License. StateOfCharge - BatteryCapacity + BatteryCapacity VehicleID SessionID SessionDuration - SessionEnergyCharged + SessionEnergyCharged - SessionEnergyDischarged + SessionEnergyDischarged - Allows a client to disable the EVSE from charging and discharging. - - - + + Allows a client to enable the EVSE to charge an EV. - - + Allows a client to enable the EVSE to discharge an EV. - Allows a client to put the EVSE into a self-diagnostics mode. - Allows a client to set the user specified charging targets. - Allows a client to retrieve the user specified charging targets. - Allows a client to clear all stored charging targets. @@ -176,39 +169,39 @@ limitations under the License. The GetTargetsResponse is sent in response to the GetTargets Command. - + EVConnected - + EVNotDetected - - + + - + EnergyTransferStarted - + - + EnergyTransferStopped - + - + Fault - + RFID From 35a06a7d2853f065b6b86e5990985a9f31b76be3 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 29 Nov 2023 15:28:55 +0000 Subject: [PATCH 002/143] Fix #30665 updates to try to get further with ZAP and autogen, but still fails with some parts of regen_all --- .../matter_idl/generators/type_definitions.py | 4 +++ src/app/zap-templates/common/override.js | 5 +++ .../zcl/data-model/chip/chip-types.xml | 5 +++ .../data_model/controller-clusters.matter | 34 +++++++++---------- .../data_model/controller-clusters.zap | 3 +- .../app-common/zap-generated/attribute-type.h | 4 +++ .../zap-generated/attributes/Accessors.cpp | 22 ++++++------ .../zap-generated/attributes/Accessors.h | 18 +++++----- 8 files changed, 57 insertions(+), 38 deletions(-) diff --git a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py index 29d496b48315bb..f244294b6bb192 100644 --- a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py +++ b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py @@ -190,6 +190,7 @@ def is_struct(self) -> bool: # Derived types # Specification describes them in section '7.18.2. Derived Data Types' "action_id": BasicInteger(idl_name="action_id", byte_count=1, is_signed=False), + "amperage_mA": BasicInteger(idl_name="amperage_mA", byte_count=8, is_signed=True), "attrib_id": BasicInteger(idl_name="attrib_id", byte_count=4, is_signed=False), "cluster_id": BasicInteger(idl_name="cluster_id", byte_count=4, is_signed=False), "command_id": BasicInteger(idl_name="command_id", byte_count=4, is_signed=False), @@ -198,6 +199,7 @@ def is_struct(self) -> bool: "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False), "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False), "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False), + "energy_mWh": BasicInteger(idl_name="energy_mWh", byte_count=8, is_signed=True), "entry_idx": BasicInteger(idl_name="entry_idx", byte_count=2, is_signed=False), "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False), "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False), @@ -212,6 +214,7 @@ def is_struct(self) -> bool: "percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False), "percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False), "posix_ms": BasicInteger(idl_name="posix_ms", byte_count=8, is_signed=False), + "power_mW": BasicInteger(idl_name="power_mW", byte_count=8, is_signed=True), "priority": BasicInteger(idl_name="priority", byte_count=1, is_signed=False), "status": BasicInteger(idl_name="status", byte_count=2, is_signed=False), "systime_ms": BasicInteger(idl_name="systime_ms", byte_count=8, is_signed=False), @@ -221,6 +224,7 @@ def is_struct(self) -> bool: "tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=False), "trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=False), "vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=False), + "voltage_mV": BasicInteger(idl_name="voltage_mV", byte_count=8, is_signed=True), } diff --git a/src/app/zap-templates/common/override.js b/src/app/zap-templates/common/override.js index 98420cdabb1fda..de7bd90165bfc3 100644 --- a/src/app/zap-templates/common/override.js +++ b/src/app/zap-templates/common/override.js @@ -74,6 +74,11 @@ function atomicType(arg) return 'chip::Percent'; case 'percent100ths': return 'chip::Percent100ths'; + case 'power_mW': + case 'amperage_mA': + case 'voltage_mV': + case 'energy_mWh': + return 'int64_t'; case 'epoch_us': case 'systime_us': case 'posix_ms': diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index 0756fd85569f6c..40b5fc808f5ba9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -56,6 +56,11 @@ limitations under the License. + + + + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 54eae3531eadd4..33acf1e0c9616f 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4370,7 +4370,7 @@ provisional cluster EnergyEvse = 153 { struct ChargingTargetStruct { int16u targetTime = 0; optional percent targetSoC = 1; - optional int64s addedEnergy = 2; + optional energy_mWh addedEnergy = 2; } info event EVConnected = 0 { @@ -4381,21 +4381,21 @@ provisional cluster EnergyEvse = 153 { int32u sessionID = 0; StateEnum state = 1; elapsed_s sessionDuration = 2; - int64s sessionEnergyCharged = 3; - optional int64s sessionEnergyDischarged = 4; + energy_mWh sessionEnergyCharged = 3; + optional energy_mWh sessionEnergyDischarged = 4; } info event EnergyTransferStarted = 2 { int32u sessionID = 0; StateEnum state = 1; - int64s maximumCurrent = 2; + amperage_mA maximumCurrent = 2; } info event EnergyTransferStopped = 3 { int32u sessionID = 0; StateEnum state = 1; EnergyTransferStoppedReasonEnum reason = 2; - int64s energyTransferred = 4; + energy_mWh energyTransferred = 4; } critical event Fault = 4 { @@ -4414,26 +4414,26 @@ provisional cluster EnergyEvse = 153 { readonly attribute FaultStateEnum faultState = 2; readonly attribute nullable epoch_s chargingEnabledUntil = 3; readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4; - readonly attribute int64s circuitCapacity = 5; - readonly attribute int64s minimumChargeCurrent = 6; - readonly attribute int64s maximumChargeCurrent = 7; - readonly attribute optional int64s maximumDischargeCurrent = 8; - attribute access(write: manage) optional int64s userMaximumChargeCurrent = 9; + readonly attribute amperage_mA circuitCapacity = 5; + readonly attribute amperage_mA minimumChargeCurrent = 6; + readonly attribute amperage_mA maximumChargeCurrent = 7; + readonly attribute optional amperage_mA maximumDischargeCurrent = 8; + attribute access(write: manage) optional amperage_mA userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; readonly attribute optional int8u numberOfWeeklyTargets = 33; readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; - readonly attribute optional nullable int64s nextChargeRequiredEnergy = 37; + readonly attribute optional nullable energy_mWh nextChargeRequiredEnergy = 37; readonly attribute optional nullable percent nextChargeTargetSoC = 38; attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39; readonly attribute optional nullable percent stateOfCharge = 48; - readonly attribute optional nullable int64s batteryCapacity = 49; + readonly attribute optional nullable energy_mWh batteryCapacity = 49; readonly attribute optional nullable char_string<32> vehicleID = 50; readonly attribute nullable int32u sessionID = 64; readonly attribute elapsed_s sessionDuration = 65; - readonly attribute int64s sessionEnergyCharged = 66; - readonly attribute optional int64s sessionEnergyDischarged = 67; + readonly attribute energy_mWh sessionEnergyCharged = 66; + readonly attribute optional energy_mWh sessionEnergyDischarged = 67; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -4448,13 +4448,13 @@ provisional cluster EnergyEvse = 153 { request struct EnableChargingRequest { nullable epoch_s chargingEnabledUntil = 0; - int64s minimumChargeCurrent = 1; - int64s maximumChargeCurrent = 2; + amperage_mA minimumChargeCurrent = 1; + amperage_mA maximumChargeCurrent = 2; } request struct EnableDischargingRequest { nullable epoch_s dischargingEnabledUntil = 0; - int64s maximumDischargeCurrent = 1; + amperage_mA maximumDischargeCurrent = 1; } request struct SetTargetsRequest { diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 67b8da72bb5505..9bb8be22fae1a2 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -5400,5 +5400,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h index e79d1281b33a8c..6b3b35cc4aa684 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h @@ -74,6 +74,10 @@ enum ZCL_SYSTIME_MS_ATTRIBUTE_TYPE = 0xD1, // System Time Milliseconds ZCL_ELAPSED_S_ATTRIBUTE_TYPE = 0xD2, // Elapsed Time Seconds ZCL_TEMPERATURE_ATTRIBUTE_TYPE = 0xD8, // Temperature + ZCL_POWER_M_W_ATTRIBUTE_TYPE = 0xD9, // Power milliwatts + ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE = 0xDA, // Amperage milliamps + ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE = 0xDB, // Voltage millivolts + ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE = 0xDC, // Energy milliwatt-hours ZCL_TOD_ATTRIBUTE_TYPE = 0xE0, // Time of day ZCL_DATE_ATTRIBUTE_TYPE = 0xE1, // Date ZCL_EPOCH_US_ATTRIBUTE_TYPE = 0xE3, // Epoch Microseconds 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 1da947a4603420..329d3fe2711ade 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 @@ -10604,7 +10604,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); } } // namespace CircuitCapacity @@ -10635,7 +10635,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); } } // namespace MinimumChargeCurrent @@ -10666,7 +10666,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); } } // namespace MaximumChargeCurrent @@ -10697,7 +10697,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); } } // namespace MaximumDischargeCurrent @@ -10728,7 +10728,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); } } // namespace UserMaximumChargeCurrent @@ -10961,7 +10961,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); } EmberAfStatus SetNull(chip::EndpointId endpoint) @@ -10970,7 +10970,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint) Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); } EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) @@ -11173,7 +11173,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); } EmberAfStatus SetNull(chip::EndpointId endpoint) @@ -11182,7 +11182,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint) Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); } EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) @@ -11356,7 +11356,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); } } // namespace SessionEnergyCharged @@ -11387,7 +11387,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); } } // namespace SessionEnergyDischarged 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 05505afea06d13..20da316a721554 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 @@ -2038,27 +2038,27 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace DischargingEnabledUntil namespace CircuitCapacity { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace CircuitCapacity namespace MinimumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace MinimumChargeCurrent namespace MaximumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace MaximumChargeCurrent namespace MaximumDischargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace MaximumDischargeCurrent namespace UserMaximumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace UserMaximumChargeCurrent @@ -2092,7 +2092,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace NextChargeTargetTime namespace NextChargeRequiredEnergy { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mWh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); EmberAfStatus SetNull(chip::EndpointId endpoint); EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); @@ -2120,7 +2120,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace StateOfCharge namespace BatteryCapacity { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mWh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); EmberAfStatus SetNull(chip::EndpointId endpoint); EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); @@ -2146,12 +2146,12 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); } // namespace SessionDuration namespace SessionEnergyCharged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace SessionEnergyCharged namespace SessionEnergyDischarged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace SessionEnergyDischarged From c3aef3a35ee4d6256905b69ba03cd4105314f652 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 29 Nov 2023 21:15:12 +0000 Subject: [PATCH 003/143] Added ember-compatibility-functions.cpp which was missing. --- src/app/util/ember-compatibility-functions.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index de08342c4f18f6..3cf10a86d3f169 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -123,6 +123,12 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type) "chip::DataVersion is expected to be uint32_t, change this when necessary"); return ZCL_INT32U_ATTRIBUTE_TYPE; + case ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE: // Amperage milliamps + case ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE: // Energy milliwatt-hours + case ZCL_POWER_M_W_ATTRIBUTE_TYPE: // Power milliwatts + case ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE: // Voltage millivolts + return ZCL_INT64S_ATTRIBUTE_TYPE; + case ZCL_EVENT_NO_ATTRIBUTE_TYPE: // Event Number case ZCL_FABRIC_ID_ATTRIBUTE_TYPE: // Fabric Id case ZCL_NODE_ID_ATTRIBUTE_TYPE: // Node Id From a71bef88c3584142c663fd3c17bb3defc1e4347e Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 29 Nov 2023 22:50:26 +0000 Subject: [PATCH 004/143] Made all types all lowercase to resolve regen_all issues. --- .../network-manager-app.matter | 114 +++++++++--------- .../matter_idl/generators/type_definitions.py | 8 +- .../util/ember-compatibility-functions.cpp | 8 +- src/app/zap-templates/common/override.js | 8 +- .../zcl/data-model/chip/chip-types.xml | 8 +- .../data-model/chip/energy-evse-cluster.xml | 34 +++--- .../data_model/controller-clusters.matter | 34 +++--- .../app-common/zap-generated/attribute-type.h | 8 +- .../zap-generated/attributes/Accessors.cpp | 22 ++-- .../zap-generated/attributes/Accessors.h | 18 +-- .../zap-generated/cluster/Commands.h | 35 +++--- .../zap-generated/cluster/Commands.h | 8 +- 12 files changed, 151 insertions(+), 154 deletions(-) diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.matter b/examples/network-manager-app/network-manager-common/network-manager-app.matter index b5760ecb46703b..a91e5664fcf32e 100644 --- a/examples/network-manager-app/network-manager-common/network-manager-app.matter +++ b/examples/network-manager-app/network-manager-common/network-manager-app.matter @@ -1178,11 +1178,11 @@ endpoint 0 { callback attribute serverList; callback attribute clientList; callback attribute partsList; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; - callback attribute attributeList default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; ram attribute featureMap default = 0; - callback attribute clusterRevision default = 1; + callback attribute clusterRevision; } server cluster AccessControl { @@ -1190,32 +1190,32 @@ endpoint 0 { emits event AccessControlExtensionChanged; callback attribute acl; callback attribute extension; - callback attribute subjectsPerAccessControlEntry default = 4; - callback attribute targetsPerAccessControlEntry default = 3; - callback attribute accessControlEntriesPerFabric default = 3; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; + callback attribute subjectsPerAccessControlEntry; + callback attribute targetsPerAccessControlEntry; + callback attribute accessControlEntriesPerFabric; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; callback attribute attributeList; ram attribute featureMap default = 0; - callback attribute clusterRevision default = 1; + callback attribute clusterRevision; } server cluster BasicInformation { emits event StartUp; emits event ShutDown; emits event Leave; - callback attribute dataModelRevision default = 10; + callback attribute dataModelRevision; callback attribute vendorName; callback attribute vendorID; callback attribute productName; callback attribute productID; persist attribute nodeLabel; - callback attribute location default = "XX"; - callback attribute hardwareVersion default = 0; + callback attribute location; + callback attribute hardwareVersion; callback attribute hardwareVersionString; - callback attribute softwareVersion default = 0; + callback attribute softwareVersion; callback attribute softwareVersionString; - callback attribute manufacturingDate default = "20210614123456ZZ"; + callback attribute manufacturingDate; callback attribute partNumber; callback attribute productURL; callback attribute productLabel; @@ -1226,9 +1226,9 @@ endpoint 0 { callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; - callback attribute attributeList default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 3; } @@ -1236,12 +1236,12 @@ endpoint 0 { server cluster GeneralCommissioning { ram attribute breadcrumb default = 0x0000000000000000; callback attribute basicCommissioningInfo; - callback attribute regulatoryConfig default = 0; - callback attribute locationCapability default = 0; - callback attribute supportsConcurrentConnection default = 1; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; - callback attribute attributeList default = 0; + callback attribute regulatoryConfig; + callback attribute locationCapability; + callback attribute supportsConcurrentConnection; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1260,9 +1260,9 @@ endpoint 0 { callback attribute lastNetworkingStatus; callback attribute lastNetworkID; callback attribute lastConnectErrorValue; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; - callback attribute attributeList default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; callback attribute featureMap default = 0; ram attribute clusterRevision default = 1; } @@ -1273,17 +1273,17 @@ endpoint 0 { emits event NetworkFaultChange; emits event BootReason; callback attribute networkInterfaces; - callback attribute rebootCount default = 0x0000; - callback attribute upTime default = 0x0000000000000000; - callback attribute totalOperationalHours default = 0x00000000; + callback attribute rebootCount; + callback attribute upTime; + callback attribute totalOperationalHours; callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; callback attribute activeNetworkFaults; callback attribute testEventTriggersEnabled default = false; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; - callback attribute attributeList default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 0x0002; @@ -1296,8 +1296,8 @@ endpoint 0 { callback attribute channel; callback attribute routingRole; callback attribute networkName; - callback attribute panId default = 0x0000; - callback attribute extendedPanId default = 0x0000000000000000; + callback attribute panId; + callback attribute extendedPanId; callback attribute meshLocalPrefix; callback attribute neighborTable; callback attribute routeTable; @@ -1325,16 +1325,16 @@ endpoint 0 { callback attribute bssid; callback attribute securityType; callback attribute wiFiVersion; - callback attribute channelNumber default = 0x0000; - callback attribute rssi default = 0x00; - callback attribute beaconLostCount default = 0x00000000; - callback attribute beaconRxCount default = 0x00000000; - callback attribute packetMulticastRxCount default = 0x00000000; - callback attribute packetMulticastTxCount default = 0x00000000; - callback attribute packetUnicastRxCount default = 0x00000000; - callback attribute packetUnicastTxCount default = 0x00000000; - callback attribute currentMaxRate default = 0x0000000000000000; - callback attribute overrunCount default = 0x0000000000000000; + callback attribute channelNumber; + callback attribute rssi; + callback attribute beaconLostCount; + callback attribute beaconRxCount; + callback attribute packetMulticastRxCount; + callback attribute packetMulticastTxCount; + callback attribute packetUnicastRxCount; + callback attribute packetUnicastTxCount; + callback attribute currentMaxRate; + callback attribute overrunCount; ram attribute featureMap default = 3; ram attribute clusterRevision default = 1; @@ -1352,12 +1352,12 @@ endpoint 0 { } server cluster AdministratorCommissioning { - callback attribute windowStatus default = 0; - callback attribute adminFabricIndex default = 1; - callback attribute adminVendorId default = 0; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; - callback attribute attributeList default = 0; + callback attribute windowStatus; + callback attribute adminFabricIndex; + callback attribute adminVendorId; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1372,9 +1372,9 @@ endpoint 0 { callback attribute commissionedFabrics; callback attribute trustedRootCertificates; callback attribute currentFabricIndex; - callback attribute generatedCommandList default = 0; - callback attribute acceptedCommandList default = 0; - callback attribute attributeList default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1397,8 +1397,8 @@ endpoint 0 { callback attribute groupTable; callback attribute maxGroupsPerFabric; callback attribute maxGroupKeysPerFabric; - callback attribute featureMap default = 0; - callback attribute clusterRevision default = 1; + callback attribute featureMap; + callback attribute clusterRevision; handle command KeySetWrite; handle command KeySetRead; @@ -1422,7 +1422,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; - callback attribute clusterRevision default = 2; + callback attribute clusterRevision; } } diff --git a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py index f244294b6bb192..6caf3a4dbd125c 100644 --- a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py +++ b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py @@ -190,7 +190,7 @@ def is_struct(self) -> bool: # Derived types # Specification describes them in section '7.18.2. Derived Data Types' "action_id": BasicInteger(idl_name="action_id", byte_count=1, is_signed=False), - "amperage_mA": BasicInteger(idl_name="amperage_mA", byte_count=8, is_signed=True), + "amperage_ma": BasicInteger(idl_name="amperage_ma", byte_count=8, is_signed=True), "attrib_id": BasicInteger(idl_name="attrib_id", byte_count=4, is_signed=False), "cluster_id": BasicInteger(idl_name="cluster_id", byte_count=4, is_signed=False), "command_id": BasicInteger(idl_name="command_id", byte_count=4, is_signed=False), @@ -199,7 +199,7 @@ def is_struct(self) -> bool: "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False), "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False), "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False), - "energy_mWh": BasicInteger(idl_name="energy_mWh", byte_count=8, is_signed=True), + "energy_mwh": BasicInteger(idl_name="energy_mwh", byte_count=8, is_signed=True), "entry_idx": BasicInteger(idl_name="entry_idx", byte_count=2, is_signed=False), "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False), "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False), @@ -214,7 +214,7 @@ def is_struct(self) -> bool: "percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False), "percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False), "posix_ms": BasicInteger(idl_name="posix_ms", byte_count=8, is_signed=False), - "power_mW": BasicInteger(idl_name="power_mW", byte_count=8, is_signed=True), + "power_mw": BasicInteger(idl_name="power_mw", byte_count=8, is_signed=True), "priority": BasicInteger(idl_name="priority", byte_count=1, is_signed=False), "status": BasicInteger(idl_name="status", byte_count=2, is_signed=False), "systime_ms": BasicInteger(idl_name="systime_ms", byte_count=8, is_signed=False), @@ -224,7 +224,7 @@ def is_struct(self) -> bool: "tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=False), "trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=False), "vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=False), - "voltage_mV": BasicInteger(idl_name="voltage_mV", byte_count=8, is_signed=True), + "voltage_mv": BasicInteger(idl_name="voltage_mv", byte_count=8, is_signed=True), } diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index 3cf10a86d3f169..6a3c6fd5b0ada0 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -123,10 +123,10 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type) "chip::DataVersion is expected to be uint32_t, change this when necessary"); return ZCL_INT32U_ATTRIBUTE_TYPE; - case ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE: // Amperage milliamps - case ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE: // Energy milliwatt-hours - case ZCL_POWER_M_W_ATTRIBUTE_TYPE: // Power milliwatts - case ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE: // Voltage millivolts + case ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE: // Amperage milliamps + case ZCL_ENERGY_MWH_ATTRIBUTE_TYPE: // Energy milliwatt-hours + case ZCL_POWER_MW_ATTRIBUTE_TYPE: // Power milliwatts + case ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE: // Voltage millivolts return ZCL_INT64S_ATTRIBUTE_TYPE; case ZCL_EVENT_NO_ATTRIBUTE_TYPE: // Event Number diff --git a/src/app/zap-templates/common/override.js b/src/app/zap-templates/common/override.js index de7bd90165bfc3..098af41e5154e2 100644 --- a/src/app/zap-templates/common/override.js +++ b/src/app/zap-templates/common/override.js @@ -74,10 +74,10 @@ function atomicType(arg) return 'chip::Percent'; case 'percent100ths': return 'chip::Percent100ths'; - case 'power_mW': - case 'amperage_mA': - case 'voltage_mV': - case 'energy_mWh': + case 'power_mw': + case 'amperage_ma': + case 'voltage_mv': + case 'energy_mwh': return 'int64_t'; case 'epoch_us': case 'systime_us': diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index 40b5fc808f5ba9..176b82722f2ecc 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -56,10 +56,10 @@ limitations under the License. - - - - + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 6cd2a47dab50c5..83f44e37f1eaf4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -71,7 +71,7 @@ limitations under the License. - + Energy EVSE @@ -91,12 +91,12 @@ limitations under the License. ChargingEnabledUntil DischargingEnabledUntil - CircuitCapacity - MinimumChargeCurrent - MaximumChargeCurrent + CircuitCapacity + MinimumChargeCurrent + MaximumChargeCurrent - MaximumDischargeCurrent - + MaximumDischargeCurrent + UserMaximumChargeCurrent @@ -115,7 +115,7 @@ limitations under the License. NextChargeTargetTime - NextChargeRequiredEnergy + NextChargeRequiredEnergy NextChargeTargetSoC @@ -127,26 +127,26 @@ limitations under the License. StateOfCharge - BatteryCapacity + BatteryCapacity VehicleID SessionID SessionDuration - SessionEnergyCharged + SessionEnergyCharged - SessionEnergyDischarged + SessionEnergyDischarged Allows a client to disable the EVSE from charging and discharging. - - + + Allows a client to enable the EVSE to charge an EV. - + Allows a client to enable the EVSE to discharge an EV. @@ -178,21 +178,21 @@ limitations under the License. - - + + EnergyTransferStarted - + EnergyTransferStopped - + Fault diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 33acf1e0c9616f..14a3fa22ab0809 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4370,7 +4370,7 @@ provisional cluster EnergyEvse = 153 { struct ChargingTargetStruct { int16u targetTime = 0; optional percent targetSoC = 1; - optional energy_mWh addedEnergy = 2; + optional energy_mwh addedEnergy = 2; } info event EVConnected = 0 { @@ -4381,21 +4381,21 @@ provisional cluster EnergyEvse = 153 { int32u sessionID = 0; StateEnum state = 1; elapsed_s sessionDuration = 2; - energy_mWh sessionEnergyCharged = 3; - optional energy_mWh sessionEnergyDischarged = 4; + energy_mwh sessionEnergyCharged = 3; + optional energy_mwh sessionEnergyDischarged = 4; } info event EnergyTransferStarted = 2 { int32u sessionID = 0; StateEnum state = 1; - amperage_mA maximumCurrent = 2; + amperage_ma maximumCurrent = 2; } info event EnergyTransferStopped = 3 { int32u sessionID = 0; StateEnum state = 1; EnergyTransferStoppedReasonEnum reason = 2; - energy_mWh energyTransferred = 4; + energy_mwh energyTransferred = 4; } critical event Fault = 4 { @@ -4414,26 +4414,26 @@ provisional cluster EnergyEvse = 153 { readonly attribute FaultStateEnum faultState = 2; readonly attribute nullable epoch_s chargingEnabledUntil = 3; readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4; - readonly attribute amperage_mA circuitCapacity = 5; - readonly attribute amperage_mA minimumChargeCurrent = 6; - readonly attribute amperage_mA maximumChargeCurrent = 7; - readonly attribute optional amperage_mA maximumDischargeCurrent = 8; - attribute access(write: manage) optional amperage_mA userMaximumChargeCurrent = 9; + readonly attribute amperage_ma circuitCapacity = 5; + readonly attribute amperage_ma minimumChargeCurrent = 6; + readonly attribute amperage_ma maximumChargeCurrent = 7; + readonly attribute optional amperage_ma maximumDischargeCurrent = 8; + attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; readonly attribute optional int8u numberOfWeeklyTargets = 33; readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; - readonly attribute optional nullable energy_mWh nextChargeRequiredEnergy = 37; + readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; readonly attribute optional nullable percent nextChargeTargetSoC = 38; attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39; readonly attribute optional nullable percent stateOfCharge = 48; - readonly attribute optional nullable energy_mWh batteryCapacity = 49; + readonly attribute optional nullable energy_mwh batteryCapacity = 49; readonly attribute optional nullable char_string<32> vehicleID = 50; readonly attribute nullable int32u sessionID = 64; readonly attribute elapsed_s sessionDuration = 65; - readonly attribute energy_mWh sessionEnergyCharged = 66; - readonly attribute optional energy_mWh sessionEnergyDischarged = 67; + readonly attribute energy_mwh sessionEnergyCharged = 66; + readonly attribute optional energy_mwh sessionEnergyDischarged = 67; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -4448,13 +4448,13 @@ provisional cluster EnergyEvse = 153 { request struct EnableChargingRequest { nullable epoch_s chargingEnabledUntil = 0; - amperage_mA minimumChargeCurrent = 1; - amperage_mA maximumChargeCurrent = 2; + amperage_ma minimumChargeCurrent = 1; + amperage_ma maximumChargeCurrent = 2; } request struct EnableDischargingRequest { nullable epoch_s dischargingEnabledUntil = 0; - amperage_mA maximumDischargeCurrent = 1; + amperage_ma maximumDischargeCurrent = 1; } request struct SetTargetsRequest { diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h index 6b3b35cc4aa684..c89f71a91d4a21 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h @@ -74,10 +74,10 @@ enum ZCL_SYSTIME_MS_ATTRIBUTE_TYPE = 0xD1, // System Time Milliseconds ZCL_ELAPSED_S_ATTRIBUTE_TYPE = 0xD2, // Elapsed Time Seconds ZCL_TEMPERATURE_ATTRIBUTE_TYPE = 0xD8, // Temperature - ZCL_POWER_M_W_ATTRIBUTE_TYPE = 0xD9, // Power milliwatts - ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE = 0xDA, // Amperage milliamps - ZCL_VOLTAGE_M_V_ATTRIBUTE_TYPE = 0xDB, // Voltage millivolts - ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE = 0xDC, // Energy milliwatt-hours + ZCL_POWER_MW_ATTRIBUTE_TYPE = 0xD9, // Power milliwatts + ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE = 0xDA, // Amperage milliamps + ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE = 0xDB, // Voltage millivolts + ZCL_ENERGY_MWH_ATTRIBUTE_TYPE = 0xDC, // Energy milliwatt-hours ZCL_TOD_ATTRIBUTE_TYPE = 0xE0, // Time of day ZCL_DATE_ATTRIBUTE_TYPE = 0xE1, // Date ZCL_EPOCH_US_ATTRIBUTE_TYPE = 0xE3, // Epoch Microseconds 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 329d3fe2711ade..728f9a5844b59c 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 @@ -10604,7 +10604,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); } } // namespace CircuitCapacity @@ -10635,7 +10635,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); } } // namespace MinimumChargeCurrent @@ -10666,7 +10666,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); } } // namespace MaximumChargeCurrent @@ -10697,7 +10697,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); } } // namespace MaximumDischargeCurrent @@ -10728,7 +10728,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_M_A_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); } } // namespace UserMaximumChargeCurrent @@ -10961,7 +10961,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } EmberAfStatus SetNull(chip::EndpointId endpoint) @@ -10970,7 +10970,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint) Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) @@ -11173,7 +11173,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } EmberAfStatus SetNull(chip::EndpointId endpoint) @@ -11182,7 +11182,7 @@ EmberAfStatus SetNull(chip::EndpointId endpoint) Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) @@ -11356,7 +11356,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } } // namespace SessionEnergyCharged @@ -11387,7 +11387,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_M_WH_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } } // namespace SessionEnergyDischarged 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 20da316a721554..68a10b448e4635 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 @@ -2038,27 +2038,27 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace DischargingEnabledUntil namespace CircuitCapacity { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace CircuitCapacity namespace MinimumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace MinimumChargeCurrent namespace MaximumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace MaximumChargeCurrent namespace MaximumDischargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace MaximumDischargeCurrent namespace UserMaximumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_mA +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace UserMaximumChargeCurrent @@ -2092,7 +2092,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace NextChargeTargetTime namespace NextChargeRequiredEnergy { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mWh +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); EmberAfStatus SetNull(chip::EndpointId endpoint); EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); @@ -2120,7 +2120,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace StateOfCharge namespace BatteryCapacity { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mWh +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); EmberAfStatus SetNull(chip::EndpointId endpoint); EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); @@ -2146,12 +2146,12 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); } // namespace SessionDuration namespace SessionEnergyCharged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace SessionEnergyCharged namespace SessionEnergyDischarged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mWh +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace SessionEnergyDischarged diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 610e325a4e7dfa..7a93b0275e3029 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -6903,8 +6903,8 @@ class EnergyEvseEnableCharging : public ClusterCommand EnergyEvseEnableCharging(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("enable-charging", credsIssuerConfig) { AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil); - AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent); - AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent); + AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent); + AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent); ClusterCommand::AddArguments(); } @@ -6943,7 +6943,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand ClusterCommand("enable-discharging", credsIssuerConfig) { AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil); - AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent); + AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent); ClusterCommand::AddArguments(); } @@ -18446,18 +18446,16 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>>(Id, "discharging-enabled-until", 0, UINT32_MAX, Attributes::DischargingEnabledUntil::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "circuit-capacity", INT64_MIN, INT64_MAX, Attributes::CircuitCapacity::Id, + make_unique>(Id, "circuit-capacity", 0, UINT64_MAX, Attributes::CircuitCapacity::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "minimum-charge-current", INT64_MIN, INT64_MAX, - Attributes::MinimumChargeCurrent::Id, WriteCommandType::kForceWrite, - credsIssuerConfig), // - make_unique>(Id, "maximum-charge-current", INT64_MIN, INT64_MAX, - Attributes::MaximumChargeCurrent::Id, WriteCommandType::kForceWrite, - credsIssuerConfig), // - make_unique>(Id, "maximum-discharge-current", INT64_MIN, INT64_MAX, + make_unique>(Id, "minimum-charge-current", 0, UINT64_MAX, Attributes::MinimumChargeCurrent::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "maximum-charge-current", 0, UINT64_MAX, Attributes::MaximumChargeCurrent::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "maximum-discharge-current", 0, UINT64_MAX, Attributes::MaximumDischargeCurrent::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "user-maximum-charge-current", INT64_MIN, INT64_MAX, + make_unique>(Id, "user-maximum-charge-current", 0, UINT64_MAX, Attributes::UserMaximumChargeCurrent::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "randomization-delay-window", 0, UINT32_MAX, @@ -18473,8 +18471,8 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>>(Id, "next-charge-target-time", 0, UINT32_MAX, Attributes::NextChargeTargetTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "next-charge-required-energy", INT64_MIN, - INT64_MAX, Attributes::NextChargeRequiredEnergy::Id, + make_unique>>(Id, "next-charge-required-energy", 0, UINT64_MAX, + Attributes::NextChargeRequiredEnergy::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "next-charge-target-so-c", 0, UINT8_MAX, Attributes::NextChargeTargetSoC::Id, WriteCommandType::kForceWrite, @@ -18485,7 +18483,7 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>>( Id, "state-of-charge", 0, UINT8_MAX, Attributes::StateOfCharge::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "battery-capacity", INT64_MIN, INT64_MAX, + make_unique>>(Id, "battery-capacity", 0, UINT64_MAX, Attributes::BatteryCapacity::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( @@ -18494,10 +18492,9 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c Id, "session-id", 0, UINT32_MAX, Attributes::SessionID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "session-duration", 0, UINT32_MAX, Attributes::SessionDuration::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "session-energy-charged", INT64_MIN, INT64_MAX, - Attributes::SessionEnergyCharged::Id, WriteCommandType::kForceWrite, - credsIssuerConfig), // - make_unique>(Id, "session-energy-discharged", INT64_MIN, INT64_MAX, + make_unique>(Id, "session-energy-charged", 0, UINT64_MAX, Attributes::SessionEnergyCharged::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "session-energy-discharged", 0, UINT64_MAX, Attributes::SessionEnergyDischarged::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( 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 4358b5753c47c4..393fdbb30bba9c 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -77912,10 +77912,10 @@ class EnergyEvseEnableCharging : public ClusterCommand { AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent); + AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent); + AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -77981,7 +77981,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand { AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent); + AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -79073,7 +79073,7 @@ class WriteEnergyEvseUserMaximumChargeCurrent : public WriteAttribute { : WriteAttribute("user-maximum-charge-current") { AddArgument("attr-name", "user-maximum-charge-current"); - AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); + AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } From 41acd01710b55e8c9091376010a058813c6db848 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 29 Nov 2023 23:03:59 +0000 Subject: [PATCH 005/143] Fixed lint issue (trailing whitespace). --- scripts/py_matter_idl/matter_idl/generators/type_definitions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py index 6caf3a4dbd125c..9bfe20f455c110 100644 --- a/scripts/py_matter_idl/matter_idl/generators/type_definitions.py +++ b/scripts/py_matter_idl/matter_idl/generators/type_definitions.py @@ -199,7 +199,7 @@ def is_struct(self) -> bool: "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False), "elapsed_s": BasicInteger(idl_name="elapsed_s", byte_count=4, is_signed=False), "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False), - "energy_mwh": BasicInteger(idl_name="energy_mwh", byte_count=8, is_signed=True), + "energy_mwh": BasicInteger(idl_name="energy_mwh", byte_count=8, is_signed=True), "entry_idx": BasicInteger(idl_name="entry_idx", byte_count=2, is_signed=False), "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False), "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False), From c96493f35da6a72ea785d2d495b4abed13717e1b Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 12 Dec 2023 15:27:03 +0000 Subject: [PATCH 006/143] Added Device Energy Management server.cpp, added to all-clusters-app.zap and regen_all --- .../all-clusters-app.matter | 195 ++++++++ .../all-clusters-common/all-clusters-app.zap | 277 +++++++++-- .../device-energy-management-server.cpp | 442 ++++++++++++++++++ .../device-energy-management-server.h | 197 ++++++++ 4 files changed, 1076 insertions(+), 35 deletions(-) create mode 100644 src/app/clusters/device-energy-management-server/device-energy-management-server.cpp create mode 100644 src/app/clusters/device-energy-management-server/device-energy-management-server.h 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 d6345f8867dddd..6b59b539103490 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 @@ -3717,6 +3717,185 @@ provisional cluster ElectricalEnergyMeasurement = 145 { readonly attribute int16u clusterRevision = 65533; } +/** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */ +provisional cluster DeviceEnergyManagement = 152 { + revision 1; // NOTE: Default/not specifically set + + enum CauseEnum : enum8 { + kNormalCompletion = 0; + kOffline = 1; + kFault = 2; + kUserOptOut = 3; + } + + enum CostTypeEnum : enum8 { + kFinancial = 0; + kGHGEmissions = 1; + kComfort = 2; + kTemperature = 3; + } + + enum ESAStateEnum : enum8 { + kOffline = 0; + kOnline = 1; + kFault = 2; + kUserOptOut = 3; + kPowerAdjustActive = 4; + kPaused = 5; + } + + enum ESATypeEnum : enum8 { + kEVSE = 0; + kSpaceHeating = 1; + kWaterHeating = 2; + kSpaceCooling = 3; + kSpaceHeatingCooling = 4; + kBatteryStorage = 5; + kSolarPV = 6; + kFridgeFreezer = 7; + kWashingMachine = 8; + kDishwasher = 9; + kCooking = 10; + kHomeWaterPump = 11; + kIrrigationWaterPump = 12; + kPoolPump = 13; + kOther = 255; + } + + bitmap Feature : bitmap32 { + kPowerAdjustment = 0x1; + kPowerForecastReporting = 0x2; + kStateForecastReporting = 0x4; + kForecastAdjustment = 0x8; + } + + struct CostStruct { + CostTypeEnum costType = 0; + int32s value = 1; + int8u decimalPoints = 2; + optional int16u currency = 3; + } + + struct SlotStruct { + elapsed_s minDuration = 0; + elapsed_s maxDuration = 1; + elapsed_s defaultDuration = 2; + elapsed_s elapsedSlotTime = 3; + elapsed_s remainingSlotTime = 4; + boolean slotIsPauseable = 5; + elapsed_s minPauseDuration = 6; + elapsed_s maxPauseDuration = 7; + optional int16u manufacturerESAState = 8; + optional int64s nominalPower = 9; + optional int64s minPower = 10; + optional int64s maxPower = 11; + optional int64s nominalEnergy = 12; + optional CostStruct costs[] = 13; + optional int64s minPowerAdjustment = 14; + optional int64s maxPowerAdjustment = 15; + optional elapsed_s minDurationAdjustment = 16; + optional elapsed_s maxDurationAdjustment = 17; + } + + struct ForecastStruct { + int16u forecastId = 0; + nullable int16u activeSlotNumber = 1; + epoch_s startTime = 2; + epoch_s endTime = 3; + optional nullable epoch_s earliestStartTime = 4; + optional epoch_s latestEndTime = 5; + boolean isPauseable = 6; + SlotStruct slots[] = 7; + } + + struct ConstraintsStruct { + epoch_s startTime = 0; + elapsed_s duration = 1; + optional int64s nominalPower = 2; + optional int64s maximumEnergy = 3; + optional int8s loadControl = 4; + } + + struct PowerAdjustStruct { + int64s minPower = 0; + int64s maxPower = 1; + elapsed_s minDuration = 2; + elapsed_s maxDuration = 3; + } + + struct SlotAdjustmentStruct { + int8u slotIndex = 0; + int64s nominalPower = 1; + elapsed_s duration = 2; + } + + info event PowerAdjustStart = 0 { + } + + info event PowerAdjustEnd = 1 { + CauseEnum cause = 0; + elapsed_s duration = 1; + int64s energyUse = 2; + } + + info event Paused = 2 { + } + + info event Resumed = 3 { + } + + readonly attribute ESATypeEnum ESAType = 0; + readonly attribute boolean ESACanGenerate = 1; + readonly attribute ESAStateEnum ESAState = 2; + readonly attribute int64s absMinPower = 3; + readonly attribute int64s absMaxPower = 4; + readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5; + readonly attribute optional nullable ForecastStruct forecast = 6; + 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; + + request struct PowerAdjustRequestRequest { + int64s power = 0; + elapsed_s duration = 1; + } + + request struct StartTimeAdjustRequestRequest { + epoch_s requestedStartTime = 0; + } + + request struct PauseRequestRequest { + elapsed_s duration = 0; + } + + request struct ModifyForecastRequestRequest { + int32u forecastId = 0; + SlotAdjustmentStruct slotAdjustments[] = 1; + } + + request struct RequestConstraintBasedForecastRequest { + ConstraintsStruct constraints[] = 0; + } + + /** Allows a client to request an adjustment in the power consumption of an ESA for a specified duration. */ + command PowerAdjustRequest(PowerAdjustRequestRequest): DefaultSuccess = 0; + /** Allows a client to cancel an ongoing PowerAdjustmentRequest operation. */ + command CancelPowerAdjustRequest(): DefaultSuccess = 1; + /** Allows a client to adjust the start time of a Forecast sequence that has not yet started operation (i.e. where the current Forecast StartTime is in the future). */ + command StartTimeAdjustRequest(StartTimeAdjustRequestRequest): DefaultSuccess = 2; + /** Allows a client to temporarily pause an operation and reduce the ESAs energy demand. */ + command PauseRequest(PauseRequestRequest): DefaultSuccess = 3; + /** Allows a client to cancel the PauseRequest command and enable earlier resumption of operation. */ + command ResumeRequest(): DefaultSuccess = 4; + /** Allows a client to modify a Forecast within the limits allowed by the ESA. */ + command ModifyForecastRequest(ModifyForecastRequestRequest): DefaultSuccess = 5; + /** Allows a client to ask the ESA to recompute its Forecast based on power and time constraints. */ + command RequestConstraintBasedForecast(RequestConstraintBasedForecastRequest): DefaultSuccess = 6; +} + /** Provides an interface for controlling and adjusting automatic window coverings. */ cluster WindowCovering = 258 { revision 5; @@ -7141,6 +7320,22 @@ endpoint 1 { ram attribute clusterRevision default = 1; } + server cluster DeviceEnergyManagement { + callback attribute ESAType default = 0; + callback attribute ESACanGenerate default = 0; + callback attribute ESAState default = 0; + callback attribute absMinPower default = 0; + callback attribute absMaxPower default = 0; + callback attribute powerAdjustmentCapability; + callback attribute forecast; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + } + server cluster WindowCovering { ram attribute type default = 0x08; ram attribute physicalClosedLimitLift default = 0xFFFF; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 2a331d5674f0e4..aa1ae2ffb08f06 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": [ @@ -7099,6 +7099,7 @@ "define": "ON_OFF_SWITCH_CONFIGURATION_CLUSTER", "side": "server", "enabled": 1, + "apiMaturity": "deprecated", "attributes": [ { "name": "switch type", @@ -7505,6 +7506,7 @@ "define": "BINARY_INPUT_BASIC_CLUSTER", "side": "server", "enabled": 1, + "apiMaturity": "deprecated", "attributes": [ { "name": "out of service", @@ -11533,25 +11535,9 @@ "enabled": 1, "apiMaturity": "provisional", "attributes": [ - { - "name": "Measured", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "false", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "Accuracy", - "code": 1, + "code": 0, "mfgCode": null, "side": "server", "type": "MeasurementAccuracyStruct", @@ -11567,7 +11553,7 @@ }, { "name": "CumulativeEnergyImported", - "code": 2, + "code": 1, "mfgCode": null, "side": "server", "type": "EnergyMeasurementStruct", @@ -11583,7 +11569,7 @@ }, { "name": "CumulativeEnergyExported", - "code": 3, + "code": 2, "mfgCode": null, "side": "server", "type": "EnergyMeasurementStruct", @@ -11599,7 +11585,7 @@ }, { "name": "PeriodicEnergyImported", - "code": 4, + "code": 3, "mfgCode": null, "side": "server", "type": "EnergyMeasurementStruct", @@ -11615,7 +11601,7 @@ }, { "name": "PeriodicEnergyExported", - "code": 5, + "code": 4, "mfgCode": null, "side": "server", "type": "EnergyMeasurementStruct", @@ -11743,6 +11729,225 @@ } ] }, + { + "name": "Device Energy Management", + "code": 152, + "mfgCode": null, + "define": "DEVICE_ENERGY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "ESAType", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "ESATypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ESACanGenerate", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ESAState", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "ESAStateEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AbsMinPower", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int64s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AbsMaxPower", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int64s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PowerAdjustmentCapability", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Forecast", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "ForecastStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "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": "", + "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": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "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": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Window Covering", "code": 258, @@ -12250,6 +12455,7 @@ "define": "BARRIER_CONTROL_CLUSTER", "side": "server", "enabled": 1, + "apiMaturity": "deprecated", "commands": [ { "name": "BarrierControlGoToPercent", @@ -12880,7 +13086,7 @@ "code": 17, "mfgCode": null, "side": "server", - "type": "temperature", + "type": "int16s", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -12896,7 +13102,7 @@ "code": 18, "mfgCode": null, "side": "server", - "type": "temperature", + "type": "int16s", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -12912,7 +13118,7 @@ "code": 21, "mfgCode": null, "side": "server", - "type": "temperature", + "type": "int16s", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -12928,7 +13134,7 @@ "code": 22, "mfgCode": null, "side": "server", - "type": "temperature", + "type": "int16s", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -12944,7 +13150,7 @@ "code": 23, "mfgCode": null, "side": "server", - "type": "temperature", + "type": "int16s", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -12960,7 +13166,7 @@ "code": 24, "mfgCode": null, "side": "server", - "type": "temperature", + "type": "int16s", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -13061,7 +13267,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -18192,6 +18398,7 @@ "define": "ELECTRICAL_MEASUREMENT_CLUSTER", "side": "server", "enabled": 1, + "apiMaturity": "deprecated", "attributes": [ { "name": "measurement type", @@ -21961,4 +22168,4 @@ } ], "log": [] -} +} \ No newline at end of file diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp new file mode 100644 index 00000000000000..200337e744ac9a --- /dev/null +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -0,0 +1,442 @@ +/* + * 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. + */ + +#include "device-energy-management-server.h" + +#include +#include +#include +#include + + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::DeviceEnergyManagement; +using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; + +using chip::Protocols::InteractionModel::Status; + + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +Instance::Instance(EndpointId aEndpointId, Delegate & aDelegate) : + AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), + mDelegate(aDelegate), mEndpointId(aEndpointId) +{ + /* set the base class delegates endpointId */ + mDelegate.SetEndpointId(aEndpointId); +} + +Instance::~Instance() +{ + Shutdown(); +} + +CHIP_ERROR Instance::Init() +{ + registerAttributeAccessOverride(this); + InteractionModelEngine::GetInstance()->RegisterCommandHandler(this); + return CHIP_NO_ERROR; +} + +void Instance::Shutdown() +{ + unregisterAttributeAccessOverride(this); + InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); +} + +bool Instance::HasFeature(Feature aFeature) const +{ + return mFeature.Has(aFeature); +} + + +// AttributeAccessInterface +CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + switch (aPath.mAttributeId) + { + case ESAType::Id: + return aEncoder.Encode(mDelegate.GetESAType()); + case ESACanGenerate::Id: + return aEncoder.Encode(mDelegate.GetESACanGenerate()); + case ESAState::Id: + return aEncoder.Encode(mDelegate.GetESAState()); + case AbsMinPower::Id: + return aEncoder.Encode(mDelegate.GetAbsMinPower()); + case AbsMaxPower::Id: + return aEncoder.Encode(mDelegate.GetAbsMaxPower()); + case PowerAdjustmentCapability::Id: + return aEncoder.Encode(mDelegate.GetPowerAdjustmentCapability()); + case Forecast::Id: + return aEncoder.Encode(mDelegate.GetForecast()); + } + + /* Allow all other unhandled attributes to fall through to Ember */ + return CHIP_NO_ERROR; +} + +CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) +{ + return CHIP_ERROR_NOT_IMPLEMENTED; // Nothing writable in this cluster ! +} + +// CommandHandlerInterface +CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context) +{ + using namespace Commands; + + for (auto && id : { + PowerAdjustRequest::Id, + CancelPowerAdjustRequest::Id, + StartTimeAdjustRequest::Id, + PauseRequest::Id, + ResumeRequest::Id, + ModifyForecastRequest::Id, + RequestConstraintBasedForecast::Id, + }) + { + if (callback(id, context) == Loop::Break) + { + return CHIP_NO_ERROR; + } + } + + return CHIP_NO_ERROR; +} + +void Instance::InvokeCommand(HandlerContext & handlerContext) +{ + using namespace Commands; + + switch (handlerContext.mRequestPath.mCommandId) + { + case PowerAdjustRequest::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandlePowerAdjustRequest(ctx, commandData); }); + return; + case CancelPowerAdjustRequest::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleCancelPowerAdjustRequest(ctx, commandData); }); + return; + case StartTimeAdjustRequest::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleStartTimeAdjustRequest(ctx, commandData); }); + return; + case PauseRequest::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandlePauseRequest(ctx, commandData); }); + return; + case ResumeRequest::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleResumeRequest(ctx, commandData); }); + return; + case ModifyForecastRequest::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleModifyForecastRequest(ctx, commandData); }); + return; + case RequestConstraintBasedForecast::Id: + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleRequestConstraintBasedForecast(ctx, commandData); }); + return; + } +} + +void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData) +{ + int64_t power = commandData.power; + uint32_t durationSec = commandData.duration; + bool validArgs = false; + Status status = Status::Success; + + auto powerAdjustmentCapability = mDelegate.GetPowerAdjustmentCapability(); + + if (powerAdjustmentCapability.IsNull()) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s powerAdjustmentCapability IsNull", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + return; + } + + for (auto pas : powerAdjustmentCapability.Value()) + { + if ( (power >= pas.minPower) && (durationSec >= pas.minDuration) + && (power <= pas.maxPower) && (durationSec <= pas.maxDuration)) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustment args", __FUNCTION__); + validArgs = true; + break; + } + } + + if (!validArgs) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s invalid request range", __FUNCTION__); + // TODO: raise event ? + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + return; + } + + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustRequest() args.", __FUNCTION__); + + // TODO: Generate a PowerAdjustStart Event, then begins to adjust its power. How is this done, Async? + // When done, raise PowerAdjustEnd & ESAState set to kOnline. + status = mDelegate.PowerAdjustRequest(power, durationSec); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + if (status != Status::Success) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + } + + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partly implemented", __FUNCTION__); + return; +} + + +void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, const Commands::CancelPowerAdjustRequest::DecodableType & commandData) +{ + Status status = Status::Success; + ESAStateEnum esaStatus; + + esaStatus = mDelegate.GetESAState(); + + if (ESAStateEnum::kPowerAdjustActive != esaStatus) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + /* TODO: If the command is accepted, the ESA SHALL generate an PowerAdjustEnd Event. */ + + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good CancelPowerAdjustRequest() args.", __FUNCTION__); + status = mDelegate.CancelPowerAdjustRequest(); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + if (status != Status::Success) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + return; + } + + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s partly implemented", __FUNCTION__); + return; +} + +void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands::StartTimeAdjustRequest::DecodableType & commandData) +{ + Status status = Status::Success; + uint32_t earliestStartTime = 0; + uint32_t latestEndTime = 0; + Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); + uint32_t duration = forecast.endTime - forecast.startTime; // the current entire forecast duration + uint32_t requestedStartTime = commandData.requestedStartTime; + + if (! HasFeature(Feature::kForecastAdjustment)) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); + return; + } + + if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + /* If the RequestedStartTime value resulted in a time shift which is outside the time constraints of EarliestStartTime and + LatestEndTime, then the command SHALL be rejected with CONSTRAINT_ERROR; otherwise the command SHALL be rejected with FAILURE + */ + if (forecast.earliestStartTime.HasValue() && !forecast.earliestStartTime.Value().IsNull()) + { + earliestStartTime = forecast.earliestStartTime.Value().Value(); + } + else + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional earliestStartTime.", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + if (forecast.latestEndTime.HasValue()) + { + latestEndTime = forecast.latestEndTime.Value(); + } + else + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional latestEndTime.", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + if ( (requestedStartTime < earliestStartTime) + || ((requestedStartTime + duration) > latestEndTime)) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + return; + } + else + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); + + status = mDelegate.StartTimeAdjustRequest(requestedStartTime); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + if (status != Status::Success) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); + return; + } + + forecast.startTime = requestedStartTime; + forecast.endTime = requestedStartTime + duration; + mDelegate.SetForecast(forecast); + } + + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partially implemented", __FUNCTION__); + return; +} + +void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseRequest::DecodableType & commandData) +{ + Status status = Status::Success; + CHIP_ERROR err = CHIP_NO_ERROR; + Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); + uint32_t duration = commandData.duration; + + if (! HasFeature(Feature::kForecastAdjustment)) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); + return; + } + + if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + /* value SHALL be between the MinPauseDuration and MaxPauseDuration indicated in the + ActiveSlotNumber index in the Slots list in the Forecast. + */ + uint16_t activeSlotNumber; + if (forecast.activeSlotNumber.IsNull()) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber Is Null", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + activeSlotNumber = forecast.activeSlotNumber.Value(); + if (activeSlotNumber >= forecast.slots.size()) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, + activeSlotNumber, static_cast(forecast.slots.size())); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + if (! forecast.slots[activeSlotNumber].slotIsPauseable ) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber %d Is not pausible.", __FUNCTION__, activeSlotNumber); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + return; + } + + if ( (duration < forecast.slots[activeSlotNumber].minPauseDuration) + && (duration > forecast.slots[activeSlotNumber].maxPauseDuration)) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - out of range pause duration %d", __FUNCTION__, duration); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + return; + } + + err = mDelegate.SetESAState(ESAStateEnum::kPaused); + if (CHIP_NO_ERROR != err) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + status = mDelegate.PauseRequest(duration); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + if (status != Status::Success) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); + return; + } + + return; +} + +void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData) +{ + Status status = Status::Success; + Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); + + if (! HasFeature(Feature::kForecastAdjustment)) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); + return; + } + + if (ESAStateEnum::kPaused != mDelegate.GetESAState()) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState not Paused.", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + status = mDelegate.ResumeRequest(); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + if (status != Status::Success) + { + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); + return; + } + + // TODO: The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to reflect its current state. + ChipLogProgress(Zcl, "DEM: %s not fully implemented", __FUNCTION__); + return; +} + +void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData) +{ + +} + +void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, const Commands::RequestConstraintBasedForecast::DecodableType & commandData) +{ +} + +} // chip +} // app +} // Clusters +} // DeviceEnergyManagement + +void emberAfDeviceEnergyManagementClusterServerInitCallback(chip::EndpointId endpoint) {} + +void MatterDeviceEnergyManagementPluginServerInitCallback() {} diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h new file mode 100644 index 00000000000000..fc6f20c4da0936 --- /dev/null +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -0,0 +1,197 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +// TODO: Spec-defined constraints ? +constexpr int64_t kMinimumChargeCurrent = 0; + +using chip::Protocols::InteractionModel::Status; + +/** @brief Defines methods for implementing application-specific logic for this Cluster. + */ +class Delegate +{ +public: + virtual ~Delegate() = default; + + void SetEndpointId(EndpointId aEndpoint) { mEndpointId = aEndpoint; } + + /** + * @brief Delegate should implement a handler to begin to adjust client power + * consumption/generation to the level requested. + * + * @param power Milli-Watts the ESA SHALL use during the adjustment period. Positive values indicate the direction of current flow -towards- a load. + * @param duration The duration that the ESA SHALL maintain the requested power for. + * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. + */ + virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration) = 0; + + /** + * @brief Delegate SHALL make the ESA end the active power adjustment session & return to normal (or idle) power levels. + * The ESA SHALL also generate an PowerAdjustEnd Event and the ESAState SHALL be restored to Online. + * + * @return It should report SUCCESS if successful and FAILURE otherwise. + */ + virtual Status CancelPowerAdjustRequest() = 0; + + + /** + * @brief Delegate for the ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastId. + * + * If the ESA supports ForecastAdjustment, and the ESAState is not UserOptOut and the RequestedStartTime is after + * the EarliestStartTime and the resulting EndTime is before the LatestEndTime, then ESA SHALL accept the request + * to modify the Start Time. + * A client can estimate the entire Forecast sequence duration by computing the EndTime - StartTime fields from the + * Forecast attribute, and therefore avoid scheduling the start time too late. + * + * @param requestedStartTime The requested start time in UTC that the client would like the appliance to shift its power forecast to. + * @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate IM_Status. + */ + virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) = 0; + + /** + * @brief Delegate implementation: + * If the ESA supports FA and either the SlotIsPauseable field is true in the ActiveSlotNumber index in the + * Slots list, or the IsPausable field is true in the Forecast attribute structure, and the ESAState is not + * UserOptOut then the ESA SHALL pause its current operation. + * During this state the ESA SHALL not consume or produce significant power (other than required to keep its + * basic control system operational). + * The ESA SHALL also generate a Paused Event and the ESAState SHALL be restored to Paused. + * + * @param duration Duration that the ESA SHALL be paused for. SHALL be between MinPauseDuration & MaxPauseDuration for current slot. + * @return Success if the ESA is paused, otherwise returns other IM_Statuses. + */ + virtual Status PauseRequest(const uint32_t duration) = 0; + + /** + * @brief Delegate implementation: + * If the ESA supports FA and it is currently Paused then the ESA SHALL resume its operation. + * The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to + * reflect its current state. + * + * @return Success if the ESA is resumed, otherwise returns other IM_Statuss. + */ + virtual Status ResumeRequest() = 0; + + /** + * @brief Delegate should implement: + * If the ESA supports FA, and the ESAState is not UserOptOut it SHALL attempt to adjust its power forecast. + * This allows a one or more modifications in a single command by sending a list of modifications (one for each 'slot'). + * Attempts to modify slots which have already past, SHALL result in the entire command being rejected. + * If the ESA accepts the requested Forecast then it SHALL update its Forecast attribute (incrementing its ForecastId) + * and run the revised Forecast as its new intended operation. + * + * @param forecastId Indicates the ESA ForecastId that is to be modified. + * @param slotAdjustments List of adjustments to be applied to the ESA, corresponding to the expected ESA forecastId. + * @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command + * SHALL be rejected returning other IM_Statuss. + */ + virtual Status ModifyForecastRequest( const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) = 0; + + /** + * @brief Delegate should implement: + * The ESA SHALL inspect the requested power limits to ensure that there are no overlapping elements. The ESA + * manufacturer may also reject the request if it could cause the user’s preferences to be breached (e.g. may + * cause the home to be too hot or too cold, or a battery to be insufficiently charged). + * If the ESA can meet the requested power limits, it SHALL regenerate a new Power Forecast with a new ForecastId. + * + * @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within. + * @return Success if successfull, otherwise the command SHALL be rejected returning other IM_Statuss. + */ + virtual Status RequestConstraintBasedForecast(const DataModel::DecodableList & constraints) = 0; + + // ------------------------------------------------------------------ + // Get attribute methods + virtual ESATypeEnum GetESAType() = 0; + virtual bool GetESACanGenerate() = 0; + virtual ESAStateEnum GetESAState() = 0; + virtual int64_t GetAbsMinPower() = 0; + virtual int64_t GetAbsMaxPower() = 0; + virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() = 0; + virtual Structs::ForecastStruct::Type GetForecast() = 0; + + + // ------------------------------------------------------------------ + // Set attribute methods + virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0; + virtual CHIP_ERROR SetESACanGenerate(bool) = 0; + virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0; + virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0; + virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0; + virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) = 0; + virtual CHIP_ERROR SetForecast(Structs::ForecastStruct::Type &) = 0; + +protected: + EndpointId mEndpointId = 0; +}; + + +class Instance : public AttributeAccessInterface, public CommandHandlerInterface +{ +public: + Instance(EndpointId aEndpointId, Delegate & aDelegate); + ~Instance(); + + CHIP_ERROR Init(); + void Shutdown(); + + bool HasFeature(Feature aFeature) const; + +private: + Delegate & mDelegate; + EndpointId mEndpointId; + BitMask mFeature; + + // AttributeAccessInterface + CHIP_ERROR Read( const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; + + // CommandHandlerInterface + void InvokeCommand(HandlerContext & handlerContext) override; + CHIP_ERROR EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context) override; + + void HandlePowerAdjustRequest (HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData); + void HandleCancelPowerAdjustRequest (HandlerContext & ctx, const Commands::CancelPowerAdjustRequest::DecodableType & commandData); + void HandleStartTimeAdjustRequest (HandlerContext & ctx, const Commands::StartTimeAdjustRequest::DecodableType & commandData); + void HandlePauseRequest (HandlerContext & ctx, const Commands::PauseRequest::DecodableType & commandData); + void HandleResumeRequest (HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData); + void HandleModifyForecastRequest (HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData); + void HandleRequestConstraintBasedForecast(HandlerContext & ctx, const Commands::RequestConstraintBasedForecast::DecodableType & commandData); + +}; + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip From f6e9d419d06f25b8b2b142d8064cc4e2e7736824 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 12 Dec 2023 15:34:59 +0000 Subject: [PATCH 007/143] Restyled by whitespace --- .../device-energy-management-server.cpp | 2 +- .../device-energy-management-server.h | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 200337e744ac9a..a2a46209b41481 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -306,7 +306,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); return; } - + forecast.startTime = requestedStartTime; forecast.endTime = requestedStartTime + duration; mDelegate.SetForecast(forecast); diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index fc6f20c4da0936..cbacd0329fd181 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -50,7 +50,7 @@ class Delegate /** * @brief Delegate should implement a handler to begin to adjust client power * consumption/generation to the level requested. - * + * * @param power Milli-Watts the ESA SHALL use during the adjustment period. Positive values indicate the direction of current flow -towards- a load. * @param duration The duration that the ESA SHALL maintain the requested power for. * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. @@ -60,7 +60,7 @@ class Delegate /** * @brief Delegate SHALL make the ESA end the active power adjustment session & return to normal (or idle) power levels. * The ESA SHALL also generate an PowerAdjustEnd Event and the ESAState SHALL be restored to Online. - * + * * @return It should report SUCCESS if successful and FAILURE otherwise. */ virtual Status CancelPowerAdjustRequest() = 0; @@ -68,13 +68,13 @@ class Delegate /** * @brief Delegate for the ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastId. - * + * * If the ESA supports ForecastAdjustment, and the ESAState is not UserOptOut and the RequestedStartTime is after * the EarliestStartTime and the resulting EndTime is before the LatestEndTime, then ESA SHALL accept the request * to modify the Start Time. * A client can estimate the entire Forecast sequence duration by computing the EndTime - StartTime fields from the * Forecast attribute, and therefore avoid scheduling the start time too late. - * + * * @param requestedStartTime The requested start time in UTC that the client would like the appliance to shift its power forecast to. * @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate IM_Status. */ @@ -83,12 +83,12 @@ class Delegate /** * @brief Delegate implementation: * If the ESA supports FA and either the SlotIsPauseable field is true in the ActiveSlotNumber index in the - * Slots list, or the IsPausable field is true in the Forecast attribute structure, and the ESAState is not + * Slots list, or the IsPausable field is true in the Forecast attribute structure, and the ESAState is not * UserOptOut then the ESA SHALL pause its current operation. * During this state the ESA SHALL not consume or produce significant power (other than required to keep its * basic control system operational). * The ESA SHALL also generate a Paused Event and the ESAState SHALL be restored to Paused. - * + * * @param duration Duration that the ESA SHALL be paused for. SHALL be between MinPauseDuration & MaxPauseDuration for current slot. * @return Success if the ESA is paused, otherwise returns other IM_Statuses. */ @@ -97,9 +97,9 @@ class Delegate /** * @brief Delegate implementation: * If the ESA supports FA and it is currently Paused then the ESA SHALL resume its operation. - * The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to + * The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to * reflect its current state. - * + * * @return Success if the ESA is resumed, otherwise returns other IM_Statuss. */ virtual Status ResumeRequest() = 0; @@ -111,7 +111,7 @@ class Delegate * Attempts to modify slots which have already past, SHALL result in the entire command being rejected. * If the ESA accepts the requested Forecast then it SHALL update its Forecast attribute (incrementing its ForecastId) * and run the revised Forecast as its new intended operation. - * + * * @param forecastId Indicates the ESA ForecastId that is to be modified. * @param slotAdjustments List of adjustments to be applied to the ESA, corresponding to the expected ESA forecastId. * @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command @@ -122,10 +122,10 @@ class Delegate /** * @brief Delegate should implement: * The ESA SHALL inspect the requested power limits to ensure that there are no overlapping elements. The ESA - * manufacturer may also reject the request if it could cause the user’s preferences to be breached (e.g. may + * manufacturer may also reject the request if it could cause the user’s preferences to be breached (e.g. may * cause the home to be too hot or too cold, or a battery to be insufficiently charged). * If the ESA can meet the requested power limits, it SHALL regenerate a new Power Forecast with a new ForecastId. - * + * * @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within. * @return Success if successfull, otherwise the command SHALL be rejected returning other IM_Statuss. */ From 82d6fa5b741401e6f0e8b5d5a669d4be65c9af77 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 12 Dec 2023 15:35:02 +0000 Subject: [PATCH 008/143] Restyled by clang-format --- .../device-energy-management-server.cpp | 155 +++++++++--------- .../device-energy-management-server.h | 69 ++++---- 2 files changed, 113 insertions(+), 111 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index a2a46209b41481..836dbe3605f00e 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -21,7 +21,6 @@ #include #include - using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; @@ -30,7 +29,6 @@ using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; using chip::Protocols::InteractionModel::Status; - namespace chip { namespace app { namespace Clusters { @@ -67,7 +65,6 @@ bool Instance::HasFeature(Feature aFeature) const return mFeature.Has(aFeature); } - // AttributeAccessInterface CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { @@ -95,7 +92,7 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) { - return CHIP_ERROR_NOT_IMPLEMENTED; // Nothing writable in this cluster ! + return CHIP_ERROR_NOT_IMPLEMENTED; // Nothing writable in this cluster ! } // CommandHandlerInterface @@ -134,11 +131,13 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) return; case CancelPowerAdjustRequest::Id: HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleCancelPowerAdjustRequest(ctx, commandData); }); + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandleCancelPowerAdjustRequest(ctx, commandData); }); return; case StartTimeAdjustRequest::Id: HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleStartTimeAdjustRequest(ctx, commandData); }); + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandleStartTimeAdjustRequest(ctx, commandData); }); return; case PauseRequest::Id: HandleCommand( @@ -149,38 +148,40 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleResumeRequest(ctx, commandData); }); return; case ModifyForecastRequest::Id: - HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleModifyForecastRequest(ctx, commandData); }); + HandleCommand(handlerContext, [this](HandlerContext & ctx, const auto & commandData) { + HandleModifyForecastRequest(ctx, commandData); + }); return; case RequestConstraintBasedForecast::Id: HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleRequestConstraintBasedForecast(ctx, commandData); }); + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandleRequestConstraintBasedForecast(ctx, commandData); }); return; } } void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData) { - int64_t power = commandData.power; + int64_t power = commandData.power; uint32_t durationSec = commandData.duration; - bool validArgs = false; - Status status = Status::Success; + bool validArgs = false; + Status status = Status::Success; auto powerAdjustmentCapability = mDelegate.GetPowerAdjustmentCapability(); if (powerAdjustmentCapability.IsNull()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s powerAdjustmentCapability IsNull", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s powerAdjustmentCapability IsNull", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } for (auto pas : powerAdjustmentCapability.Value()) { - if ( (power >= pas.minPower) && (durationSec >= pas.minDuration) - && (power <= pas.maxPower) && (durationSec <= pas.maxDuration)) + if ((power >= pas.minPower) && (durationSec >= pas.minDuration) && (power <= pas.maxPower) && + (durationSec <= pas.maxDuration)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustment args", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustment args", __FUNCTION__); validArgs = true; break; } @@ -188,13 +189,13 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po if (!validArgs) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s invalid request range", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s invalid request range", __FUNCTION__); // TODO: raise event ? ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustRequest() args.", __FUNCTION__); // TODO: Generate a PowerAdjustStart Event, then begins to adjust its power. How is this done, Async? // When done, raise PowerAdjustEnd & ESAState set to kOnline. @@ -202,63 +203,64 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); } - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partly implemented", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partly implemented", __FUNCTION__); return; } - -void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, const Commands::CancelPowerAdjustRequest::DecodableType & commandData) +void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, + const Commands::CancelPowerAdjustRequest::DecodableType & commandData) { - Status status = Status::Success; - ESAStateEnum esaStatus; + Status status = Status::Success; + ESAStateEnum esaStatus; esaStatus = mDelegate.GetESAState(); if (ESAStateEnum::kPowerAdjustActive != esaStatus) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } /* TODO: If the command is accepted, the ESA SHALL generate an PowerAdjustEnd Event. */ - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good CancelPowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good CancelPowerAdjustRequest() args.", __FUNCTION__); status = mDelegate.CancelPowerAdjustRequest(); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); return; } ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s partly implemented", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s partly implemented", __FUNCTION__); return; } -void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands::StartTimeAdjustRequest::DecodableType & commandData) +void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, + const Commands::StartTimeAdjustRequest::DecodableType & commandData) { - Status status = Status::Success; - uint32_t earliestStartTime = 0; - uint32_t latestEndTime = 0; + Status status = Status::Success; + uint32_t earliestStartTime = 0; + uint32_t latestEndTime = 0; Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); - uint32_t duration = forecast.endTime - forecast.startTime; // the current entire forecast duration - uint32_t requestedStartTime = commandData.requestedStartTime; + uint32_t duration = forecast.endTime - forecast.startTime; // the current entire forecast duration + uint32_t requestedStartTime = commandData.requestedStartTime; - if (! HasFeature(Feature::kForecastAdjustment)) + if (!HasFeature(Feature::kForecastAdjustment)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -272,7 +274,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands } else { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional earliestStartTime.", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional earliestStartTime.", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -283,27 +285,26 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands } else { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional latestEndTime.", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional latestEndTime.", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } - if ( (requestedStartTime < earliestStartTime) - || ((requestedStartTime + duration) > latestEndTime)) + if ((requestedStartTime < earliestStartTime) || ((requestedStartTime + duration) > latestEndTime)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } else { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); status = mDelegate.StartTimeAdjustRequest(requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); return; } @@ -312,27 +313,27 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands mDelegate.SetForecast(forecast); } - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partially implemented", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partially implemented", __FUNCTION__); return; } void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseRequest::DecodableType & commandData) { - Status status = Status::Success; - CHIP_ERROR err = CHIP_NO_ERROR; + Status status = Status::Success; + CHIP_ERROR err = CHIP_NO_ERROR; Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); - uint32_t duration = commandData.duration; + uint32_t duration = commandData.duration; - if (! HasFeature(Feature::kForecastAdjustment)) + if (!HasFeature(Feature::kForecastAdjustment)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -343,7 +344,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq uint16_t activeSlotNumber; if (forecast.activeSlotNumber.IsNull()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber Is Null", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber Is Null", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -351,23 +352,23 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq activeSlotNumber = forecast.activeSlotNumber.Value(); if (activeSlotNumber >= forecast.slots.size()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, - activeSlotNumber, static_cast(forecast.slots.size())); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, activeSlotNumber, + static_cast(forecast.slots.size())); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } - if (! forecast.slots[activeSlotNumber].slotIsPauseable ) + if (!forecast.slots[activeSlotNumber].slotIsPauseable) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber %d Is not pausible.", __FUNCTION__, activeSlotNumber); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber %d Is not pausible.", __FUNCTION__, activeSlotNumber); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - if ( (duration < forecast.slots[activeSlotNumber].minPauseDuration) - && (duration > forecast.slots[activeSlotNumber].maxPauseDuration)) + if ((duration < forecast.slots[activeSlotNumber].minPauseDuration) && + (duration > forecast.slots[activeSlotNumber].maxPauseDuration)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - out of range pause duration %d", __FUNCTION__, duration); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - out of range pause duration %d", __FUNCTION__, duration); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -375,7 +376,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq err = mDelegate.SetESAState(ESAStateEnum::kPaused); if (CHIP_NO_ERROR != err) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -384,7 +385,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); return; } @@ -393,19 +394,19 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData) { - Status status = Status::Success; + Status status = Status::Success; Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); - if (! HasFeature(Feature::kForecastAdjustment)) + if (!HasFeature(Feature::kForecastAdjustment)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); return; } if (ESAStateEnum::kPaused != mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState not Paused.", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState not Paused.", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -414,29 +415,27 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); + ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); return; } // TODO: The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to reflect its current state. - ChipLogProgress(Zcl, "DEM: %s not fully implemented", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s not fully implemented", __FUNCTION__); return; } void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData) -{ +{} -} - -void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, const Commands::RequestConstraintBasedForecast::DecodableType & commandData) -{ -} +void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, + const Commands::RequestConstraintBasedForecast::DecodableType & commandData) +{} -} // chip -} // app -} // Clusters -} // DeviceEnergyManagement +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip -void emberAfDeviceEnergyManagementClusterServerInitCallback(chip::EndpointId endpoint) {} +void emberAfDeviceEnergyManagementClusterServerInitCallback(chip::EndpointId endpoint) {} void MatterDeviceEnergyManagementPluginServerInitCallback() {} diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index cbacd0329fd181..e182fd6d79765d 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -27,14 +27,13 @@ #include #include - namespace chip { namespace app { namespace Clusters { namespace DeviceEnergyManagement { // TODO: Spec-defined constraints ? -constexpr int64_t kMinimumChargeCurrent = 0; +constexpr int64_t kMinimumChargeCurrent = 0; using chip::Protocols::InteractionModel::Status; @@ -51,7 +50,8 @@ class Delegate * @brief Delegate should implement a handler to begin to adjust client power * consumption/generation to the level requested. * - * @param power Milli-Watts the ESA SHALL use during the adjustment period. Positive values indicate the direction of current flow -towards- a load. + * @param power Milli-Watts the ESA SHALL use during the adjustment period. Positive values indicate the direction of current + * flow -towards- a load. * @param duration The duration that the ESA SHALL maintain the requested power for. * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. */ @@ -65,7 +65,6 @@ class Delegate */ virtual Status CancelPowerAdjustRequest() = 0; - /** * @brief Delegate for the ESA SHALL update its Forecast attribute with the RequestedStartTime including a new ForecastId. * @@ -75,8 +74,10 @@ class Delegate * A client can estimate the entire Forecast sequence duration by computing the EndTime - StartTime fields from the * Forecast attribute, and therefore avoid scheduling the start time too late. * - * @param requestedStartTime The requested start time in UTC that the client would like the appliance to shift its power forecast to. - * @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate IM_Status. + * @param requestedStartTime The requested start time in UTC that the client would like the appliance to shift its power + * forecast to. + * @return Success if the StartTime in the Forecast is updated, otherwise the command SHALL be rejected with appropriate + * IM_Status. */ virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) = 0; @@ -89,7 +90,8 @@ class Delegate * basic control system operational). * The ESA SHALL also generate a Paused Event and the ESAState SHALL be restored to Paused. * - * @param duration Duration that the ESA SHALL be paused for. SHALL be between MinPauseDuration & MaxPauseDuration for current slot. + * @param duration Duration that the ESA SHALL be paused for. SHALL be between MinPauseDuration & MaxPauseDuration for current + * slot. * @return Success if the ESA is paused, otherwise returns other IM_Statuses. */ virtual Status PauseRequest(const uint32_t duration) = 0; @@ -117,7 +119,8 @@ class Delegate * @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command * SHALL be rejected returning other IM_Statuss. */ - virtual Status ModifyForecastRequest( const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) = 0; + virtual Status ModifyForecastRequest(const uint32_t forecastId, + const DataModel::DecodableList & slotAdjustments) = 0; /** * @brief Delegate should implement: @@ -129,34 +132,33 @@ class Delegate * @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within. * @return Success if successfull, otherwise the command SHALL be rejected returning other IM_Statuss. */ - virtual Status RequestConstraintBasedForecast(const DataModel::DecodableList & constraints) = 0; + virtual Status + RequestConstraintBasedForecast(const DataModel::DecodableList & constraints) = 0; // ------------------------------------------------------------------ // Get attribute methods - virtual ESATypeEnum GetESAType() = 0; - virtual bool GetESACanGenerate() = 0; - virtual ESAStateEnum GetESAState() = 0; - virtual int64_t GetAbsMinPower() = 0; - virtual int64_t GetAbsMaxPower() = 0; - virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() = 0; - virtual Structs::ForecastStruct::Type GetForecast() = 0; - + virtual ESATypeEnum GetESAType() = 0; + virtual bool GetESACanGenerate() = 0; + virtual ESAStateEnum GetESAState() = 0; + virtual int64_t GetAbsMinPower() = 0; + virtual int64_t GetAbsMaxPower() = 0; + virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() = 0; + virtual Structs::ForecastStruct::Type GetForecast() = 0; // ------------------------------------------------------------------ // Set attribute methods - virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0; - virtual CHIP_ERROR SetESACanGenerate(bool) = 0; - virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0; - virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0; - virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0; + virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0; + virtual CHIP_ERROR SetESACanGenerate(bool) = 0; + virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0; + virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0; + virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0; virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) = 0; - virtual CHIP_ERROR SetForecast(Structs::ForecastStruct::Type &) = 0; + virtual CHIP_ERROR SetForecast(Structs::ForecastStruct::Type &) = 0; protected: EndpointId mEndpointId = 0; }; - class Instance : public AttributeAccessInterface, public CommandHandlerInterface { public: @@ -174,21 +176,22 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface BitMask mFeature; // AttributeAccessInterface - CHIP_ERROR Read( const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; // CommandHandlerInterface void InvokeCommand(HandlerContext & handlerContext) override; CHIP_ERROR EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context) override; - void HandlePowerAdjustRequest (HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData); - void HandleCancelPowerAdjustRequest (HandlerContext & ctx, const Commands::CancelPowerAdjustRequest::DecodableType & commandData); - void HandleStartTimeAdjustRequest (HandlerContext & ctx, const Commands::StartTimeAdjustRequest::DecodableType & commandData); - void HandlePauseRequest (HandlerContext & ctx, const Commands::PauseRequest::DecodableType & commandData); - void HandleResumeRequest (HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData); - void HandleModifyForecastRequest (HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData); - void HandleRequestConstraintBasedForecast(HandlerContext & ctx, const Commands::RequestConstraintBasedForecast::DecodableType & commandData); - + void HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::PowerAdjustRequest::DecodableType & commandData); + void HandleCancelPowerAdjustRequest(HandlerContext & ctx, + const Commands::CancelPowerAdjustRequest::DecodableType & commandData); + void HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands::StartTimeAdjustRequest::DecodableType & commandData); + void HandlePauseRequest(HandlerContext & ctx, const Commands::PauseRequest::DecodableType & commandData); + void HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData); + void HandleModifyForecastRequest(HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData); + void HandleRequestConstraintBasedForecast(HandlerContext & ctx, + const Commands::RequestConstraintBasedForecast::DecodableType & commandData); }; } // namespace DeviceEnergyManagement From 2dd4b79af435497cc07e16d378a9b26386b1716f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 12 Dec 2023 22:12:41 +0000 Subject: [PATCH 009/143] Fixes based on similar conversations on EVSE review. Made Forecast and PowerAdjustmentCapability Nullable attributes. Added feature support. --- .../device-energy-management-server.cpp | 343 +++++++++++------- .../device-energy-management-server.h | 20 +- 2 files changed, 224 insertions(+), 139 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 836dbe3605f00e..4918a2f1013964 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -34,30 +34,18 @@ namespace app { namespace Clusters { namespace DeviceEnergyManagement { -Instance::Instance(EndpointId aEndpointId, Delegate & aDelegate) : - AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), - mDelegate(aDelegate), mEndpointId(aEndpointId) -{ - /* set the base class delegates endpointId */ - mDelegate.SetEndpointId(aEndpointId); -} - -Instance::~Instance() -{ - Shutdown(); -} - CHIP_ERROR Instance::Init() { - registerAttributeAccessOverride(this); - InteractionModelEngine::GetInstance()->RegisterCommandHandler(this); + ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); + VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); + return CHIP_NO_ERROR; } void Instance::Shutdown() { - unregisterAttributeAccessOverride(this); InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); + unregisterAttributeAccessOverride(this); } bool Instance::HasFeature(Feature aFeature) const @@ -81,8 +69,18 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu case AbsMaxPower::Id: return aEncoder.Encode(mDelegate.GetAbsMaxPower()); case PowerAdjustmentCapability::Id: + /* PA - PowerAdjustment */ + if (!HasFeature(Feature::kPowerAdjustment)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } return aEncoder.Encode(mDelegate.GetPowerAdjustmentCapability()); case Forecast::Id: + /* PFR | SFR - Power Forecast Reporting or State Forecast Reporting */ + if (!HasFeature(Feature::kPowerForecastReporting) && !HasFeature(Feature::kStateForecastReporting)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } return aEncoder.Encode(mDelegate.GetForecast()); } @@ -100,19 +98,34 @@ CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & clust { using namespace Commands; - for (auto && id : { - PowerAdjustRequest::Id, - CancelPowerAdjustRequest::Id, - StartTimeAdjustRequest::Id, - PauseRequest::Id, - ResumeRequest::Id, - ModifyForecastRequest::Id, - RequestConstraintBasedForecast::Id, - }) + if (HasFeature(Feature::kPowerAdjustment)) { - if (callback(id, context) == Loop::Break) + for (auto && id : { + PowerAdjustRequest::Id, + CancelPowerAdjustRequest::Id, + }) { - return CHIP_NO_ERROR; + if (callback(id, context) == Loop::Break) + { + return CHIP_NO_ERROR; + } + } + } + + if (HasFeature(Feature::kForecastAdjustment)) + { + for (auto && id : { + StartTimeAdjustRequest::Id, + PauseRequest::Id, + ResumeRequest::Id, + ModifyForecastRequest::Id, + RequestConstraintBasedForecast::Id, + }) + { + if (callback(id, context) == Loop::Break) + { + return CHIP_NO_ERROR; + } } } @@ -126,36 +139,86 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) switch (handlerContext.mRequestPath.mCommandId) { case PowerAdjustRequest::Id: - HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandlePowerAdjustRequest(ctx, commandData); }); + if (!HasFeature(Feature::kPowerAdjustment)) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); + } + else + { + HandleCommand( + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandlePowerAdjustRequest(ctx, commandData); }); + } return; case CancelPowerAdjustRequest::Id: - HandleCommand( - handlerContext, - [this](HandlerContext & ctx, const auto & commandData) { HandleCancelPowerAdjustRequest(ctx, commandData); }); + if (!HasFeature(Feature::kPowerAdjustment)) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); + } + else + { + HandleCommand( + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandleCancelPowerAdjustRequest(ctx, commandData); }); + } return; case StartTimeAdjustRequest::Id: - HandleCommand( - handlerContext, - [this](HandlerContext & ctx, const auto & commandData) { HandleStartTimeAdjustRequest(ctx, commandData); }); + if (HasFeature(Feature::kForecastAdjustment)) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); + } + else + { + HandleCommand( + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandleStartTimeAdjustRequest(ctx, commandData); }); + } return; case PauseRequest::Id: - HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandlePauseRequest(ctx, commandData); }); + if (HasFeature(Feature::kForecastAdjustment)) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); + } + else + { + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandlePauseRequest(ctx, commandData); }); + } return; case ResumeRequest::Id: - HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleResumeRequest(ctx, commandData); }); + if (HasFeature(Feature::kForecastAdjustment)) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); + } + else + { + HandleCommand( + handlerContext, [this](HandlerContext & ctx, const auto & commandData) { HandleResumeRequest(ctx, commandData); }); + } return; case ModifyForecastRequest::Id: - HandleCommand(handlerContext, [this](HandlerContext & ctx, const auto & commandData) { - HandleModifyForecastRequest(ctx, commandData); - }); + if (HasFeature(Feature::kForecastAdjustment)) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); + } + else + { + HandleCommand( + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandleModifyForecastRequest(ctx, commandData); }); + } return; case RequestConstraintBasedForecast::Id: - HandleCommand( - handlerContext, - [this](HandlerContext & ctx, const auto & commandData) { HandleRequestConstraintBasedForecast(ctx, commandData); }); + if (HasFeature(Feature::kForecastAdjustment)) + { + handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); + } + else + { + HandleCommand( + handlerContext, + [this](HandlerContext & ctx, const auto & commandData) { HandleRequestConstraintBasedForecast(ctx, commandData); }); + } return; } } @@ -171,17 +234,18 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po if (powerAdjustmentCapability.IsNull()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s powerAdjustmentCapability IsNull", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s powerAdjustmentCapability IsNull", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } + /* PowerAdjustmentCapability is a list - so iterate through checking if the command is within one of the offers */ for (auto pas : powerAdjustmentCapability.Value()) { if ((power >= pas.minPower) && (durationSec >= pas.minDuration) && (power <= pas.maxPower) && (durationSec <= pas.maxDuration)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustment args", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s Good PowerAdjustment args", __FUNCTION__); validArgs = true; break; } @@ -189,24 +253,20 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po if (!validArgs) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s invalid request range", __FUNCTION__); - // TODO: raise event ? + ChipLogProgress(Zcl, "DEM: %s invalid request range", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good PowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s Good PowerAdjustRequest() args.", __FUNCTION__); - // TODO: Generate a PowerAdjustStart Event, then begins to adjust its power. How is this done, Async? - // When done, raise PowerAdjustEnd & ESAState set to kOnline. + /* Call the delegate to do the power adjustment */ status = mDelegate.PowerAdjustRequest(power, durationSec); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); } - - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partly implemented", __FUNCTION__); return; } @@ -216,124 +276,130 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, Status status = Status::Success; ESAStateEnum esaStatus; + /* Check that the ESA state is PowerAdjustActive */ esaStatus = mDelegate.GetESAState(); - if (ESAStateEnum::kPowerAdjustActive != esaStatus) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } - /* TODO: If the command is accepted, the ESA SHALL generate an PowerAdjustEnd Event. */ - - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Good CancelPowerAdjustRequest() args.", __FUNCTION__); + /* Call the delegate to cancel the power adjustment */ status = mDelegate.CancelPowerAdjustRequest(); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s Failed to CancelPowerAdjustRequest()", __FUNCTION__); return; } - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s partly implemented", __FUNCTION__); return; } void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands::StartTimeAdjustRequest::DecodableType & commandData) { - Status status = Status::Success; - uint32_t earliestStartTime = 0; - uint32_t latestEndTime = 0; - Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); - uint32_t duration = forecast.endTime - forecast.startTime; // the current entire forecast duration - uint32_t requestedStartTime = commandData.requestedStartTime; - - if (!HasFeature(Feature::kForecastAdjustment)) + Status status = Status::Success; + uint32_t earliestStartTime = 0; + uint32_t latestEndTime = 0; + DataModel::Nullable forecast = mDelegate.GetForecast(); + + uint32_t duration; + uint32_t requestedStartTime = commandData.requestedStartTime; + + if (forecast.IsNull()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); + ChipLogProgress(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } - /* If the RequestedStartTime value resulted in a time shift which is outside the time constraints of EarliestStartTime and - LatestEndTime, then the command SHALL be rejected with CONSTRAINT_ERROR; otherwise the command SHALL be rejected with FAILURE - */ - if (forecast.earliestStartTime.HasValue() && !forecast.earliestStartTime.Value().IsNull()) + /* If the RequestedStartTime value resulted in a time shift which is + * outside the time constraints of EarliestStartTime and + * LatestEndTime, then the command SHALL be rejected with CONSTRAINT_ERROR; + * otherwise the command SHALL be rejected with FAILURE + */ + /* earliestStartTime is optional based on the FA (ForecastAdjust) feature AND can be nullable */ + if (forecast.Value().earliestStartTime.HasValue() || forecast.Value().latestEndTime.HasValue()) { - earliestStartTime = forecast.earliestStartTime.Value().Value(); + /* These Should not be NULL since this command requires FA feature and these are mandatory for that */ + ChipLogProgress(Zcl, "DEM: %s - EarliestStartTime / LatestEndTime not valid", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; } - else + + chip::System::Clock::Milliseconds64 cTMs; + auto chipError = chip::System::SystemClock().GetClock_RealTimeMS(cTMs); + if (chipError != CHIP_NO_ERROR) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional earliestStartTime.", __FUNCTION__); + ChipLogError(Zcl, "DEM: Unable to get current time - error=%d (%s)]", chipError.AsInteger(), chipError.AsString()); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } + uint32_t epochNow = std::chrono::duration_cast(cTMs).count(); - if (forecast.latestEndTime.HasValue()) + if (forecast.Value().earliestStartTime.Value().IsNull()) { - latestEndTime = forecast.latestEndTime.Value(); + /* Null means - We can start immediately */ + earliestStartTime = epochNow; /* NOW */ } else { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - NullOptional latestEndTime.", __FUNCTION__); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); - return; + earliestStartTime = forecast.Value().earliestStartTime.Value().Value(); } + /* Latest End Time is optional & cannot be null - unlike earliestStartTime! */ + latestEndTime = forecast.Value().latestEndTime.Value(); + + duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration if ((requestedStartTime < earliestStartTime) || ((requestedStartTime + duration) > latestEndTime)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogProgress(Zcl, "DEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } else { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogProgress(Zcl, "DEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); status = mDelegate.StartTimeAdjustRequest(requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); + ChipLogProgress(Zcl, "DEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); return; } - - forecast.startTime = requestedStartTime; - forecast.endTime = requestedStartTime + duration; - mDelegate.SetForecast(forecast); } - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Partially implemented", __FUNCTION__); return; } void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseRequest::DecodableType & commandData) { - Status status = Status::Success; - CHIP_ERROR err = CHIP_NO_ERROR; - Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); - uint32_t duration = commandData.duration; + Status status = Status::Success; + CHIP_ERROR err = CHIP_NO_ERROR; + DataModel::Nullable forecast = mDelegate.GetForecast(); - if (!HasFeature(Feature::kForecastAdjustment)) + uint32_t duration = commandData.duration; + + if (forecast.IsNull()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); + ChipLogProgress(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -342,33 +408,33 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq ActiveSlotNumber index in the Slots list in the Forecast. */ uint16_t activeSlotNumber; - if (forecast.activeSlotNumber.IsNull()) + if (forecast.Value().activeSlotNumber.IsNull()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber Is Null", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s - activeSlotNumber Is Null", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } - activeSlotNumber = forecast.activeSlotNumber.Value(); - if (activeSlotNumber >= forecast.slots.size()) + activeSlotNumber = forecast.Value().activeSlotNumber.Value(); + if (activeSlotNumber >= forecast.Value().slots.size()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, activeSlotNumber, - static_cast(forecast.slots.size())); + ChipLogProgress(Zcl, "DEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, activeSlotNumber, + static_cast(forecast.Value().slots.size())); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } - if (!forecast.slots[activeSlotNumber].slotIsPauseable) + if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - activeSlotNumber %d Is not pausible.", __FUNCTION__, activeSlotNumber); + ChipLogProgress(Zcl, "DEM: %s - activeSlotNumber %d is NOT pausible.", __FUNCTION__, activeSlotNumber); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - if ((duration < forecast.slots[activeSlotNumber].minPauseDuration) && - (duration > forecast.slots[activeSlotNumber].maxPauseDuration)) + if ((duration < forecast.Value().slots[activeSlotNumber].minPauseDuration) && + (duration > forecast.Value().slots[activeSlotNumber].maxPauseDuration)) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - out of range pause duration %d", __FUNCTION__, duration); + ChipLogProgress(Zcl, "DEM: %s - out of range pause duration %d", __FUNCTION__, duration); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -376,16 +442,17 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq err = mDelegate.SetESAState(ESAStateEnum::kPaused); if (CHIP_NO_ERROR != err) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } + /* Finally - we can call the delegate to ask for a pause */ status = mDelegate.PauseRequest(duration); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); + ChipLogProgress(Zcl, "DEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); return; } @@ -394,48 +461,62 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData) { - Status status = Status::Success; - Structs::ForecastStruct::Type forecast = mDelegate.GetForecast(); + Status status = Status::Success; - if (!HasFeature(Feature::kForecastAdjustment)) - { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s Feature kForecastAdjustment not enabled", __FUNCTION__); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::UnsupportedCommand); - return; - } + DataModel::Nullable forecast = mDelegate.GetForecast(); if (ESAStateEnum::kPaused != mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - ESAState not Paused.", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s - ESAState not Paused.", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } + /* Call the delegate to resume */ status = mDelegate.ResumeRequest(); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogProgress(Zcl, "zzzzzzzzzzDEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); return; } - // TODO: The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to reflect its current state. - ChipLogProgress(Zcl, "DEM: %s not fully implemented", __FUNCTION__); return; } void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData) -{} +{ + Status status = Status::UnsupportedCommand; // TODO Status::Success; + // CHIP_ERROR err = CHIP_NO_ERROR; + + DataModel::Nullable forecast = mDelegate.GetForecast(); + + if (forecast.IsNull()) + { + ChipLogProgress(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + // TODO update the forecast details + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + return; +} void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, const Commands::RequestConstraintBasedForecast::DecodableType & commandData) -{} +{ + Status status = Status::UnsupportedCommand; // TODO Status::Success; + + // TODO pass this up to the delegate if it supports it + ChipLogProgress(Zcl, "DEM: %s - Handle Constraint based forecast ", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + return; +} } // namespace DeviceEnergyManagement } // namespace Clusters } // namespace app } // namespace chip -void emberAfDeviceEnergyManagementClusterServerInitCallback(chip::EndpointId endpoint) {} - void MatterDeviceEnergyManagementPluginServerInitCallback() {} diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index e182fd6d79765d..37e23a720172ca 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -17,6 +17,7 @@ */ #pragma once + #include #include #include @@ -32,9 +33,6 @@ namespace app { namespace Clusters { namespace DeviceEnergyManagement { -// TODO: Spec-defined constraints ? -constexpr int64_t kMinimumChargeCurrent = 0; - using chip::Protocols::InteractionModel::Status; /** @brief Defines methods for implementing application-specific logic for this Cluster. @@ -143,7 +141,7 @@ class Delegate virtual int64_t GetAbsMinPower() = 0; virtual int64_t GetAbsMaxPower() = 0; virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() = 0; - virtual Structs::ForecastStruct::Type GetForecast() = 0; + virtual DataModel::Nullable GetForecast() = 0; // ------------------------------------------------------------------ // Set attribute methods @@ -153,7 +151,7 @@ class Delegate virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0; virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0; virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) = 0; - virtual CHIP_ERROR SetForecast(Structs::ForecastStruct::Type &) = 0; + virtual CHIP_ERROR SetForecast(DataModel::Nullable &) = 0; protected: EndpointId mEndpointId = 0; @@ -162,8 +160,15 @@ class Delegate class Instance : public AttributeAccessInterface, public CommandHandlerInterface { public: - Instance(EndpointId aEndpointId, Delegate & aDelegate); - ~Instance(); + Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature) : + AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), + mDelegate(aDelegate), mFeature(aFeature) + { + /* set the base class delegates endpointId */ + mDelegate.SetEndpointId(aEndpointId); + } + + ~Instance() { Shutdown(); } CHIP_ERROR Init(); void Shutdown(); @@ -172,7 +177,6 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface private: Delegate & mDelegate; - EndpointId mEndpointId; BitMask mFeature; // AttributeAccessInterface From 8582412bf8cbf772e87821228bef0ecece13ae7d Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 12 Dec 2023 22:14:07 +0000 Subject: [PATCH 010/143] Added delegate class to all-clusters-app --- .../DeviceEnergyManagementDelegateImpl.h | 92 +++++++ .../DeviceEnergyManagementDelegateImpl.cpp | 250 ++++++++++++++++++ 2 files changed, 342 insertions(+) create mode 100644 examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h create mode 100644 examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h new file mode 100644 index 00000000000000..4f30c4e808d2db --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h @@ -0,0 +1,92 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "app/clusters/device-energy-management-server/device-energy-management-server.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using chip::Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +/** The application delegate. + */ +class DeviceEnergyManagementDelegate : public Delegate +{ +public: + DeviceEnergyManagementDelegate(); + virtual ~DeviceEnergyManagementDelegate() = default; + + virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration) override; + virtual Status CancelPowerAdjustRequest() override; + virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) override; + virtual Status PauseRequest(const uint32_t duration) override; + virtual Status ResumeRequest() override; + virtual Status + ModifyForecastRequest(const uint32_t forecastId, + const DataModel::DecodableList & slotAdjustments) override; + virtual Status RequestConstraintBasedForecast( + const DataModel::DecodableList & constraints) override; + + // ------------------------------------------------------------------ + // Get attribute methods + virtual ESATypeEnum GetESAType() override; + virtual bool GetESACanGenerate() override; + virtual ESAStateEnum GetESAState() override; + virtual int64_t GetAbsMinPower() override; + virtual int64_t GetAbsMaxPower() override; + virtual DataModel::Nullable GetPowerAdjustmentCapability() override; + virtual DataModel::Nullable GetForecast() override; + + // ------------------------------------------------------------------ + // Set attribute methods + virtual CHIP_ERROR SetESAType(ESATypeEnum) override; + virtual CHIP_ERROR SetESACanGenerate(bool) override; + virtual CHIP_ERROR SetESAState(ESAStateEnum) override; + virtual CHIP_ERROR SetAbsMinPower(int64_t) override; + virtual CHIP_ERROR SetAbsMaxPower(int64_t) override; + virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) override; + virtual CHIP_ERROR SetForecast(Structs::ForecastStruct::Type &) override; + +private: + ESATypeEnum mEsaType; + bool mEsaCanGenerate; + ESAStateEnum mEsaState; + int64_t mAbsMinPower; + int64_t mAbsMaxPower; + DataModel::Nullable mPowerAdjustmentCapability; + DataModel::Nullable mForecast; +}; + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp new file mode 100644 index 00000000000000..b71da7508c9e39 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -0,0 +1,250 @@ +/* + * + * 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 "DeviceEnergyManagementDelegateImpl.h" +// #include +// #include +// #include + +using namespace chip::app::Clusters::DeviceEnergyManagement; +using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; + +using chip::Optional; +using namespace chip::app; +using CostsList = DataModel::List; + +Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, const uint32_t duration) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + + // TODO: implement + mEsaState = ESAStateEnum::kPowerAdjustActive; + + // TODO: Generate a PowerAdjustStart Event, then begins to adjust its power + // When done, raise PowerAdjustEnd & ESAState set to kOnline. + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + return status; +} + +Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() +{ + Status status = Status::UnsupportedCommand; // Status::Success; + + // TODO: implement + /* TODO: If the command is accepted, the ESA SHALL generate an PowerAdjustEnd Event. */ + mEsaState = ESAStateEnum::kOnline; + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + return status; +} + +Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + + // TODO: implement + DataModel::Nullable forecast = mDelegate.GetForecast(); + + if (!forecast.IsNull()) + { + uint32_t duration = forecast.endTime - forecast.startTime; // the current entire forecast duration + + /* Modify start time and end time */ + forecast.startTime = requestedStartTime; + forecast.endTime = requestedStartTime + duration; + + mDelegate.SetForecast(forecast); + } + return status; +} + +Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + return status; +} + +Status DeviceEnergyManagementDelegate::ResumeRequest() +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + mEsaState = ESAStateEnum::kOnline; + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + return status; +} + +Status DeviceEnergyManagementDelegate::ModifyForecastRequest( + const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + return status; +} + +Status DeviceEnergyManagementDelegate::RequestConstraintBasedForecast( + const DataModel::DecodableList & constraints) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + return status; +} + +// ------------------------------------------------------------------ +// Get attribute methods +ESATypeEnum DeviceEnergyManagementDelegate::GetESAType() +{ + return mEsaType; +} + +bool DeviceEnergyManagementDelegate::GetESACanGenerate() +{ + return mEsaCanGenerate; +} + +ESAStateEnum DeviceEnergyManagementDelegate::GetESAState() +{ + return mEsaState; +} + +int64_t DeviceEnergyManagementDelegate::GetAbsMinPower() +{ + return mAbsMinPower; +} + +int64_t DeviceEnergyManagementDelegate::GetAbsMaxPower() +{ + return mAbsMaxPower; +} + +Attributes::PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() +{ + return mPowerAdjustmentCapability; +} + +DataModel::Nullable DeviceEnergyManagementDelegate::GetForecast() +{ + return mForecast; +} + +// ------------------------------------------------------------------ +// Set attribute methods + +CHIP_ERROR DeviceEnergyManagementDelegate::SetESAType(ESATypeEnum newValue) +{ + ESATypeEnum oldValue = mEsaState; + + if (newValue >= ESATypeEnum::kUnknownEnumValue) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + mEsaType = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mEsaType updated to %d", (int) mEsaType); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAType::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetESACanGenerate(bool newValue) +{ + bool oldValue = mEsaCanGenerate; + + mEsaCanGenerate = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mEsaCanGenerate updated to %d", (int) mEsaCanGenerate); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESACanGenerate::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetESAState(ESAStateEnum newValue) +{ + ESAStateEnum oldValue = mEsaState; + + if (newValue >= ESAStateEnum::kUnknownEnumValue) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + mEsaState = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mEsaState updated to %d", (int) mEsaState); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMinPower(int64_t newValue) +{ + int64_t oldValue = mAbsMinPower; + + mAbsMinPower = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mAbsMinPower updated to %d", (int) mAbsMinPower); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMinPower::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) +{ + int64_t oldValue = mAbsMaxPower; + + mAbsMaxPower = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mAbsMaxPower updated to %d", (int) mAbsMaxPower); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMaxPower::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( + Attributes::PowerAdjustmentCapability::TypeInfo::Type & powerAdjustmentCapability) +{ + // TODO copy the value + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, PowerAdjustmentCapability::Id); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(Structs::ForecastStruct::Type & forecast) +{ + mForecast = forecast; + mForecast.forecastId++; + + // TODO update the member variable structure + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, Forecast::Id); + + return CHIP_NO_ERROR; +} From c9ce2f73ebcf9fd0da6bbefc22967429bc3e0815 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 13 Dec 2023 01:08:07 +0000 Subject: [PATCH 011/143] Changed ChipLogProgress to Error. Better handling of EnumerateCommands --- .../device-energy-management-server.cpp | 61 +++++++++---------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 4918a2f1013964..7ace836878cd6c 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -100,21 +100,18 @@ CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & clust if (HasFeature(Feature::kPowerAdjustment)) { - for (auto && id : { + for (auto && cmd : { PowerAdjustRequest::Id, CancelPowerAdjustRequest::Id, }) { - if (callback(id, context) == Loop::Break) - { - return CHIP_NO_ERROR; - } + VerifyOrExit(callback(cmd, context) == Loop::Continue, /**/); } } if (HasFeature(Feature::kForecastAdjustment)) { - for (auto && id : { + for (auto && cmd : { StartTimeAdjustRequest::Id, PauseRequest::Id, ResumeRequest::Id, @@ -122,13 +119,11 @@ CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & clust RequestConstraintBasedForecast::Id, }) { - if (callback(id, context) == Loop::Break) - { - return CHIP_NO_ERROR; - } + VerifyOrExit(callback(cmd, context) == Loop::Continue, /**/); } } +exit: return CHIP_NO_ERROR; } @@ -234,7 +229,7 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po if (powerAdjustmentCapability.IsNull()) { - ChipLogProgress(Zcl, "DEM: %s powerAdjustmentCapability IsNull", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s powerAdjustmentCapability IsNull", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -253,7 +248,7 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po if (!validArgs) { - ChipLogProgress(Zcl, "DEM: %s invalid request range", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s invalid request range", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -265,7 +260,7 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "DEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); } return; } @@ -280,7 +275,7 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, esaStatus = mDelegate.GetESAState(); if (ESAStateEnum::kPowerAdjustActive != esaStatus) { - ChipLogProgress(Zcl, "DEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -290,7 +285,7 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "DEM: %s Failed to CancelPowerAdjustRequest()", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s Failed to CancelPowerAdjustRequest()", __FUNCTION__); return; } @@ -310,14 +305,14 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (forecast.IsNull()) { - ChipLogProgress(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -331,7 +326,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (forecast.Value().earliestStartTime.HasValue() || forecast.Value().latestEndTime.HasValue()) { /* These Should not be NULL since this command requires FA feature and these are mandatory for that */ - ChipLogProgress(Zcl, "DEM: %s - EarliestStartTime / LatestEndTime not valid", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - EarliestStartTime / LatestEndTime not valid", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -362,7 +357,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if ((requestedStartTime < earliestStartTime) || ((requestedStartTime + duration) > latestEndTime)) { - ChipLogProgress(Zcl, "DEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -374,7 +369,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogProgress(Zcl, "DEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); + ChipLogError(Zcl, "DEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); return; } } @@ -392,14 +387,14 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if (forecast.IsNull()) { - ChipLogProgress(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -410,7 +405,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq uint16_t activeSlotNumber; if (forecast.Value().activeSlotNumber.IsNull()) { - ChipLogProgress(Zcl, "DEM: %s - activeSlotNumber Is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - activeSlotNumber Is Null", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -418,15 +413,15 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq activeSlotNumber = forecast.Value().activeSlotNumber.Value(); if (activeSlotNumber >= forecast.Value().slots.size()) { - ChipLogProgress(Zcl, "DEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, activeSlotNumber, - static_cast(forecast.Value().slots.size())); + ChipLogError(Zcl, "DEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, activeSlotNumber, + static_cast(forecast.Value().slots.size())); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable) { - ChipLogProgress(Zcl, "DEM: %s - activeSlotNumber %d is NOT pausible.", __FUNCTION__, activeSlotNumber); + ChipLogError(Zcl, "DEM: %s - activeSlotNumber %d is NOT pausible.", __FUNCTION__, activeSlotNumber); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -434,7 +429,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if ((duration < forecast.Value().slots[activeSlotNumber].minPauseDuration) && (duration > forecast.Value().slots[activeSlotNumber].maxPauseDuration)) { - ChipLogProgress(Zcl, "DEM: %s - out of range pause duration %d", __FUNCTION__, duration); + ChipLogError(Zcl, "DEM: %s - out of range pause duration %d", __FUNCTION__, duration); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -442,7 +437,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq err = mDelegate.SetESAState(ESAStateEnum::kPaused); if (CHIP_NO_ERROR != err) { - ChipLogProgress(Zcl, "DEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -452,7 +447,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogProgress(Zcl, "DEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); + ChipLogError(Zcl, "DEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); return; } @@ -467,7 +462,7 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR if (ESAStateEnum::kPaused != mDelegate.GetESAState()) { - ChipLogProgress(Zcl, "DEM: %s - ESAState not Paused.", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - ESAState not Paused.", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -477,7 +472,7 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogProgress(Zcl, "DEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); return; } @@ -493,7 +488,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: if (forecast.IsNull()) { - ChipLogProgress(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -509,7 +504,7 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, Status status = Status::UnsupportedCommand; // TODO Status::Success; // TODO pass this up to the delegate if it supports it - ChipLogProgress(Zcl, "DEM: %s - Handle Constraint based forecast ", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - Handle Constraint based forecast ", __FUNCTION__); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); return; } From b44b86602b5c735ad4ae5cee4a461919b74ddabf Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 15 Dec 2023 08:24:35 +0000 Subject: [PATCH 012/143] Aligned EVSE XML to same state as PR#30857 (includes SessionID being Nullable etc and in Fault Event). --- .../data-model/chip/energy-evse-cluster.xml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 83f44e37f1eaf4..49457150b71754 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -69,7 +69,7 @@ limitations under the License. - + @@ -130,11 +130,11 @@ limitations under the License. BatteryCapacity VehicleID - SessionID - SessionDuration - SessionEnergyCharged + SessionID + SessionDuration + SessionEnergyCharged - SessionEnergyDischarged + SessionEnergyDischarged Allows a client to disable the EVSE from charging and discharging. @@ -171,11 +171,11 @@ limitations under the License. EVConnected - + EVNotDetected - + @@ -183,20 +183,20 @@ limitations under the License. EnergyTransferStarted - + EnergyTransferStopped - + Fault - + From 42b79f07f6ae35c83f0f6873bc01b2f35d189337 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 15 Dec 2023 08:28:44 +0000 Subject: [PATCH 013/143] Updated Device Energy Management XML to use power_mw, energy_mwh per spec definition. --- .../chip/device-energy-management-cluster.xml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml index 10e3af41e4a290..a07ac6d0d505e1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/device-energy-management-cluster.xml @@ -38,14 +38,14 @@ limitations under the License. ESAType ESACanGenerate ESAState - AbsMinPower - AbsMaxPower + AbsMinPower + AbsMaxPower PowerAdjustmentCapability Forecast - + Allows a client to request an adjustment in the power consumption of an ESA for a specified duration. @@ -79,7 +79,7 @@ limitations under the License. PowerAdjustEnd - + Paused @@ -138,8 +138,8 @@ limitations under the License. - - + + @@ -165,28 +165,28 @@ limitations under the License. - - - - + + + + - - + + - + - - + + \ No newline at end of file From 56e62ec019697bd0f1f8291828957fcd06b14110 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 15 Dec 2023 08:29:58 +0000 Subject: [PATCH 014/143] Updated controller-clusters.zap --- src/controller/data_model/controller-clusters.zap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index fb41ede1f42920..b530fd8f277f05 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -428,6 +428,7 @@ "define": "ON_OFF_SWITCH_CONFIGURATION_CLUSTER", "side": "client", "enabled": 1, + "apiMaturity": "deprecated", "attributes": [ { "name": "ClusterRevision", @@ -562,6 +563,7 @@ "define": "BINARY_INPUT_BASIC_CLUSTER", "side": "client", "enabled": 1, + "apiMaturity": "deprecated", "attributes": [ { "name": "ClusterRevision", @@ -3484,6 +3486,7 @@ "define": "BARRIER_CONTROL_CLUSTER", "side": "client", "enabled": 1, + "apiMaturity": "deprecated", "commands": [ { "name": "BarrierControlGoToPercent", @@ -5108,6 +5111,7 @@ "define": "ELECTRICAL_MEASUREMENT_CLUSTER", "side": "client", "enabled": 1, + "apiMaturity": "deprecated", "attributes": [ { "name": "ClusterRevision", From 1b9316d48cd28b9a79d737bad3b754454c9c5260 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 15 Dec 2023 09:06:25 +0000 Subject: [PATCH 015/143] regen_all.py --- .../data_model/controller-clusters.matter | 40 ++-- .../chip/devicecontroller/ChipClusters.java | 36 ++-- .../devicecontroller/ChipEventStructs.java | 8 +- .../chip/devicecontroller/ChipStructs.java | 22 +- .../devicecontroller/ClusterInfoMapping.java | 63 ++++++ .../devicecontroller/ClusterReadMapping.java | 12 +- .../EnergyEvseClusterFaultEvent.kt | 16 +- .../EnergyEvseClusterChargingTargetStruct.kt | 17 +- .../cluster/clusters/EnergyEvseCluster.kt | 43 +++- .../EnergyEvseClusterFaultEvent.kt | 16 +- .../EnergyEvseClusterChargingTargetStruct.kt | 17 +- .../CHIPAttributeTLVValueDecoder.cpp | 51 +++-- .../CHIPEventTLVValueDecoder.cpp | 17 +- .../zap-generated/CHIPInvokeCallbacks.cpp | 19 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 202 ++++++++++++++++++ .../python/chip/clusters/Objects.py | 32 +-- .../MTRAttributeTLVValueDecoder.mm | 24 ++- .../zap-generated/MTRCommandPayloadsObjc.mm | 4 +- .../zap-generated/MTREventTLVValueDecoder.mm | 8 +- .../CHIP/zap-generated/MTRStructsObjc.h | 4 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 8 +- .../zap-generated/attributes/Accessors.cpp | 100 +++++++-- .../zap-generated/attributes/Accessors.h | 16 +- .../zap-generated/cluster-objects.cpp | 6 +- .../zap-generated/cluster-objects.h | 36 ++-- .../zap-generated/cluster/Commands.h | 22 +- .../cluster/ComplexArgumentParser.cpp | 14 +- .../cluster/logging/DataModelLogger.cpp | 10 +- .../zap-generated/cluster/Commands.h | 4 +- 29 files changed, 659 insertions(+), 208 deletions(-) diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 3de205777da77f..ef27bd2371d0c8 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4451,13 +4451,13 @@ provisional cluster DeviceEnergyManagement = 152 { elapsed_s minPauseDuration = 6; elapsed_s maxPauseDuration = 7; optional int16u manufacturerESAState = 8; - optional int64s nominalPower = 9; - optional int64s minPower = 10; - optional int64s maxPower = 11; - optional int64s nominalEnergy = 12; + optional power_mw nominalPower = 9; + optional power_mw minPower = 10; + optional power_mw maxPower = 11; + optional energy_mwh nominalEnergy = 12; optional CostStruct costs[] = 13; - optional int64s minPowerAdjustment = 14; - optional int64s maxPowerAdjustment = 15; + optional power_mw minPowerAdjustment = 14; + optional power_mw maxPowerAdjustment = 15; optional elapsed_s minDurationAdjustment = 16; optional elapsed_s maxDurationAdjustment = 17; } @@ -4476,21 +4476,21 @@ provisional cluster DeviceEnergyManagement = 152 { struct ConstraintsStruct { epoch_s startTime = 0; elapsed_s duration = 1; - optional int64s nominalPower = 2; - optional int64s maximumEnergy = 3; + optional power_mw nominalPower = 2; + optional energy_mwh maximumEnergy = 3; optional int8s loadControl = 4; } struct PowerAdjustStruct { - int64s minPower = 0; - int64s maxPower = 1; + power_mw minPower = 0; + power_mw maxPower = 1; elapsed_s minDuration = 2; elapsed_s maxDuration = 3; } struct SlotAdjustmentStruct { int8u slotIndex = 0; - int64s nominalPower = 1; + power_mw nominalPower = 1; elapsed_s duration = 2; } @@ -4500,7 +4500,7 @@ provisional cluster DeviceEnergyManagement = 152 { info event PowerAdjustEnd = 1 { CauseEnum cause = 0; elapsed_s duration = 1; - int64s energyUse = 2; + energy_mwh energyUse = 2; } info event Paused = 2 { @@ -4512,8 +4512,8 @@ provisional cluster DeviceEnergyManagement = 152 { readonly attribute ESATypeEnum ESAType = 0; readonly attribute boolean ESACanGenerate = 1; readonly attribute ESAStateEnum ESAState = 2; - readonly attribute int64s absMinPower = 3; - readonly attribute int64s absMaxPower = 4; + readonly attribute power_mw absMinPower = 3; + readonly attribute power_mw absMaxPower = 4; readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5; readonly attribute optional nullable ForecastStruct forecast = 6; readonly attribute command_id generatedCommandList[] = 65528; @@ -4524,7 +4524,7 @@ provisional cluster DeviceEnergyManagement = 152 { readonly attribute int16u clusterRevision = 65533; request struct PowerAdjustRequestRequest { - int64s power = 0; + power_mw power = 0; elapsed_s duration = 1; } @@ -4628,7 +4628,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetStruct { - int16u targetTime = 0; + int16u targetTimeMinutesPastMidnight = 0; optional percent targetSoC = 1; optional energy_mwh addedEnergy = 2; } @@ -4659,7 +4659,7 @@ provisional cluster EnergyEvse = 153 { } critical event Fault = 4 { - int32u sessionID = 0; + nullable int32u sessionID = 0; StateEnum state = 1; FaultStateEnum faultStatePreviousState = 2; FaultStateEnum faultStateCurrentState = 4; @@ -4691,9 +4691,9 @@ provisional cluster EnergyEvse = 153 { readonly attribute optional nullable energy_mwh batteryCapacity = 49; readonly attribute optional nullable char_string<32> vehicleID = 50; readonly attribute nullable int32u sessionID = 64; - readonly attribute elapsed_s sessionDuration = 65; - readonly attribute energy_mwh sessionEnergyCharged = 66; - readonly attribute optional energy_mwh sessionEnergyDischarged = 67; + readonly attribute nullable elapsed_s sessionDuration = 65; + readonly attribute nullable energy_mwh sessionEnergyCharged = 66; + readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 224dab357f761a..d4a978192119d9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -29927,6 +29927,18 @@ public interface SessionIDAttributeCallback extends BaseAttributeCallback { void onSuccess(@Nullable Long value); } + public interface SessionDurationAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface SessionEnergyChargedAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface SessionEnergyDischargedAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -30521,76 +30533,76 @@ public void onSuccess(byte[] tlv) { } public void readSessionDurationAttribute( - LongAttributeCallback callback) { + SessionDurationAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_DURATION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SESSION_DURATION_ATTRIBUTE_ID, true); } public void subscribeSessionDurationAttribute( - LongAttributeCallback callback, int minInterval, int maxInterval) { + SessionDurationAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_DURATION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); } }, SESSION_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readSessionEnergyChargedAttribute( - LongAttributeCallback callback) { + SessionEnergyChargedAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID, true); } public void subscribeSessionEnergyChargedAttribute( - LongAttributeCallback callback, int minInterval, int maxInterval) { + SessionEnergyChargedAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); } }, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID, minInterval, maxInterval); } public void readSessionEnergyDischargedAttribute( - LongAttributeCallback callback) { + SessionEnergyDischargedAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID, true); } public void subscribeSessionEnergyDischargedAttribute( - LongAttributeCallback callback, int minInterval, int maxInterval) { + SessionEnergyDischargedAttributeCallback callback, int minInterval, int maxInterval) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); } }, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID, minInterval, maxInterval); } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index 81b0180a39df4f..79d160371f9712 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -3759,7 +3759,7 @@ public String toString() { } } public static class EnergyEvseClusterFaultEvent { - public Long sessionID; + public @Nullable Long sessionID; public Integer state; public Integer faultStatePreviousState; public Integer faultStateCurrentState; @@ -3769,7 +3769,7 @@ public static class EnergyEvseClusterFaultEvent { private static final long FAULT_STATE_CURRENT_STATE_ID = 4L; public EnergyEvseClusterFaultEvent( - Long sessionID, + @Nullable Long sessionID, Integer state, Integer faultStatePreviousState, Integer faultStateCurrentState @@ -3782,7 +3782,7 @@ public EnergyEvseClusterFaultEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(SESSION_I_D_ID, new UIntType(sessionID))); + values.add(new StructElement(SESSION_I_D_ID, sessionID != null ? new UIntType(sessionID) : new NullType())); values.add(new StructElement(STATE_ID, new UIntType(state))); values.add(new StructElement(FAULT_STATE_PREVIOUS_STATE_ID, new UIntType(faultStatePreviousState))); values.add(new StructElement(FAULT_STATE_CURRENT_STATE_ID, new UIntType(faultStateCurrentState))); @@ -3794,7 +3794,7 @@ public static EnergyEvseClusterFaultEvent decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Long sessionID = null; + @Nullable Long sessionID = null; Integer state = null; Integer faultStatePreviousState = null; Integer faultStateCurrentState = null; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 0237b3fc989cd2..e7e40657b7915f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7276,26 +7276,26 @@ public String toString() { } } public static class EnergyEvseClusterChargingTargetStruct { - public Integer targetTime; + public Integer targetTimeMinutesPastMidnight; public Optional targetSoC; public Optional addedEnergy; - private static final long TARGET_TIME_ID = 0L; + private static final long TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID = 0L; private static final long TARGET_SO_C_ID = 1L; private static final long ADDED_ENERGY_ID = 2L; public EnergyEvseClusterChargingTargetStruct( - Integer targetTime, + Integer targetTimeMinutesPastMidnight, Optional targetSoC, Optional addedEnergy ) { - this.targetTime = targetTime; + this.targetTimeMinutesPastMidnight = targetTimeMinutesPastMidnight; this.targetSoC = targetSoC; this.addedEnergy = addedEnergy; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(TARGET_TIME_ID, new UIntType(targetTime))); + values.add(new StructElement(TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID, new UIntType(targetTimeMinutesPastMidnight))); values.add(new StructElement(TARGET_SO_C_ID, targetSoC.map((nonOptionaltargetSoC) -> new UIntType(nonOptionaltargetSoC)).orElse(new EmptyType()))); values.add(new StructElement(ADDED_ENERGY_ID, addedEnergy.map((nonOptionaladdedEnergy) -> new IntType(nonOptionaladdedEnergy)).orElse(new EmptyType()))); @@ -7306,14 +7306,14 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Integer targetTime = null; + Integer targetTimeMinutesPastMidnight = null; Optional targetSoC = Optional.empty(); Optional addedEnergy = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == TARGET_TIME_ID) { + if (element.contextTagNum() == TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - targetTime = castingValue.value(Integer.class); + targetTimeMinutesPastMidnight = castingValue.value(Integer.class); } } else if (element.contextTagNum() == TARGET_SO_C_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -7328,7 +7328,7 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal } } return new EnergyEvseClusterChargingTargetStruct( - targetTime, + targetTimeMinutesPastMidnight, targetSoC, addedEnergy ); @@ -7338,8 +7338,8 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal public String toString() { StringBuilder output = new StringBuilder(); output.append("EnergyEvseClusterChargingTargetStruct {\n"); - output.append("\ttargetTime: "); - output.append(targetTime); + output.append("\ttargetTimeMinutesPastMidnight: "); + output.append(targetTimeMinutesPastMidnight); output.append("\n"); output.append("\ttargetSoC: "); output.append(targetSoC); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index b92600bc9890a4..91b7d28b9fe564 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -10747,6 +10747,69 @@ public void onError(Exception ex) { } } + public static class DelegatedEnergyEvseClusterSessionDurationAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionDurationAttributeCallback, 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 DelegatedEnergyEvseClusterSessionEnergyChargedAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionEnergyChargedAttributeCallback, 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 DelegatedEnergyEvseClusterSessionEnergyDischargedAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionEnergyDischargedAttributeCallback, 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 DelegatedEnergyEvseClusterGeneratedCommandListAttributeCallback implements ChipClusters.EnergyEvseCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index fecf9c31d761ee..ec96ce4c2bc8a7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -9542,10 +9542,10 @@ private static Map readEnergyEvseInteractionInfo() { InteractionInfo readEnergyEvseSessionDurationAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.EnergyEvseCluster) cluster).readSessionDurationAttribute( - (ChipClusters.LongAttributeCallback) callback + (ChipClusters.EnergyEvseCluster.SessionDurationAttributeCallback) callback ); }, - () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + () -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionDurationAttributeCallback(), readEnergyEvseSessionDurationCommandParams ); result.put("readSessionDurationAttribute", readEnergyEvseSessionDurationAttributeInteractionInfo); @@ -9553,10 +9553,10 @@ private static Map readEnergyEvseInteractionInfo() { InteractionInfo readEnergyEvseSessionEnergyChargedAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.EnergyEvseCluster) cluster).readSessionEnergyChargedAttribute( - (ChipClusters.LongAttributeCallback) callback + (ChipClusters.EnergyEvseCluster.SessionEnergyChargedAttributeCallback) callback ); }, - () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + () -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionEnergyChargedAttributeCallback(), readEnergyEvseSessionEnergyChargedCommandParams ); result.put("readSessionEnergyChargedAttribute", readEnergyEvseSessionEnergyChargedAttributeInteractionInfo); @@ -9564,10 +9564,10 @@ private static Map readEnergyEvseInteractionInfo() { InteractionInfo readEnergyEvseSessionEnergyDischargedAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.EnergyEvseCluster) cluster).readSessionEnergyDischargedAttribute( - (ChipClusters.LongAttributeCallback) callback + (ChipClusters.EnergyEvseCluster.SessionEnergyDischargedAttributeCallback) callback ); }, - () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + () -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionEnergyDischargedAttributeCallback(), readEnergyEvseSessionEnergyDischargedCommandParams ); result.put("readSessionEnergyDischargedAttribute", readEnergyEvseSessionEnergyDischargedAttributeInteractionInfo); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt index 2b82c363aa442c..53ca88273b038d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt @@ -23,7 +23,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterFaultEvent( - val sessionID: ULong, + val sessionID: ULong?, val state: UInt, val faultStatePreviousState: UInt, val faultStateCurrentState: UInt @@ -40,7 +40,11 @@ class EnergyEvseClusterFaultEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + if (sessionID != null) { + put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + } else { + putNull(ContextSpecificTag(TAG_SESSION_I_D)) + } put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE), faultStatePreviousState) put(ContextSpecificTag(TAG_FAULT_STATE_CURRENT_STATE), faultStateCurrentState) @@ -56,7 +60,13 @@ class EnergyEvseClusterFaultEvent( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterFaultEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_SESSION_I_D)) + null + } val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) val faultStatePreviousState = tlvReader.getUInt(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt index f457f066ff27bc..9e859dbdf40e53 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt @@ -24,13 +24,13 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetStruct( - val targetTime: UInt, + val targetTimeMinutesPastMidnight: UInt, val targetSoC: Optional, val addedEnergy: Optional ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetStruct {\n") - append("\ttargetTime : $targetTime\n") + append("\ttargetTimeMinutesPastMidnight : $targetTimeMinutesPastMidnight\n") append("\ttargetSoC : $targetSoC\n") append("\taddedEnergy : $addedEnergy\n") append("}\n") @@ -39,7 +39,7 @@ class EnergyEvseClusterChargingTargetStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_TARGET_TIME), targetTime) + put(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT), targetTimeMinutesPastMidnight) if (targetSoC.isPresent) { val opttargetSoC = targetSoC.get() put(ContextSpecificTag(TAG_TARGET_SO_C), opttargetSoC) @@ -53,13 +53,14 @@ class EnergyEvseClusterChargingTargetStruct( } companion object { - private const val TAG_TARGET_TIME = 0 + private const val TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT = 0 private const val TAG_TARGET_SO_C = 1 private const val TAG_ADDED_ENERGY = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetStruct { tlvReader.enterStructure(tlvTag) - val targetTime = tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_TIME)) + val targetTimeMinutesPastMidnight = + tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT)) val targetSoC = if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_SO_C))) { Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_SO_C))) @@ -75,7 +76,11 @@ class EnergyEvseClusterChargingTargetStruct( tlvReader.exitContainer() - return EnergyEvseClusterChargingTargetStruct(targetTime, targetSoC, addedEnergy) + return EnergyEvseClusterChargingTargetStruct( + targetTimeMinutesPastMidnight, + targetSoC, + addedEnergy + ) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt index 93e1c213748fe1..615839a2191b26 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt @@ -66,6 +66,12 @@ class EnergyEvseCluster(private val controller: MatterController, private val en class SessionIDAttribute(val value: UInt?) + class SessionDurationAttribute(val value: UInt?) + + class SessionEnergyChargedAttribute(val value: Long?) + + class SessionEnergyDischargedAttribute(val value: Long?) + class GeneratedCommandListAttribute(val value: List) class AcceptedCommandListAttribute(val value: List) @@ -1230,7 +1236,7 @@ class EnergyEvseCluster(private val controller: MatterController, private val en return SessionIDAttribute(decodedValue) } - suspend fun readSessionDurationAttribute(): UInt { + suspend fun readSessionDurationAttribute(): SessionDurationAttribute { val ATTRIBUTE_ID: UInt = 65u val attributePath = @@ -1256,12 +1262,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } - return decodedValue + return SessionDurationAttribute(decodedValue) } - suspend fun readSessionEnergyChargedAttribute(): Long { + suspend fun readSessionEnergyChargedAttribute(): SessionEnergyChargedAttribute { val ATTRIBUTE_ID: UInt = 66u val attributePath = @@ -1287,12 +1299,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Long = tlvReader.getLong(AnonymousTag) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + tlvReader.getLong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } - return decodedValue + return SessionEnergyChargedAttribute(decodedValue) } - suspend fun readSessionEnergyDischargedAttribute(): Long? { + suspend fun readSessionEnergyDischargedAttribute(): SessionEnergyDischargedAttribute { val ATTRIBUTE_ID: UInt = 67u val attributePath = @@ -1319,13 +1337,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) val decodedValue: Long? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getLong(AnonymousTag) + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } } else { + tlvReader.getNull(AnonymousTag) null } - return decodedValue + return SessionEnergyDischargedAttribute(decodedValue) } suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt index 03e5ca83816f70..2167c1fca408eb 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt @@ -23,7 +23,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterFaultEvent( - val sessionID: UInt, + val sessionID: UInt?, val state: UByte, val faultStatePreviousState: UByte, val faultStateCurrentState: UByte @@ -40,7 +40,11 @@ class EnergyEvseClusterFaultEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + if (sessionID != null) { + put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + } else { + putNull(ContextSpecificTag(TAG_SESSION_I_D)) + } put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE), faultStatePreviousState) put(ContextSpecificTag(TAG_FAULT_STATE_CURRENT_STATE), faultStateCurrentState) @@ -56,7 +60,13 @@ class EnergyEvseClusterFaultEvent( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterFaultEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_SESSION_I_D)) + null + } val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) val faultStatePreviousState = tlvReader.getUByte(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt index 65c1b49f4af9f1..db61226e1adf55 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt @@ -24,13 +24,13 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetStruct( - val targetTime: UShort, + val targetTimeMinutesPastMidnight: UShort, val targetSoC: Optional, val addedEnergy: Optional ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetStruct {\n") - append("\ttargetTime : $targetTime\n") + append("\ttargetTimeMinutesPastMidnight : $targetTimeMinutesPastMidnight\n") append("\ttargetSoC : $targetSoC\n") append("\taddedEnergy : $addedEnergy\n") append("}\n") @@ -39,7 +39,7 @@ class EnergyEvseClusterChargingTargetStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_TARGET_TIME), targetTime) + put(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT), targetTimeMinutesPastMidnight) if (targetSoC.isPresent) { val opttargetSoC = targetSoC.get() put(ContextSpecificTag(TAG_TARGET_SO_C), opttargetSoC) @@ -53,13 +53,14 @@ class EnergyEvseClusterChargingTargetStruct( } companion object { - private const val TAG_TARGET_TIME = 0 + private const val TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT = 0 private const val TAG_TARGET_SO_C = 1 private const val TAG_ADDED_ENERGY = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetStruct { tlvReader.enterStructure(tlvTag) - val targetTime = tlvReader.getUShort(ContextSpecificTag(TAG_TARGET_TIME)) + val targetTimeMinutesPastMidnight = + tlvReader.getUShort(ContextSpecificTag(TAG_TARGET_TIME_MINUTES_PAST_MIDNIGHT)) val targetSoC = if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_SO_C))) { Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_TARGET_SO_C))) @@ -75,7 +76,11 @@ class EnergyEvseClusterChargingTargetStruct( tlvReader.exitContainer() - return EnergyEvseClusterChargingTargetStruct(targetTime, targetSoC, addedEnergy) + return EnergyEvseClusterChargingTargetStruct( + targetTimeMinutesPastMidnight, + targetSoC, + addedEnergy + ) } } } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index e87c3ea5961c68..b1764fa2e9a1be 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -22723,11 +22723,18 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR 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); + 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::SessionEnergyCharged::Id: { @@ -22739,11 +22746,18 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR 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); + 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::SessionEnergyDischarged::Id: { @@ -22755,11 +22769,18 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR 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); + 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: { diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 4dd1ffd1e2e2c1..6e3b2093ead51c 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -5248,11 +5248,18 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & return nullptr; } jobject value_sessionID; - std::string value_sessionIDClassName = "java/lang/Long"; - std::string value_sessionIDCtorSignature = "(J)V"; - jlong jnivalue_sessionID = static_cast(cppValue.sessionID); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_sessionIDClassName.c_str(), value_sessionIDCtorSignature.c_str(), jnivalue_sessionID, value_sessionID); + if (cppValue.sessionID.IsNull()) + { + value_sessionID = nullptr; + } + else + { + std::string value_sessionIDClassName = "java/lang/Long"; + std::string value_sessionIDCtorSignature = "(J)V"; + jlong jnivalue_sessionID = static_cast(cppValue.sessionID.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_sessionIDClassName.c_str(), value_sessionIDCtorSignature.c_str(), jnivalue_sessionID, value_sessionID); + } jobject value_state; std::string value_stateClassName = "java/lang/Integer"; diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 3b65b69a3a456a..2b5fa3ff8429ea 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3959,13 +3959,14 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( { auto & entry_0 = iter_ChargingTargets_0.GetValue(); jobject newElement_0; - jobject newElement_0_targetTime; - std::string newElement_0_targetTimeClassName = "java/lang/Integer"; - std::string newElement_0_targetTimeCtorSignature = "(I)V"; - jint jninewElement_0_targetTime = static_cast(entry_0.targetTime); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_targetTimeClassName.c_str(), - newElement_0_targetTimeCtorSignature.c_str(), - jninewElement_0_targetTime, newElement_0_targetTime); + jobject newElement_0_targetTimeMinutesPastMidnight; + std::string newElement_0_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; + std::string newElement_0_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; + jint jninewElement_0_targetTimeMinutesPastMidnight = static_cast(entry_0.targetTimeMinutesPastMidnight); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_targetTimeMinutesPastMidnightClassName.c_str(), + newElement_0_targetTimeMinutesPastMidnightCtorSignature.c_str(), + jninewElement_0_targetTimeMinutesPastMidnight, + newElement_0_targetTimeMinutesPastMidnight); jobject newElement_0_targetSoC; if (!entry_0.targetSoC.HasValue()) { @@ -4016,8 +4017,8 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( return; } - newElement_0 = env->NewObject(chargingTargetStructStructClass_1, chargingTargetStructStructCtor_1, newElement_0_targetTime, - newElement_0_targetSoC, newElement_0_addedEnergy); + newElement_0 = env->NewObject(chargingTargetStructStructClass_1, chargingTargetStructStructCtor_1, + newElement_0_targetTimeMinutesPastMidnight, newElement_0_targetSoC, newElement_0_addedEnergy); chip::JniReferences::GetInstance().AddToList(ChargingTargets, newElement_0); } diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 630984be29b0a7..e7d797ce9f0e92 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -33874,6 +33874,208 @@ void CHIPEnergyEvseSessionIDAttributeCallback::CallbackFn(void * context, const env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPEnergyEvseSessionDurationAttributeCallback::CHIPEnergyEvseSessionDurationAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPEnergyEvseSessionDurationAttributeCallback::~CHIPEnergyEvseSessionDurationAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPEnergyEvseSessionDurationAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Long;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + jlong jnijavaValue = static_cast(value.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + jnijavaValue, javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + +CHIPEnergyEvseSessionEnergyChargedAttributeCallback::CHIPEnergyEvseSessionEnergyChargedAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPEnergyEvseSessionEnergyChargedAttributeCallback::~CHIPEnergyEvseSessionEnergyChargedAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPEnergyEvseSessionEnergyChargedAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Long;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + jlong jnijavaValue = static_cast(value.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + jnijavaValue, javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + +CHIPEnergyEvseSessionEnergyDischargedAttributeCallback::CHIPEnergyEvseSessionEnergyDischargedAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPEnergyEvseSessionEnergyDischargedAttributeCallback::~CHIPEnergyEvseSessionEnergyDischargedAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPEnergyEvseSessionEnergyDischargedAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Long;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Long"; + std::string javaValueCtorSignature = "(J)V"; + jlong jnijavaValue = static_cast(value.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + jnijavaValue, javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPEnergyEvseGeneratedCommandListAttributeCallback::CHIPEnergyEvseGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 735228c9725f71..5fd82a3382a339 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -23780,9 +23780,9 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="batteryCapacity", Tag=0x00000031, Type=typing.Union[None, Nullable, int]), ClusterObjectFieldDescriptor(Label="vehicleID", Tag=0x00000032, Type=typing.Union[None, Nullable, str]), ClusterObjectFieldDescriptor(Label="sessionID", Tag=0x00000040, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="sessionDuration", Tag=0x00000041, Type=uint), - ClusterObjectFieldDescriptor(Label="sessionEnergyCharged", Tag=0x00000042, Type=int), - ClusterObjectFieldDescriptor(Label="sessionEnergyDischarged", Tag=0x00000043, Type=typing.Optional[int]), + ClusterObjectFieldDescriptor(Label="sessionDuration", Tag=0x00000041, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="sessionEnergyCharged", Tag=0x00000042, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="sessionEnergyDischarged", Tag=0x00000043, 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]), @@ -23813,9 +23813,9 @@ def descriptor(cls) -> ClusterObjectDescriptor: batteryCapacity: 'typing.Union[None, Nullable, int]' = None vehicleID: 'typing.Union[None, Nullable, str]' = None sessionID: 'typing.Union[Nullable, uint]' = None - sessionDuration: 'uint' = None - sessionEnergyCharged: 'int' = None - sessionEnergyDischarged: 'typing.Optional[int]' = None + sessionDuration: 'typing.Union[Nullable, uint]' = None + sessionEnergyCharged: 'typing.Union[Nullable, int]' = None + sessionEnergyDischarged: 'typing.Union[None, Nullable, int]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -23908,12 +23908,12 @@ class ChargingTargetStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="targetTime", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="targetTimeMinutesPastMidnight", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="targetSoC", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="addedEnergy", Tag=2, Type=typing.Optional[int]), ]) - targetTime: 'uint' = 0 + targetTimeMinutesPastMidnight: 'uint' = 0 targetSoC: 'typing.Optional[uint]' = None addedEnergy: 'typing.Optional[int]' = None @@ -24440,9 +24440,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) - value: 'uint' = 0 + value: 'typing.Union[Nullable, uint]' = NullValue @dataclass class SessionEnergyCharged(ClusterAttributeDescriptor): @@ -24456,9 +24456,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=int) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, int]) - value: 'int' = 0 + value: 'typing.Union[Nullable, int]' = NullValue @dataclass class SessionEnergyDischarged(ClusterAttributeDescriptor): @@ -24472,9 +24472,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[int]) + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) - value: 'typing.Optional[int]' = None + value: 'typing.Union[None, Nullable, int]' = None @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @@ -24681,13 +24681,13 @@ def event_id(cls) -> int: def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="sessionID", Tag=0, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="state", Tag=1, Type=EnergyEvse.Enums.StateEnum), ClusterObjectFieldDescriptor(Label="faultStatePreviousState", Tag=2, Type=EnergyEvse.Enums.FaultStateEnum), ClusterObjectFieldDescriptor(Label="faultStateCurrentState", Tag=4, Type=EnergyEvse.Enums.FaultStateEnum), ]) - sessionID: 'uint' = 0 + sessionID: 'typing.Union[Nullable, uint]' = NullValue state: 'EnergyEvse.Enums.StateEnum' = 0 faultStatePreviousState: 'EnergyEvse.Enums.FaultStateEnum' = 0 faultStateCurrentState: 'EnergyEvse.Enums.FaultStateEnum' = 0 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 2deb87873533aa..25d41e9c8bf966 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -8723,8 +8723,12 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } return value; } case Attributes::SessionEnergyCharged::Id: { @@ -8734,8 +8738,12 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithLongLong:cppValue]; + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } return value; } case Attributes::SessionEnergyDischarged::Id: { @@ -8745,8 +8753,12 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithLongLong:cppValue]; + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } return value; } default: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index f9cfc8e297a801..5d47571ec5ad3e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16910,7 +16910,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv auto & entry_0 = iter_0.GetValue(); MTREnergyEVSEClusterChargingTargetStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_0.targetTime = [NSNumber numberWithUnsignedShort:entry_0.targetTime]; + newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight]; if (entry_0.targetSoC.HasValue()) { newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()]; } else { @@ -17326,7 +17326,7 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTREnergyEVSEClusterChargingTargetStruct *) self.chargingTargets[i_0]; - listHolder_0->mList[i_0].targetTime = element_0.targetTime.unsignedShortValue; + listHolder_0->mList[i_0].targetTimeMinutesPastMidnight = element_0.targetTimeMinutesPastMidnight.unsignedShortValue; if (element_0.targetSoC != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].targetSoC.Emplace(); definedValue_2 = element_0.targetSoC.unsignedCharValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index c9a38080b463dc..fdffaae3ca3761 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2978,8 +2978,12 @@ static id _Nullable DecodeEventPayloadForEnergyEVSECluster(EventId aEventId, TLV __auto_type * value = [MTREnergyEVSEClusterFaultEvent new]; do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedInt:cppValue.sessionID]; + NSNumber * _Nullable memberValue; + if (cppValue.sessionID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedInt:cppValue.sessionID.Value()]; + } value.sessionID = memberValue; } while (0); do { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 6242c7e9460229..f76506226b4701 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1275,7 +1275,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterChargingTargetStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull targetTime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull targetTimeMinutesPastMidnight MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable targetSoC MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable addedEnergy MTR_PROVISIONALLY_AVAILABLE; @end @@ -1311,7 +1311,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterFaultEvent : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable sessionID MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull state MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull faultStatePreviousState MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nonnull faultStateCurrentState MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 06be97e69ee61b..4c08c7228fd870 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5203,7 +5203,7 @@ - (instancetype)init { if (self = [super init]) { - _targetTime = @(0); + _targetTimeMinutesPastMidnight = @(0); _targetSoC = nil; @@ -5216,7 +5216,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTREnergyEVSEClusterChargingTargetStruct alloc] init]; - other.targetTime = self.targetTime; + other.targetTimeMinutesPastMidnight = self.targetTimeMinutesPastMidnight; other.targetSoC = self.targetSoC; other.addedEnergy = self.addedEnergy; @@ -5225,7 +5225,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: targetTime:%@; targetSoC:%@; addedEnergy:%@; >", NSStringFromClass([self class]), _targetTime, _targetSoC, _addedEnergy]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: targetTimeMinutesPastMidnight:%@; targetSoC:%@; addedEnergy:%@; >", NSStringFromClass([self class]), _targetTimeMinutesPastMidnight, _targetSoC, _addedEnergy]; return descriptionString; } @@ -5371,7 +5371,7 @@ - (instancetype)init { if (self = [super init]) { - _sessionID = @(0); + _sessionID = nil; _state = @(0); 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 6a1c629033c162..83d5f86a3a7f12 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 @@ -10605,7 +10605,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_POWER_MW_ATTRIBUTE_TYPE); } } // namespace AbsMinPower @@ -10636,7 +10636,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_INT64S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_POWER_MW_ATTRIBUTE_TYPE); } } // namespace AbsMaxPower @@ -11654,24 +11654,27 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl namespace SessionDuration { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + if (Traits::IsNullValue(temp)) { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); } - *value = Traits::StorageToWorking(temp); return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) { using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } @@ -11681,28 +11684,50 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace SessionDuration namespace SessionEnergyCharged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + if (Traits::IsNullValue(temp)) { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); } - *value = Traits::StorageToWorking(temp); return status; } EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) { using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } @@ -11712,28 +11737,50 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace SessionEnergyCharged namespace SessionEnergyDischarged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + if (Traits::IsNullValue(temp)) { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); } - *value = Traits::StorageToWorking(temp); return status; } EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) { using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } @@ -11743,6 +11790,25 @@ EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace SessionEnergyDischarged namespace FeatureMap { 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 0b8661dd0f728d..290cbf692f2d04 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 @@ -2049,12 +2049,12 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyMa } // namespace ESAState namespace AbsMinPower { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // power_mw EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace AbsMinPower namespace AbsMaxPower { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // int64s +EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // power_mw EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); } // namespace AbsMaxPower @@ -2210,18 +2210,24 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace SessionID namespace SessionDuration { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // elapsed_s +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // elapsed_s EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace SessionDuration namespace SessionEnergyCharged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace SessionEnergyCharged namespace SessionEnergyDischarged { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // energy_mwh +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace SessionEnergyDischarged namespace FeatureMap { 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 4869634c35461f..99196eceb6effc 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 @@ -15763,7 +15763,7 @@ namespace ChargingTargetStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kTargetTime), targetTime); + encoder.Encode(to_underlying(Fields::kTargetTimeMinutesPastMidnight), targetTimeMinutesPastMidnight); encoder.Encode(to_underlying(Fields::kTargetSoC), targetSoC); encoder.Encode(to_underlying(Fields::kAddedEnergy), addedEnergy); return encoder.Finalize(); @@ -15783,9 +15783,9 @@ 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::kTargetTime)) + if (__context_tag == to_underlying(Fields::kTargetTimeMinutesPastMidnight)) { - err = DataModel::Decode(reader, targetTime); + err = DataModel::Decode(reader, targetTimeMinutesPastMidnight); } else if (__context_tag == to_underlying(Fields::kTargetSoC)) { 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 9438ed24a7cd5f..7c90c8a9d5a3e1 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 @@ -21865,15 +21865,15 @@ namespace Structs { namespace ChargingTargetStruct { enum class Fields : uint8_t { - kTargetTime = 0, - kTargetSoC = 1, - kAddedEnergy = 2, + kTargetTimeMinutesPastMidnight = 0, + kTargetSoC = 1, + kAddedEnergy = 2, }; struct Type { public: - uint16_t targetTime = static_cast(0); + uint16_t targetTimeMinutesPastMidnight = static_cast(0); Optional targetSoC; Optional addedEnergy; @@ -22466,9 +22466,9 @@ struct TypeInfo namespace SessionDuration { struct TypeInfo { - using Type = uint32_t; - using DecodableType = uint32_t; - using DecodableArgType = uint32_t; + 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::EnergyEvse::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SessionDuration::Id; } @@ -22478,9 +22478,9 @@ struct TypeInfo namespace SessionEnergyCharged { struct TypeInfo { - using Type = int64_t; - using DecodableType = int64_t; - using DecodableArgType = int64_t; + 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::EnergyEvse::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SessionEnergyCharged::Id; } @@ -22490,9 +22490,9 @@ struct TypeInfo namespace SessionEnergyDischarged { struct TypeInfo { - using Type = int64_t; - using DecodableType = int64_t; - using DecodableArgType = int64_t; + 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::EnergyEvse::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SessionEnergyDischarged::Id; } @@ -22568,9 +22568,9 @@ struct TypeInfo Attributes::BatteryCapacity::TypeInfo::DecodableType batteryCapacity; Attributes::VehicleID::TypeInfo::DecodableType vehicleID; Attributes::SessionID::TypeInfo::DecodableType sessionID; - Attributes::SessionDuration::TypeInfo::DecodableType sessionDuration = static_cast(0); - Attributes::SessionEnergyCharged::TypeInfo::DecodableType sessionEnergyCharged = static_cast(0); - Attributes::SessionEnergyDischarged::TypeInfo::DecodableType sessionEnergyDischarged = static_cast(0); + Attributes::SessionDuration::TypeInfo::DecodableType sessionDuration; + Attributes::SessionEnergyCharged::TypeInfo::DecodableType sessionEnergyCharged; + Attributes::SessionEnergyDischarged::TypeInfo::DecodableType sessionEnergyDischarged; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; @@ -22759,7 +22759,7 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } static constexpr bool kIsFabricScoped = false; - uint32_t sessionID = static_cast(0); + DataModel::Nullable sessionID; StateEnum state = static_cast(0); FaultStateEnum faultStatePreviousState = static_cast(0); FaultStateEnum faultStateCurrentState = static_cast(0); @@ -22774,7 +22774,7 @@ struct DecodableType static constexpr EventId GetEventId() { return Events::Fault::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - uint32_t sessionID = static_cast(0); + DataModel::Nullable sessionID; StateEnum state = static_cast(0); FaultStateEnum faultStatePreviousState = static_cast(0); FaultStateEnum faultStateCurrentState = static_cast(0); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 82097029565e8f..7948d81d41f181 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -6874,7 +6874,7 @@ class DeviceEnergyManagementPowerAdjustRequest : public ClusterCommand DeviceEnergyManagementPowerAdjustRequest(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("power-adjust-request", credsIssuerConfig) { - AddArgument("Power", INT64_MIN, INT64_MAX, &mRequest.power); + AddArgument("Power", 0, UINT64_MAX, &mRequest.power); AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); ClusterCommand::AddArguments(); } @@ -19583,9 +19583,9 @@ void registerClusterDeviceEnergyManagement(Commands & commands, CredentialIssuer WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>( Id, "esastate", 0, UINT8_MAX, Attributes::ESAState::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "abs-min-power", INT64_MIN, INT64_MAX, Attributes::AbsMinPower::Id, + make_unique>(Id, "abs-min-power", 0, UINT64_MAX, Attributes::AbsMinPower::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "abs-max-power", INT64_MIN, INT64_MAX, Attributes::AbsMaxPower::Id, + make_unique>(Id, "abs-max-power", 0, UINT64_MAX, Attributes::AbsMaxPower::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>>( @@ -19752,13 +19752,15 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c Id, "vehicle-id", Attributes::VehicleID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "session-id", 0, UINT32_MAX, Attributes::SessionID::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "session-duration", 0, UINT32_MAX, Attributes::SessionDuration::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "session-energy-charged", 0, UINT64_MAX, Attributes::SessionEnergyCharged::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "session-energy-discharged", 0, UINT64_MAX, - Attributes::SessionEnergyDischarged::Id, WriteCommandType::kForceWrite, - credsIssuerConfig), // + make_unique>>(Id, "session-duration", 0, UINT32_MAX, + Attributes::SessionDuration::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "session-energy-charged", 0, UINT64_MAX, + Attributes::SessionEnergyCharged::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "session-energy-discharged", 0, UINT64_MAX, + Attributes::SessionEnergyDischarged::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 7aeb538c962c95..155f91f1db84c9 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3215,13 +3215,15 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, // Copy to track which members we already processed. Json::Value valueCopy(value); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("ChargingTargetStruct.targetTime", "targetTime", value.isMember("targetTime"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChargingTargetStruct.targetTimeMinutesPastMidnight", + "targetTimeMinutesPastMidnight", + value.isMember("targetTimeMinutesPastMidnight"))); char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "targetTime"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.targetTime, value["targetTime"])); - valueCopy.removeMember("targetTime"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "targetTimeMinutesPastMidnight"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.targetTimeMinutesPastMidnight, + value["targetTimeMinutesPastMidnight"])); + valueCopy.removeMember("targetTimeMinutesPastMidnight"); if (value.isMember("targetSoC")) { @@ -3242,7 +3244,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetStruct::Type & request) { - ComplexArgumentParser::Finalize(request.targetTime); + ComplexArgumentParser::Finalize(request.targetTimeMinutesPastMidnight); ComplexArgumentParser::Finalize(request.targetSoC); ComplexArgumentParser::Finalize(request.addedEnergy); } 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 913a28be7583fc..6a56a914177981 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -2862,10 +2862,10 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("TargetTime", indent + 1, value.targetTime); + CHIP_ERROR err = LogValue("TargetTimeMinutesPastMidnight", indent + 1, value.targetTimeMinutesPastMidnight); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TargetTime'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'TargetTimeMinutesPastMidnight'"); return err; } } @@ -12031,17 +12031,17 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("SessionID", 1, value); } case EnergyEvse::Attributes::SessionDuration::Id: { - uint32_t value; + chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SessionDuration", 1, value); } case EnergyEvse::Attributes::SessionEnergyCharged::Id: { - int64_t value; + chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SessionEnergyCharged", 1, value); } case EnergyEvse::Attributes::SessionEnergyDischarged::Id: { - int64_t value; + chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SessionEnergyDischarged", 1, value); } 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 fb850d2ede4e99..5ff2d4bff4737c 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -78700,7 +78700,7 @@ class DeviceEnergyManagementPowerAdjustRequest : public ClusterCommand { : ClusterCommand("power-adjust-request") { #if MTR_ENABLE_PROVISIONAL - AddArgument("Power", INT64_MIN, INT64_MAX, &mRequest.power); + AddArgument("Power", 0, UINT64_MAX, &mRequest.power); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); @@ -80524,7 +80524,7 @@ class EnergyEvseSetTargets : public ClusterCommand { for (auto & entry_0 : mRequest.chargingTargets) { MTREnergyEVSEClusterChargingTargetStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_0.targetTime = [NSNumber numberWithUnsignedShort:entry_0.targetTime]; + newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight]; if (entry_0.targetSoC.HasValue()) { newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()]; } else { From 460ca152898c432a4ccecf1873e66400f493fa26 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 15 Dec 2023 09:06:56 +0000 Subject: [PATCH 016/143] Restyled by whitespace --- src/app/zap-templates/common/override.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/zap-templates/common/override.js b/src/app/zap-templates/common/override.js index 098af41e5154e2..6930a0479f0fb7 100644 --- a/src/app/zap-templates/common/override.js +++ b/src/app/zap-templates/common/override.js @@ -78,7 +78,7 @@ function atomicType(arg) case 'amperage_ma': case 'voltage_mv': case 'energy_mwh': - return 'int64_t'; + return 'int64_t'; case 'epoch_us': case 'systime_us': case 'posix_ms': From 3caf114e7ac58632d43eca8ea8219822677312eb Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 15 Dec 2023 13:48:15 +0000 Subject: [PATCH 017/143] Regen_all after merging in changes for XML --- .../all-clusters-app.matter | 230 ++++++++++++++- .../all-clusters-common/all-clusters-app.zap | 273 +++++++++++++++++- 2 files changed, 485 insertions(+), 18 deletions(-) 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 89e9aff9f175a3..59cbffcbaf7980 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 @@ -3786,13 +3786,13 @@ provisional cluster DeviceEnergyManagement = 152 { elapsed_s minPauseDuration = 6; elapsed_s maxPauseDuration = 7; optional int16u manufacturerESAState = 8; - optional int64s nominalPower = 9; - optional int64s minPower = 10; - optional int64s maxPower = 11; - optional int64s nominalEnergy = 12; + optional power_mw nominalPower = 9; + optional power_mw minPower = 10; + optional power_mw maxPower = 11; + optional energy_mwh nominalEnergy = 12; optional CostStruct costs[] = 13; - optional int64s minPowerAdjustment = 14; - optional int64s maxPowerAdjustment = 15; + optional power_mw minPowerAdjustment = 14; + optional power_mw maxPowerAdjustment = 15; optional elapsed_s minDurationAdjustment = 16; optional elapsed_s maxDurationAdjustment = 17; } @@ -3811,21 +3811,21 @@ provisional cluster DeviceEnergyManagement = 152 { struct ConstraintsStruct { epoch_s startTime = 0; elapsed_s duration = 1; - optional int64s nominalPower = 2; - optional int64s maximumEnergy = 3; + optional power_mw nominalPower = 2; + optional energy_mwh maximumEnergy = 3; optional int8s loadControl = 4; } struct PowerAdjustStruct { - int64s minPower = 0; - int64s maxPower = 1; + power_mw minPower = 0; + power_mw maxPower = 1; elapsed_s minDuration = 2; elapsed_s maxDuration = 3; } struct SlotAdjustmentStruct { int8u slotIndex = 0; - int64s nominalPower = 1; + power_mw nominalPower = 1; elapsed_s duration = 2; } @@ -3835,7 +3835,7 @@ provisional cluster DeviceEnergyManagement = 152 { info event PowerAdjustEnd = 1 { CauseEnum cause = 0; elapsed_s duration = 1; - int64s energyUse = 2; + energy_mwh energyUse = 2; } info event Paused = 2 { @@ -3847,8 +3847,8 @@ provisional cluster DeviceEnergyManagement = 152 { readonly attribute ESATypeEnum ESAType = 0; readonly attribute boolean ESACanGenerate = 1; readonly attribute ESAStateEnum ESAState = 2; - readonly attribute int64s absMinPower = 3; - readonly attribute int64s absMaxPower = 4; + readonly attribute power_mw absMinPower = 3; + readonly attribute power_mw absMaxPower = 4; readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5; readonly attribute optional nullable ForecastStruct forecast = 6; readonly attribute command_id generatedCommandList[] = 65528; @@ -3859,7 +3859,7 @@ provisional cluster DeviceEnergyManagement = 152 { readonly attribute int16u clusterRevision = 65533; request struct PowerAdjustRequestRequest { - int64s power = 0; + power_mw power = 0; elapsed_s duration = 1; } @@ -3896,6 +3896,187 @@ provisional cluster DeviceEnergyManagement = 152 { command RequestConstraintBasedForecast(RequestConstraintBasedForecastRequest): DefaultSuccess = 6; } +/** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */ +provisional cluster EnergyEvse = 153 { + revision 1; // NOTE: Default/not specifically set + + enum EnergyTransferStoppedReasonEnum : enum8 { + kEVStopped = 0; + kEVSEStopped = 1; + kOther = 2; + } + + enum FaultStateEnum : enum8 { + kNoError = 0; + kMeterFailure = 1; + kOverVoltage = 2; + kUnderVoltage = 3; + kOverCurrent = 4; + kContactWetFailure = 5; + kContactDryFailure = 6; + kGroundFault = 7; + kPowerLoss = 8; + kPowerQuality = 9; + kPilotShortCircuit = 10; + kEmergencyStop = 11; + kEVDisconnected = 12; + kWrongPowerSupply = 13; + kLiveNeutralSwap = 14; + kOverTemperature = 15; + kOther = 255; + } + + enum StateEnum : enum8 { + kNotPluggedIn = 0; + kPluggedInNoDemand = 1; + kPluggedInDemand = 2; + kPluggedInCharging = 3; + kPluggedInDischarging = 4; + kSessionEnding = 5; + kFault = 6; + } + + enum SupplyStateEnum : enum8 { + kDisabled = 0; + kChargingEnabled = 1; + kDischargingEnabled = 2; + kDisabledError = 3; + kDisabledDiagnostics = 4; + } + + bitmap Feature : bitmap32 { + kChargingPreferences = 0x1; + kSoCReporting = 0x2; + kPlugAndCharge = 0x4; + kRFID = 0x8; + kV2X = 0x10; + } + + bitmap TargetDayOfWeekBitmap : bitmap8 { + kSunday = 0x1; + kMonday = 0x2; + kTuesday = 0x4; + kWednesday = 0x8; + kThursday = 0x10; + kFriday = 0x20; + kSaturday = 0x40; + } + + struct ChargingTargetStruct { + int16u targetTimeMinutesPastMidnight = 0; + optional percent targetSoC = 1; + optional energy_mwh addedEnergy = 2; + } + + info event EVConnected = 0 { + int32u sessionID = 0; + } + + info event EVNotDetected = 1 { + int32u sessionID = 0; + StateEnum state = 1; + elapsed_s sessionDuration = 2; + energy_mwh sessionEnergyCharged = 3; + optional energy_mwh sessionEnergyDischarged = 4; + } + + info event EnergyTransferStarted = 2 { + int32u sessionID = 0; + StateEnum state = 1; + amperage_ma maximumCurrent = 2; + } + + info event EnergyTransferStopped = 3 { + int32u sessionID = 0; + StateEnum state = 1; + EnergyTransferStoppedReasonEnum reason = 2; + energy_mwh energyTransferred = 4; + } + + critical event Fault = 4 { + nullable int32u sessionID = 0; + StateEnum state = 1; + FaultStateEnum faultStatePreviousState = 2; + FaultStateEnum faultStateCurrentState = 4; + } + + info event RFID = 5 { + octet_string uid = 0; + } + + readonly attribute nullable StateEnum state = 0; + readonly attribute SupplyStateEnum supplyState = 1; + readonly attribute FaultStateEnum faultState = 2; + readonly attribute nullable epoch_s chargingEnabledUntil = 3; + readonly attribute optional nullable epoch_s dischargingEnabledUntil = 4; + readonly attribute amperage_ma circuitCapacity = 5; + readonly attribute amperage_ma minimumChargeCurrent = 6; + readonly attribute amperage_ma maximumChargeCurrent = 7; + readonly attribute optional amperage_ma maximumDischargeCurrent = 8; + attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; + attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; + readonly attribute optional int8u numberOfWeeklyTargets = 33; + readonly attribute optional int8u numberOfDailyTargets = 34; + readonly attribute optional nullable epoch_s nextChargeStartTime = 35; + readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; + readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; + readonly attribute optional nullable percent nextChargeTargetSoC = 38; + attribute access(write: manage) optional nullable int16u approximateEVEfficiency = 39; + readonly attribute optional nullable percent stateOfCharge = 48; + readonly attribute optional nullable energy_mwh batteryCapacity = 49; + readonly attribute optional nullable char_string<32> vehicleID = 50; + readonly attribute nullable int32u sessionID = 64; + readonly attribute nullable elapsed_s sessionDuration = 65; + readonly attribute nullable energy_mwh sessionEnergyCharged = 66; + readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67; + 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; + + response struct GetTargetsResponse = 0 { + TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; + } + + request struct EnableChargingRequest { + nullable epoch_s chargingEnabledUntil = 0; + amperage_ma minimumChargeCurrent = 1; + amperage_ma maximumChargeCurrent = 2; + } + + request struct EnableDischargingRequest { + nullable epoch_s dischargingEnabledUntil = 0; + amperage_ma maximumDischargeCurrent = 1; + } + + request struct SetTargetsRequest { + TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; + } + + request struct GetTargetsRequest { + TargetDayOfWeekBitmap daysToReturn = 0; + } + + /** Allows a client to disable the EVSE from charging and discharging. */ + timed command Disable(): DefaultSuccess = 1; + /** Allows a client to enable the EVSE to charge an EV. */ + timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2; + /** Allows a client to enable the EVSE to discharge an EV. */ + timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3; + /** Allows a client to put the EVSE into a self-diagnostics mode. */ + timed command StartDiagnostics(): DefaultSuccess = 4; + /** Allows a client to set the user specified charging targets. */ + timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; + /** Allows a client to retrieve the user specified charging targets. */ + timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6; + /** Allows a client to clear all stored charging targets. */ + timed command ClearTargets(): DefaultSuccess = 7; +} + /** Provides an interface for controlling and adjusting automatic window coverings. */ cluster WindowCovering = 258 { revision 5; @@ -7336,6 +7517,25 @@ endpoint 1 { ram attribute clusterRevision default = 2; } + server cluster EnergyEvse { + ram attribute state; + ram attribute supplyState; + ram attribute faultState; + ram attribute chargingEnabledUntil default = 0; + ram attribute circuitCapacity default = 0; + ram attribute minimumChargeCurrent default = 6000; + ram attribute maximumChargeCurrent default = 0; + ram attribute sessionID; + ram attribute sessionDuration; + ram attribute sessionEnergyCharged; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + } + server cluster WindowCovering { ram attribute type default = 0x08; ram attribute physicalClosedLimitLift default = 0xFFFF; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index aa1ae2ffb08f06..a1f1fc5c7be054 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 @@ -11791,7 +11791,7 @@ "code": 3, "mfgCode": null, "side": "server", - "type": "int64s", + "type": "power_mw", "included": 1, "storageOption": "External", "singleton": 0, @@ -11807,7 +11807,7 @@ "code": 4, "mfgCode": null, "side": "server", - "type": "int64s", + "type": "power_mw", "included": 1, "storageOption": "External", "singleton": 0, @@ -11828,7 +11828,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11844,6 +11844,273 @@ "storageOption": "External", "singleton": 0, "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "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": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Energy EVSE", + "code": 153, + "mfgCode": null, + "define": "ENERGY_EVSE_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "State", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "StateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupplyState", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "SupplyStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FaultState", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "FaultStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ChargingEnabledUntil", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "epoch_s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CircuitCapacity", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MinimumChargeCurrent", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "6000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaximumChargeCurrent", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SessionID", + "code": 64, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SessionDuration", + "code": 65, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SessionEnergyCharged", + "code": 66, + "mfgCode": null, + "side": "server", + "type": "energy_mwh", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, "defaultValue": "", "reportable": 1, "minInterval": 1, From 3047c5a223db6126fbfca8864dd3c4a6ae41f1e8 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 16 Dec 2023 19:42:03 +0000 Subject: [PATCH 018/143] Fixed types to be signed=true --- .../zcl/data-model/chip/chip-types.xml | 8 ++--- .../zap-generated/cluster/Commands.h | 32 ++++++++++--------- .../zap-generated/cluster/Commands.h | 8 ++--- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index 02d81623cc3394..cae3f4a87df8c0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -55,10 +55,10 @@ limitations under the License. - - - - + + + + diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 7948d81d41f181..ab6a6372063478 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -7238,8 +7238,8 @@ class EnergyEvseEnableCharging : public ClusterCommand EnergyEvseEnableCharging(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("enable-charging", credsIssuerConfig) { AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil); - AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent); - AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent); + AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent); + AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent); ClusterCommand::AddArguments(); } @@ -7278,7 +7278,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand ClusterCommand("enable-discharging", credsIssuerConfig) { AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil); - AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent); + AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent); ClusterCommand::AddArguments(); } @@ -19708,16 +19708,18 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>>(Id, "discharging-enabled-until", 0, UINT32_MAX, Attributes::DischargingEnabledUntil::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "circuit-capacity", 0, UINT64_MAX, Attributes::CircuitCapacity::Id, + make_unique>(Id, "circuit-capacity", INT64_MIN, INT64_MAX, Attributes::CircuitCapacity::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "minimum-charge-current", 0, UINT64_MAX, Attributes::MinimumChargeCurrent::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "maximum-charge-current", 0, UINT64_MAX, Attributes::MaximumChargeCurrent::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "maximum-discharge-current", 0, UINT64_MAX, + make_unique>(Id, "minimum-charge-current", INT64_MIN, INT64_MAX, + Attributes::MinimumChargeCurrent::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>(Id, "maximum-charge-current", INT64_MIN, INT64_MAX, + Attributes::MaximumChargeCurrent::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>(Id, "maximum-discharge-current", INT64_MIN, INT64_MAX, Attributes::MaximumDischargeCurrent::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "user-maximum-charge-current", 0, UINT64_MAX, + make_unique>(Id, "user-maximum-charge-current", INT64_MIN, INT64_MAX, Attributes::UserMaximumChargeCurrent::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "randomization-delay-window", 0, UINT32_MAX, @@ -19733,8 +19735,8 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>>(Id, "next-charge-target-time", 0, UINT32_MAX, Attributes::NextChargeTargetTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "next-charge-required-energy", 0, UINT64_MAX, - Attributes::NextChargeRequiredEnergy::Id, + make_unique>>(Id, "next-charge-required-energy", INT64_MIN, + INT64_MAX, Attributes::NextChargeRequiredEnergy::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "next-charge-target-so-c", 0, UINT8_MAX, Attributes::NextChargeTargetSoC::Id, WriteCommandType::kForceWrite, @@ -19745,7 +19747,7 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>>( Id, "state-of-charge", 0, UINT8_MAX, Attributes::StateOfCharge::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "battery-capacity", 0, UINT64_MAX, + make_unique>>(Id, "battery-capacity", INT64_MIN, INT64_MAX, Attributes::BatteryCapacity::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( @@ -19755,10 +19757,10 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>>(Id, "session-duration", 0, UINT32_MAX, Attributes::SessionDuration::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "session-energy-charged", 0, UINT64_MAX, + make_unique>>(Id, "session-energy-charged", INT64_MIN, INT64_MAX, Attributes::SessionEnergyCharged::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "session-energy-discharged", 0, UINT64_MAX, + make_unique>>(Id, "session-energy-discharged", INT64_MIN, INT64_MAX, Attributes::SessionEnergyDischarged::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( 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 5ff2d4bff4737c..6d158196626b71 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80320,10 +80320,10 @@ class EnergyEvseEnableCharging : public ClusterCommand { AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - AddArgument("MinimumChargeCurrent", 0, UINT64_MAX, &mRequest.minimumChargeCurrent); + AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - AddArgument("MaximumChargeCurrent", 0, UINT64_MAX, &mRequest.maximumChargeCurrent); + AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -80389,7 +80389,7 @@ class EnergyEvseEnableDischarging : public ClusterCommand { AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - AddArgument("MaximumDischargeCurrent", 0, UINT64_MAX, &mRequest.maximumDischargeCurrent); + AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -81481,7 +81481,7 @@ class WriteEnergyEvseUserMaximumChargeCurrent : public WriteAttribute { : WriteAttribute("user-maximum-charge-current") { AddArgument("attr-name", "user-maximum-charge-current"); - AddArgument("attr-value", 0, UINT64_MAX, &mValue); + AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } From e10f2cc4db2004e693a23a08eed4371ef690541e Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 16 Dec 2023 19:51:11 +0000 Subject: [PATCH 019/143] Fixed 31032 - revert removal of side="server". --- .../zcl/data-model/chip/energy-evse-cluster.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 49457150b71754..874a112c49f29b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -169,11 +169,11 @@ limitations under the License. The GetTargetsResponse is sent in response to the GetTargets Command. - + EVConnected - + EVNotDetected @@ -181,27 +181,27 @@ limitations under the License. - + EnergyTransferStarted - + EnergyTransferStopped - + Fault - + RFID From 711851c1acbc99e6f54d171428eaebb4e2f879c5 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 16 Dec 2023 20:16:02 +0000 Subject: [PATCH 020/143] regen_all.py --- zzz_generated/chip-tool/zap-generated/cluster/Commands.h | 6 +++--- .../darwin-framework-tool/zap-generated/cluster/Commands.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index ab6a6372063478..0ab3cd79e655bb 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -6874,7 +6874,7 @@ class DeviceEnergyManagementPowerAdjustRequest : public ClusterCommand DeviceEnergyManagementPowerAdjustRequest(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("power-adjust-request", credsIssuerConfig) { - AddArgument("Power", 0, UINT64_MAX, &mRequest.power); + AddArgument("Power", INT64_MIN, INT64_MAX, &mRequest.power); AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); ClusterCommand::AddArguments(); } @@ -19583,9 +19583,9 @@ void registerClusterDeviceEnergyManagement(Commands & commands, CredentialIssuer WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>( Id, "esastate", 0, UINT8_MAX, Attributes::ESAState::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "abs-min-power", 0, UINT64_MAX, Attributes::AbsMinPower::Id, + make_unique>(Id, "abs-min-power", INT64_MIN, INT64_MAX, Attributes::AbsMinPower::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "abs-max-power", 0, UINT64_MAX, Attributes::AbsMaxPower::Id, + make_unique>(Id, "abs-max-power", INT64_MIN, INT64_MAX, Attributes::AbsMaxPower::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>>( 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 6d158196626b71..50b3acfbcfbf44 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -78700,7 +78700,7 @@ class DeviceEnergyManagementPowerAdjustRequest : public ClusterCommand { : ClusterCommand("power-adjust-request") { #if MTR_ENABLE_PROVISIONAL - AddArgument("Power", 0, UINT64_MAX, &mRequest.power); + AddArgument("Power", INT64_MIN, INT64_MAX, &mRequest.power); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); From 8243d7684a5c8d85472e68e9ef59a1158c543bcc Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 18 Dec 2023 21:18:34 +0000 Subject: [PATCH 021/143] Added Device Energy Management cluster back into all-clusters.zap and regen_all after merging from master. --- .../all-clusters-app.matter | 199 ++++++++++++++ .../all-clusters-common/all-clusters-app.zap | 252 +++++++++++++++++- 2 files changed, 450 insertions(+), 1 deletion(-) 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 45be7ed614d227..d58b0eeb6df1d0 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 @@ -3717,6 +3717,185 @@ provisional cluster ElectricalEnergyMeasurement = 145 { readonly attribute int16u clusterRevision = 65533; } +/** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */ +provisional cluster DeviceEnergyManagement = 152 { + revision 1; // NOTE: Default/not specifically set + + enum CauseEnum : enum8 { + kNormalCompletion = 0; + kOffline = 1; + kFault = 2; + kUserOptOut = 3; + } + + enum CostTypeEnum : enum8 { + kFinancial = 0; + kGHGEmissions = 1; + kComfort = 2; + kTemperature = 3; + } + + enum ESAStateEnum : enum8 { + kOffline = 0; + kOnline = 1; + kFault = 2; + kUserOptOut = 3; + kPowerAdjustActive = 4; + kPaused = 5; + } + + enum ESATypeEnum : enum8 { + kEVSE = 0; + kSpaceHeating = 1; + kWaterHeating = 2; + kSpaceCooling = 3; + kSpaceHeatingCooling = 4; + kBatteryStorage = 5; + kSolarPV = 6; + kFridgeFreezer = 7; + kWashingMachine = 8; + kDishwasher = 9; + kCooking = 10; + kHomeWaterPump = 11; + kIrrigationWaterPump = 12; + kPoolPump = 13; + kOther = 255; + } + + bitmap Feature : bitmap32 { + kPowerAdjustment = 0x1; + kPowerForecastReporting = 0x2; + kStateForecastReporting = 0x4; + kForecastAdjustment = 0x8; + } + + struct CostStruct { + CostTypeEnum costType = 0; + int32s value = 1; + int8u decimalPoints = 2; + optional int16u currency = 3; + } + + struct SlotStruct { + elapsed_s minDuration = 0; + elapsed_s maxDuration = 1; + elapsed_s defaultDuration = 2; + elapsed_s elapsedSlotTime = 3; + elapsed_s remainingSlotTime = 4; + boolean slotIsPauseable = 5; + elapsed_s minPauseDuration = 6; + elapsed_s maxPauseDuration = 7; + optional int16u manufacturerESAState = 8; + optional power_mw nominalPower = 9; + optional power_mw minPower = 10; + optional power_mw maxPower = 11; + optional energy_mwh nominalEnergy = 12; + optional CostStruct costs[] = 13; + optional power_mw minPowerAdjustment = 14; + optional power_mw maxPowerAdjustment = 15; + optional elapsed_s minDurationAdjustment = 16; + optional elapsed_s maxDurationAdjustment = 17; + } + + struct ForecastStruct { + int16u forecastId = 0; + nullable int16u activeSlotNumber = 1; + epoch_s startTime = 2; + epoch_s endTime = 3; + optional nullable epoch_s earliestStartTime = 4; + optional epoch_s latestEndTime = 5; + boolean isPauseable = 6; + SlotStruct slots[] = 7; + } + + struct ConstraintsStruct { + epoch_s startTime = 0; + elapsed_s duration = 1; + optional power_mw nominalPower = 2; + optional energy_mwh maximumEnergy = 3; + optional int8s loadControl = 4; + } + + struct PowerAdjustStruct { + power_mw minPower = 0; + power_mw maxPower = 1; + elapsed_s minDuration = 2; + elapsed_s maxDuration = 3; + } + + struct SlotAdjustmentStruct { + int8u slotIndex = 0; + power_mw nominalPower = 1; + elapsed_s duration = 2; + } + + info event PowerAdjustStart = 0 { + } + + info event PowerAdjustEnd = 1 { + CauseEnum cause = 0; + elapsed_s duration = 1; + energy_mwh energyUse = 2; + } + + info event Paused = 2 { + } + + info event Resumed = 3 { + } + + readonly attribute ESATypeEnum ESAType = 0; + readonly attribute boolean ESACanGenerate = 1; + readonly attribute ESAStateEnum ESAState = 2; + readonly attribute power_mw absMinPower = 3; + readonly attribute power_mw absMaxPower = 4; + readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5; + readonly attribute optional nullable ForecastStruct forecast = 6; + 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; + + request struct PowerAdjustRequestRequest { + power_mw power = 0; + elapsed_s duration = 1; + } + + request struct StartTimeAdjustRequestRequest { + epoch_s requestedStartTime = 0; + } + + request struct PauseRequestRequest { + elapsed_s duration = 0; + } + + request struct ModifyForecastRequestRequest { + int32u forecastId = 0; + SlotAdjustmentStruct slotAdjustments[] = 1; + } + + request struct RequestConstraintBasedForecastRequest { + ConstraintsStruct constraints[] = 0; + } + + /** Allows a client to request an adjustment in the power consumption of an ESA for a specified duration. */ + command PowerAdjustRequest(PowerAdjustRequestRequest): DefaultSuccess = 0; + /** Allows a client to cancel an ongoing PowerAdjustmentRequest operation. */ + command CancelPowerAdjustRequest(): DefaultSuccess = 1; + /** Allows a client to adjust the start time of a Forecast sequence that has not yet started operation (i.e. where the current Forecast StartTime is in the future). */ + command StartTimeAdjustRequest(StartTimeAdjustRequestRequest): DefaultSuccess = 2; + /** Allows a client to temporarily pause an operation and reduce the ESAs energy demand. */ + command PauseRequest(PauseRequestRequest): DefaultSuccess = 3; + /** Allows a client to cancel the PauseRequest command and enable earlier resumption of operation. */ + command ResumeRequest(): DefaultSuccess = 4; + /** Allows a client to modify a Forecast within the limits allowed by the ESA. */ + command ModifyForecastRequest(ModifyForecastRequestRequest): DefaultSuccess = 5; + /** Allows a client to ask the ESA to recompute its Forecast based on power and time constraints. */ + command RequestConstraintBasedForecast(RequestConstraintBasedForecastRequest): DefaultSuccess = 6; +} + /** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */ provisional cluster EnergyEvse = 153 { revision 1; // NOTE: Default/not specifically set @@ -7322,6 +7501,26 @@ endpoint 1 { ram attribute clusterRevision default = 1; } + server cluster DeviceEnergyManagement { + emits event PowerAdjustStart; + emits event PowerAdjustEnd; + emits event Paused; + emits event Resumed; + callback attribute ESAType default = 0; + callback attribute ESACanGenerate default = 0; + callback attribute ESAState default = 0; + callback attribute absMinPower default = 0; + callback attribute absMaxPower default = 0; + callback attribute powerAdjustmentCapability; + callback attribute forecast; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + } + server cluster EnergyEvse { callback attribute state default = 0; callback attribute supplyState default = 0; 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 0bba4b8871e6c2..6251243480657a 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 @@ -11729,6 +11729,255 @@ } ] }, + { + "name": "Device Energy Management", + "code": 152, + "mfgCode": null, + "define": "DEVICE_ENERGY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "ESAType", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "ESATypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ESACanGenerate", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ESAState", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "ESAStateEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AbsMinPower", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AbsMaxPower", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PowerAdjustmentCapability", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Forecast", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "ForecastStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "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": "", + "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": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "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": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "PowerAdjustStart", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "PowerAdjustEnd", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Paused", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Resumed", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, { "name": "Energy EVSE", "code": 153, @@ -12234,7 +12483,8 @@ "maxInterval": 65534, "reportableChange": 0 } - ] + ], + "events": [] }, { "name": "Window Covering", From d6b5e4566b3ecf98c005a76275a409f5324a803c Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 18 Dec 2023 23:14:12 +0000 Subject: [PATCH 022/143] Compiles but doesn't work. Needs stub to instantiate class --- .../DeviceEnergyManagementDelegateImpl.h | 16 ++------- .../DeviceEnergyManagementDelegateImpl.cpp | 36 ++++++++++--------- examples/all-clusters-app/linux/BUILD.gn | 1 + 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h index 4f30c4e808d2db..652e26140e216e 100644 --- a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h @@ -20,16 +20,6 @@ #include "app/clusters/device-energy-management-server/device-energy-management-server.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - using chip::Protocols::InteractionModel::Status; namespace chip { @@ -63,7 +53,7 @@ class DeviceEnergyManagementDelegate : public Delegate virtual ESAStateEnum GetESAState() override; virtual int64_t GetAbsMinPower() override; virtual int64_t GetAbsMaxPower() override; - virtual DataModel::Nullable GetPowerAdjustmentCapability() override; + virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() override; virtual DataModel::Nullable GetForecast() override; // ------------------------------------------------------------------ @@ -74,7 +64,7 @@ class DeviceEnergyManagementDelegate : public Delegate virtual CHIP_ERROR SetAbsMinPower(int64_t) override; virtual CHIP_ERROR SetAbsMaxPower(int64_t) override; virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) override; - virtual CHIP_ERROR SetForecast(Structs::ForecastStruct::Type &) override; + virtual CHIP_ERROR SetForecast(DataModel::Nullable &) override; private: ESATypeEnum mEsaType; @@ -82,7 +72,7 @@ class DeviceEnergyManagementDelegate : public Delegate ESAStateEnum mEsaState; int64_t mAbsMinPower; int64_t mAbsMaxPower; - DataModel::Nullable mPowerAdjustmentCapability; + Attributes::PowerAdjustmentCapability::TypeInfo::Type mPowerAdjustmentCapability; DataModel::Nullable mForecast; }; diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp index b71da7508c9e39..e71955dff56327 100644 --- a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -17,9 +17,10 @@ */ #include "DeviceEnergyManagementDelegateImpl.h" -// #include -// #include -// #include + +#include +#include +#include using namespace chip::app::Clusters::DeviceEnergyManagement; using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; @@ -60,17 +61,17 @@ Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t req Status status = Status::UnsupportedCommand; // Status::Success; // TODO: implement - DataModel::Nullable forecast = mDelegate.GetForecast(); + DataModel::Nullable forecast = GetForecast(); if (!forecast.IsNull()) { - uint32_t duration = forecast.endTime - forecast.startTime; // the current entire forecast duration + uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration /* Modify start time and end time */ - forecast.startTime = requestedStartTime; - forecast.endTime = requestedStartTime + duration; + forecast.Value().startTime = requestedStartTime; + forecast.Value().endTime = requestedStartTime + duration; - mDelegate.SetForecast(forecast); + SetForecast(forecast); } return status; } @@ -150,7 +151,7 @@ DataModel::Nullable DeviceEnergyManagementDelegat CHIP_ERROR DeviceEnergyManagementDelegate::SetESAType(ESATypeEnum newValue) { - ESATypeEnum oldValue = mEsaState; + ESATypeEnum oldValue = mEsaType; if (newValue >= ESATypeEnum::kUnknownEnumValue) { @@ -160,7 +161,7 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetESAType(ESATypeEnum newValue) mEsaType = newValue; if (oldValue != newValue) { - ChipLogDetail(AppServer, "mEsaType updated to %d", (int) mEsaType); + ChipLogDetail(AppServer, "mEsaType updated to %d", static_cast(mEsaType)); MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAType::Id); } @@ -174,7 +175,7 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetESACanGenerate(bool newValue) mEsaCanGenerate = newValue; if (oldValue != newValue) { - ChipLogDetail(AppServer, "mEsaCanGenerate updated to %d", (int) mEsaCanGenerate); + ChipLogDetail(AppServer, "mEsaCanGenerate updated to %d", static_cast(mEsaCanGenerate)); MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESACanGenerate::Id); } @@ -193,7 +194,7 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetESAState(ESAStateEnum newValue) mEsaState = newValue; if (oldValue != newValue) { - ChipLogDetail(AppServer, "mEsaState updated to %d", (int) mEsaState); + ChipLogDetail(AppServer, "mEsaState updated to %d", static_cast(mEsaState)); MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); } @@ -207,7 +208,7 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMinPower(int64_t newValue) mAbsMinPower = newValue; if (oldValue != newValue) { - ChipLogDetail(AppServer, "mAbsMinPower updated to %d", (int) mAbsMinPower); + ChipLogDetail(AppServer, "mAbsMinPower updated to %d", static_cast(mAbsMinPower)); MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMinPower::Id); } @@ -221,14 +222,15 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) mAbsMaxPower = newValue; if (oldValue != newValue) { - ChipLogDetail(AppServer, "mAbsMaxPower updated to %d", (int) mAbsMaxPower); + ChipLogDetail(AppServer, "mAbsMaxPower updated to %d", static_cast(mAbsMaxPower)); MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMaxPower::Id); } return CHIP_NO_ERROR; } -CHIP_ERROR DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( +CHIP_ERROR +DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( Attributes::PowerAdjustmentCapability::TypeInfo::Type & powerAdjustmentCapability) { // TODO copy the value @@ -237,10 +239,10 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( return CHIP_NO_ERROR; } -CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(Structs::ForecastStruct::Type & forecast) +CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable & forecast) { mForecast = forecast; - mForecast.forecastId++; + mForecast.Value().forecastId++; // TODO update the member variable structure diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index b3eb61c29f875a..a06e28e5456795 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -21,6 +21,7 @@ import("${chip_root}/src/platform/device.gni") source_set("chip-all-clusters-common") { sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", From 68de7f8406a193b414313ce60db68ecf8417b4f4 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 18 Dec 2023 23:29:06 +0000 Subject: [PATCH 023/143] Fixed EnumerateCommands to allow optional ModifyForecastRequest and RequestConstraintBasedForecast commands --- .../device-energy-management-server.cpp | 12 ++++++++++-- .../device-energy-management-server.h | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 7ace836878cd6c..cea0e993eb8adf 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -115,14 +115,22 @@ CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & clust StartTimeAdjustRequest::Id, PauseRequest::Id, ResumeRequest::Id, - ModifyForecastRequest::Id, - RequestConstraintBasedForecast::Id, }) { VerifyOrExit(callback(cmd, context) == Loop::Continue, /**/); } } + if (SupportsOptCmd(OptionalCommands::kSupportsModifyForecastRequest)) + { + VerifyOrExit(callback(ModifyForecastRequest::Id, context) == Loop::Continue, /**/); + } + + if (SupportsOptCmd(OptionalCommands::kSupportsRequestConstraintBasedForecast)) + { + VerifyOrExit(callback(RequestConstraintBasedForecast::Id, context) == Loop::Continue, /**/); + } + exit: return CHIP_NO_ERROR; } diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index 37e23a720172ca..d1964488f9097e 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -157,12 +157,18 @@ class Delegate EndpointId mEndpointId = 0; }; +enum class OptionalCommands : uint32_t +{ + kSupportsModifyForecastRequest = 0x1, + kSupportsRequestConstraintBasedForecast = 0x2 +}; + class Instance : public AttributeAccessInterface, public CommandHandlerInterface { public: - Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature) : + Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature, OptionalCommands aOptionalCmds) : AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), - mDelegate(aDelegate), mFeature(aFeature) + mDelegate(aDelegate), mFeature(aFeature), mOptionalCmds(aOptionalCmds) { /* set the base class delegates endpointId */ mDelegate.SetEndpointId(aEndpointId); @@ -174,10 +180,12 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface void Shutdown(); bool HasFeature(Feature aFeature) const; + bool SupportsOptCmd(OptionalCommands aOptionalCmds) const; private: Delegate & mDelegate; BitMask mFeature; + BitMask mOptionalCmds; // AttributeAccessInterface CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; From 729fef0db27d8ca5791fcd037eda62cc34f6509d Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 18 Dec 2023 23:33:06 +0000 Subject: [PATCH 024/143] Fixed InvokeCommand issues to allow optional commands. --- .../device-energy-management-server.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index cea0e993eb8adf..e336f48a0f5d1e 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -166,7 +166,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) } return; case StartTimeAdjustRequest::Id: - if (HasFeature(Feature::kForecastAdjustment)) + if (!HasFeature(Feature::kForecastAdjustment)) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); } @@ -178,7 +178,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) } return; case PauseRequest::Id: - if (HasFeature(Feature::kForecastAdjustment)) + if (!HasFeature(Feature::kForecastAdjustment)) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); } @@ -189,7 +189,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) } return; case ResumeRequest::Id: - if (HasFeature(Feature::kForecastAdjustment)) + if (!HasFeature(Feature::kForecastAdjustment)) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); } @@ -200,7 +200,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) } return; case ModifyForecastRequest::Id: - if (HasFeature(Feature::kForecastAdjustment)) + if (!SupportsOptCmd(OptionalCommands::kSupportsModifyForecastRequest)) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); } @@ -212,7 +212,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) } return; case RequestConstraintBasedForecast::Id: - if (HasFeature(Feature::kForecastAdjustment)) + if (!SupportsOptCmd(OptionalCommands::kSupportsRequestConstraintBasedForecast)) { handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, Status::UnsupportedCommand); } From c731f2bfb2a2fe5a317d7d623ff8e34e206cf4f3 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 18 Dec 2023 23:41:44 +0000 Subject: [PATCH 025/143] Improved HandleModifyForecastRequest and HandleRequestConstraintBasedForecast in sdk --- .../device-energy-management-server.cpp | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index e336f48a0f5d1e..3ea05edb698bd4 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -489,11 +489,17 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData) { - Status status = Status::UnsupportedCommand; // TODO Status::Success; - // CHIP_ERROR err = CHIP_NO_ERROR; + Status status = Status::Success; + uint32_t forecastId = commandData.forecastId; - DataModel::Nullable forecast = mDelegate.GetForecast(); + if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) + { + ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + auto forecast = mDelegate.GetForecast(); // DataModel::Nullable if (forecast.IsNull()) { ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); @@ -501,20 +507,37 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: return; } - // TODO update the forecast details - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); - return; + /* Call the delegate to potentially update the forecast */ + DataModel::DecodableList slotAdjustments = commandData.slotAdjustments; + status = mDelegate.ModifyForecastRequest(forecastId, slotAdjustments); + if (status != Status::Success) + { + ChipLogError(Zcl, "DEM: %s - mDelegate.ModifyForecastRequest() FAILURE", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } } void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, const Commands::RequestConstraintBasedForecast::DecodableType & commandData) { - Status status = Status::UnsupportedCommand; // TODO Status::Success; + Status status = Status::Success; - // TODO pass this up to the delegate if it supports it - ChipLogError(Zcl, "DEM: %s - Handle Constraint based forecast ", __FUNCTION__); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); - return; + if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) + { + ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + /* delegate requested to generate a new forecast */ + status = mDelegate.RequestConstraintBasedForecast(commandData.constraints); + if (status != Status::Success) + { + ChipLogError(Zcl, "DEM: %s - mDelegate.commandData.constraints() FAILURE", __FUNCTION__); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } } } // namespace DeviceEnergyManagement From 202420aa04583d5df855ae696a0fb3d39478d8fd Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 19 Dec 2023 17:32:15 +0000 Subject: [PATCH 026/143] Updates to add DeviceEnergyManagement to all-clusters. --- .../DeviceEnergyManagementDelegateImpl.h | 5 +- .../include/DeviceEnergyManagementManager.h | 57 ++++ .../DeviceEnergyManagementDelegateImpl.cpp | 3 + .../src/DeviceEnergyManagementManager.cpp | 33 +++ .../src/device-energy-management-stub.cpp | 75 ++++++ examples/all-clusters-app/linux/BUILD.gn | 2 + .../DeviceEnergyManagementDelegateImpl.h | 81 ++++++ .../include/DeviceEnergyManagementManager.h | 57 ++++ .../DeviceEnergyManagementDelegateImpl.cpp | 255 ++++++++++++++++++ .../src/DeviceEnergyManagementManager.cpp | 33 +++ .../device-energy-management-server.cpp | 5 + 11 files changed, 603 insertions(+), 3 deletions(-) create mode 100644 examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h create mode 100644 examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp create mode 100644 examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp create mode 100644 examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h create mode 100644 examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h create mode 100644 examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp create mode 100644 examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h index 652e26140e216e..5ee6dbc013c319 100644 --- a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h @@ -29,11 +29,10 @@ namespace DeviceEnergyManagement { /** The application delegate. */ -class DeviceEnergyManagementDelegate : public Delegate +class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate { public: - DeviceEnergyManagementDelegate(); - virtual ~DeviceEnergyManagementDelegate() = default; + ~DeviceEnergyManagementDelegate(); virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration) override; virtual Status CancelPowerAdjustRequest() override; diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h new file mode 100644 index 00000000000000..6d131dd4ae90fa --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +using namespace chip::app::Clusters::DeviceEnergyManagement; +class DeviceEnergyManagementManager : public Instance +{ +public: + DeviceEnergyManagementManager(EndpointId aEndpointId, DeviceEnergyManagementDelegate & aDelegate, Feature aFeature, + OptionalCommands aOptionalCmds) : + DeviceEnergyManagement::Instance(aEndpointId, aDelegate, aFeature, aOptionalCmds) + { + mDelegate = &aDelegate; + } + + // Delete copy constructor and assignment operator. + DeviceEnergyManagementManager(const DeviceEnergyManagementManager &) = delete; + DeviceEnergyManagementManager(const DeviceEnergyManagementManager &&) = delete; + DeviceEnergyManagementManager & operator=(const DeviceEnergyManagementManager &) = delete; + + CHIP_ERROR Init(); + void Shutdown(); + + DeviceEnergyManagementDelegate * GetDelegate() { return mDelegate; }; + +private: + DeviceEnergyManagementDelegate * mDelegate; +}; + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp index e71955dff56327..b7c3e0abcadb73 100644 --- a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -22,6 +22,9 @@ #include #include +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; using namespace chip::app::Clusters::DeviceEnergyManagement; using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp new file mode 100644 index 00000000000000..c31e0624e4c743 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp @@ -0,0 +1,33 @@ +/* + * + * 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::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::DeviceEnergyManagement; + +CHIP_ERROR DeviceEnergyManagementManager::Init() +{ + return Instance::Init(); +} + +void DeviceEnergyManagementManager::Shutdown() +{ + Instance::Shutdown(); +} diff --git a/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp new file mode 100644 index 00000000000000..2f73613fbabbe5 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp @@ -0,0 +1,75 @@ +/* + * + * 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::DeviceEnergyManagement; + +static DeviceEnergyManagementDelegate * gDelegate = nullptr; +static DeviceEnergyManagementManager * gInstance = nullptr; + +void emberAfDeviceEnergyManagementClusterInitCallback(chip::EndpointId endpointId) +{ + VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. + VerifyOrDie(gInstance == nullptr); + + CHIP_ERROR err; + + if ((gDelegate != nullptr) || (gInstance != nullptr)) + { + ChipLogError(AppServer, "DEM Instance or Delegate already exist."); + return; + } + + gDelegate = new DeviceEnergyManagementDelegate(); + if (gDelegate == nullptr) + { + ChipLogError(AppServer, "Failed to allocate memory for DeviceEnergyManagementDelegate"); + return; + } + + /* Manufacturer may optionally not support all features, commands & attributes */ + gInstance = new DeviceEnergyManagementManager( + endpointId, *gDelegate, + BitMask( + DeviceEnergyManagement::Feature::kPowerForecastReporting, DeviceEnergyManagement::Feature::kStateForecastReporting, + DeviceEnergyManagement::Feature::kPowerAdjustment, DeviceEnergyManagement::Feature::kForecastAdjustment), + BitMask(OptionalCommands::kSupportsModifyForecastRequest, + OptionalCommands::kSupportsRequestConstraintBasedForecast)); + + if (gInstance == nullptr) + { + ChipLogError(AppServer, "Failed to allocate memory for DeviceEnergyManagementManager"); + delete gDelegate; + gDelegate = nullptr; + return; + } + + err = gInstance->Init(); /* Register Attribute & Command handlers */ + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Init failed on gInstance"); + delete gInstance; + delete gDelegate; + gInstance = nullptr; + gDelegate = nullptr; + return; + } +} diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index a06e28e5456795..b3117fd74cf8a6 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -22,12 +22,14 @@ import("${chip_root}/src/platform/device.gni") source_set("chip-all-clusters-common") { sources = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${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/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/energy-evse-stub.cpp", diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h new file mode 100644 index 00000000000000..5ee6dbc013c319 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h @@ -0,0 +1,81 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "app/clusters/device-energy-management-server/device-energy-management-server.h" + +using chip::Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { +namespace DeviceEnergyManagement { + +/** The application delegate. + */ +class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate +{ +public: + ~DeviceEnergyManagementDelegate(); + + virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration) override; + virtual Status CancelPowerAdjustRequest() override; + virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) override; + virtual Status PauseRequest(const uint32_t duration) override; + virtual Status ResumeRequest() override; + virtual Status + ModifyForecastRequest(const uint32_t forecastId, + const DataModel::DecodableList & slotAdjustments) override; + virtual Status RequestConstraintBasedForecast( + const DataModel::DecodableList & constraints) override; + + // ------------------------------------------------------------------ + // Get attribute methods + virtual ESATypeEnum GetESAType() override; + virtual bool GetESACanGenerate() override; + virtual ESAStateEnum GetESAState() override; + virtual int64_t GetAbsMinPower() override; + virtual int64_t GetAbsMaxPower() override; + virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() override; + virtual DataModel::Nullable GetForecast() override; + + // ------------------------------------------------------------------ + // Set attribute methods + virtual CHIP_ERROR SetESAType(ESATypeEnum) override; + virtual CHIP_ERROR SetESACanGenerate(bool) override; + virtual CHIP_ERROR SetESAState(ESAStateEnum) override; + virtual CHIP_ERROR SetAbsMinPower(int64_t) override; + virtual CHIP_ERROR SetAbsMaxPower(int64_t) override; + virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) override; + virtual CHIP_ERROR SetForecast(DataModel::Nullable &) override; + +private: + ESATypeEnum mEsaType; + bool mEsaCanGenerate; + ESAStateEnum mEsaState; + int64_t mAbsMinPower; + int64_t mAbsMaxPower; + Attributes::PowerAdjustmentCapability::TypeInfo::Type mPowerAdjustmentCapability; + DataModel::Nullable mForecast; +}; + +} // namespace DeviceEnergyManagement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h new file mode 100644 index 00000000000000..6d131dd4ae90fa --- /dev/null +++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { + +using namespace chip::app::Clusters::DeviceEnergyManagement; +class DeviceEnergyManagementManager : public Instance +{ +public: + DeviceEnergyManagementManager(EndpointId aEndpointId, DeviceEnergyManagementDelegate & aDelegate, Feature aFeature, + OptionalCommands aOptionalCmds) : + DeviceEnergyManagement::Instance(aEndpointId, aDelegate, aFeature, aOptionalCmds) + { + mDelegate = &aDelegate; + } + + // Delete copy constructor and assignment operator. + DeviceEnergyManagementManager(const DeviceEnergyManagementManager &) = delete; + DeviceEnergyManagementManager(const DeviceEnergyManagementManager &&) = delete; + DeviceEnergyManagementManager & operator=(const DeviceEnergyManagementManager &) = delete; + + CHIP_ERROR Init(); + void Shutdown(); + + DeviceEnergyManagementDelegate * GetDelegate() { return mDelegate; }; + +private: + DeviceEnergyManagementDelegate * mDelegate; +}; + +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp new file mode 100644 index 00000000000000..b7c3e0abcadb73 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -0,0 +1,255 @@ +/* + * + * 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 "DeviceEnergyManagementDelegateImpl.h" + +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::DeviceEnergyManagement; +using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; + +using chip::Optional; +using namespace chip::app; +using CostsList = DataModel::List; + +Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, const uint32_t duration) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + + // TODO: implement + mEsaState = ESAStateEnum::kPowerAdjustActive; + + // TODO: Generate a PowerAdjustStart Event, then begins to adjust its power + // When done, raise PowerAdjustEnd & ESAState set to kOnline. + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + return status; +} + +Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() +{ + Status status = Status::UnsupportedCommand; // Status::Success; + + // TODO: implement + /* TODO: If the command is accepted, the ESA SHALL generate an PowerAdjustEnd Event. */ + mEsaState = ESAStateEnum::kOnline; + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + return status; +} + +Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + + // TODO: implement + DataModel::Nullable forecast = GetForecast(); + + if (!forecast.IsNull()) + { + uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration + + /* Modify start time and end time */ + forecast.Value().startTime = requestedStartTime; + forecast.Value().endTime = requestedStartTime + duration; + + SetForecast(forecast); + } + return status; +} + +Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + return status; +} + +Status DeviceEnergyManagementDelegate::ResumeRequest() +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + mEsaState = ESAStateEnum::kOnline; + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + return status; +} + +Status DeviceEnergyManagementDelegate::ModifyForecastRequest( + const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + return status; +} + +Status DeviceEnergyManagementDelegate::RequestConstraintBasedForecast( + const DataModel::DecodableList & constraints) +{ + Status status = Status::UnsupportedCommand; // Status::Success; + // TODO: implement + return status; +} + +// ------------------------------------------------------------------ +// Get attribute methods +ESATypeEnum DeviceEnergyManagementDelegate::GetESAType() +{ + return mEsaType; +} + +bool DeviceEnergyManagementDelegate::GetESACanGenerate() +{ + return mEsaCanGenerate; +} + +ESAStateEnum DeviceEnergyManagementDelegate::GetESAState() +{ + return mEsaState; +} + +int64_t DeviceEnergyManagementDelegate::GetAbsMinPower() +{ + return mAbsMinPower; +} + +int64_t DeviceEnergyManagementDelegate::GetAbsMaxPower() +{ + return mAbsMaxPower; +} + +Attributes::PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() +{ + return mPowerAdjustmentCapability; +} + +DataModel::Nullable DeviceEnergyManagementDelegate::GetForecast() +{ + return mForecast; +} + +// ------------------------------------------------------------------ +// Set attribute methods + +CHIP_ERROR DeviceEnergyManagementDelegate::SetESAType(ESATypeEnum newValue) +{ + ESATypeEnum oldValue = mEsaType; + + if (newValue >= ESATypeEnum::kUnknownEnumValue) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + mEsaType = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mEsaType updated to %d", static_cast(mEsaType)); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAType::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetESACanGenerate(bool newValue) +{ + bool oldValue = mEsaCanGenerate; + + mEsaCanGenerate = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mEsaCanGenerate updated to %d", static_cast(mEsaCanGenerate)); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESACanGenerate::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetESAState(ESAStateEnum newValue) +{ + ESAStateEnum oldValue = mEsaState; + + if (newValue >= ESAStateEnum::kUnknownEnumValue) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + mEsaState = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mEsaState updated to %d", static_cast(mEsaState)); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMinPower(int64_t newValue) +{ + int64_t oldValue = mAbsMinPower; + + mAbsMinPower = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mAbsMinPower updated to %d", static_cast(mAbsMinPower)); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMinPower::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) +{ + int64_t oldValue = mAbsMaxPower; + + mAbsMaxPower = newValue; + if (oldValue != newValue) + { + ChipLogDetail(AppServer, "mAbsMaxPower updated to %d", static_cast(mAbsMaxPower)); + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMaxPower::Id); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR +DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( + Attributes::PowerAdjustmentCapability::TypeInfo::Type & powerAdjustmentCapability) +{ + // TODO copy the value + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, PowerAdjustmentCapability::Id); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable & forecast) +{ + mForecast = forecast; + mForecast.Value().forecastId++; + + // TODO update the member variable structure + + MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, Forecast::Id); + + return CHIP_NO_ERROR; +} diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp new file mode 100644 index 00000000000000..c31e0624e4c743 --- /dev/null +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp @@ -0,0 +1,33 @@ +/* + * + * 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::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::DeviceEnergyManagement; + +CHIP_ERROR DeviceEnergyManagementManager::Init() +{ + return Instance::Init(); +} + +void DeviceEnergyManagementManager::Shutdown() +{ + Instance::Shutdown(); +} diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 3ea05edb698bd4..8d11afdddff042 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -53,6 +53,11 @@ bool Instance::HasFeature(Feature aFeature) const return mFeature.Has(aFeature); } +bool Instance::SupportsOptCmd(OptionalCommands aOptionalCmds) const +{ + return mOptionalCmds.Has(aOptionalCmds); +} + // AttributeAccessInterface CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { From 148330477bef64c0b7fd541564ada85ad3223305 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 19 Dec 2023 21:20:52 +0000 Subject: [PATCH 027/143] Compiles and links --- .../include/DeviceEnergyManagementDelegateImpl.h | 10 ++++++---- .../src/device-energy-management-stub.cpp | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h index 5ee6dbc013c319..8da4d055024371 100644 --- a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h @@ -20,20 +20,22 @@ #include "app/clusters/device-energy-management-server/device-energy-management-server.h" -using chip::Protocols::InteractionModel::Status; +#include +#include +#include +using chip::Protocols::InteractionModel::Status; namespace chip { namespace app { namespace Clusters { namespace DeviceEnergyManagement { -/** The application delegate. +/** + * The application delegate. */ class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate { public: - ~DeviceEnergyManagementDelegate(); - virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration) override; virtual Status CancelPowerAdjustRequest() override; virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) override; diff --git a/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp index 2f73613fbabbe5..87758953441827 100644 --- a/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp @@ -19,6 +19,7 @@ #include using namespace chip; +using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::DeviceEnergyManagement; From be9d4836a4a9edf9a5e31b4122cedae75b35c1a0 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 19 Dec 2023 21:44:31 +0000 Subject: [PATCH 028/143] Sync file in energy-management-app --- .../include/DeviceEnergyManagementDelegateImpl.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h index 5ee6dbc013c319..8da4d055024371 100644 --- a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h @@ -20,20 +20,22 @@ #include "app/clusters/device-energy-management-server/device-energy-management-server.h" -using chip::Protocols::InteractionModel::Status; +#include +#include +#include +using chip::Protocols::InteractionModel::Status; namespace chip { namespace app { namespace Clusters { namespace DeviceEnergyManagement { -/** The application delegate. +/** + * The application delegate. */ class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate { public: - ~DeviceEnergyManagementDelegate(); - virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration) override; virtual Status CancelPowerAdjustRequest() override; virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) override; From 1d7acdfc3922063395b3eaee2abbf8304d14867d Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 19 Dec 2023 22:42:23 +0000 Subject: [PATCH 029/143] Updated DEM to support SetPowerAdjustmentCapability and SetForecast methods. --- .../DeviceEnergyManagementDelegateImpl.h | 4 +- .../DeviceEnergyManagementDelegateImpl.cpp | 64 ++++++++++++++++--- .../DeviceEnergyManagementDelegateImpl.h | 4 +- .../DeviceEnergyManagementDelegateImpl.cpp | 64 ++++++++++++++++--- .../device-energy-management-server.h | 29 +++++---- 5 files changed, 129 insertions(+), 36 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h index 8da4d055024371..464a683510b3d7 100644 --- a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h @@ -64,8 +64,8 @@ class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate virtual CHIP_ERROR SetESAState(ESAStateEnum) override; virtual CHIP_ERROR SetAbsMinPower(int64_t) override; virtual CHIP_ERROR SetAbsMaxPower(int64_t) override; - virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) override; - virtual CHIP_ERROR SetForecast(DataModel::Nullable &) override; + virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type) override; + virtual CHIP_ERROR SetForecast(DataModel::Nullable) override; private: ESATypeEnum mEsaType; diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp index b7c3e0abcadb73..4ca8fa77a061e0 100644 --- a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -139,7 +139,7 @@ int64_t DeviceEnergyManagementDelegate::GetAbsMaxPower() return mAbsMaxPower; } -Attributes::PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() +PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() { return mPowerAdjustmentCapability; } @@ -233,21 +233,67 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) } CHIP_ERROR -DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( - Attributes::PowerAdjustmentCapability::TypeInfo::Type & powerAdjustmentCapability) +DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability(PowerAdjustmentCapability::TypeInfo::Type powerAdjustmentCapability) { - // TODO copy the value + if (powerAdjustmentCapability.IsNull()) + { + mPowerAdjustmentCapability.SetNull(); + ChipLogDetail(AppServer, "null src - %s", __FUNCTION__); + } + else + { + auto src = powerAdjustmentCapability.Value(); + auto target = mPowerAdjustmentCapability.Value(); + auto size = src.size(); + + if (size > 8) + { + return CHIP_ERROR_BAD_REQUEST; + } + + target.reduce_size(0); + + for (size_t i = 0; i < size; i++) + { + const_cast(target[i]) = src[i]; + } + } MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, PowerAdjustmentCapability::Id); return CHIP_NO_ERROR; } -CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable & forecast) +CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable forecast) { - mForecast = forecast; - mForecast.Value().forecastId++; - - // TODO update the member variable structure + if (forecast.IsNull()) + { + mForecast.SetNull(); + ChipLogDetail(AppServer, "null src - %s", __FUNCTION__); + } + else + { + auto src = forecast.Value(); + auto target = mForecast.Value(); + + target.forecastId++; + target.activeSlotNumber = src.activeSlotNumber; + target.startTime = src.startTime; + target.endTime = src.endTime; + target.earliestStartTime = src.earliestStartTime; + target.latestEndTime = src.latestEndTime; + target.isPauseable = src.isPauseable; + + auto slots = src.slots; + auto size = slots.size(); + target.slots.reduce_size(0); // clear them + ChipLogDetail(AppServer, "src.slots.size() %d - %s", (int) size, __FUNCTION__); + + for (size_t i = 0; i < size; i++) + { + const_cast(target.slots[i]) = + slots[i]; // TODO: test if this works for optional/nullable stuff + } + } MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, Forecast::Id); diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h index 8da4d055024371..464a683510b3d7 100644 --- a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h @@ -64,8 +64,8 @@ class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate virtual CHIP_ERROR SetESAState(ESAStateEnum) override; virtual CHIP_ERROR SetAbsMinPower(int64_t) override; virtual CHIP_ERROR SetAbsMaxPower(int64_t) override; - virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) override; - virtual CHIP_ERROR SetForecast(DataModel::Nullable &) override; + virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type) override; + virtual CHIP_ERROR SetForecast(DataModel::Nullable) override; private: ESATypeEnum mEsaType; diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp index b7c3e0abcadb73..4ca8fa77a061e0 100644 --- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -139,7 +139,7 @@ int64_t DeviceEnergyManagementDelegate::GetAbsMaxPower() return mAbsMaxPower; } -Attributes::PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() +PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() { return mPowerAdjustmentCapability; } @@ -233,21 +233,67 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) } CHIP_ERROR -DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability( - Attributes::PowerAdjustmentCapability::TypeInfo::Type & powerAdjustmentCapability) +DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability(PowerAdjustmentCapability::TypeInfo::Type powerAdjustmentCapability) { - // TODO copy the value + if (powerAdjustmentCapability.IsNull()) + { + mPowerAdjustmentCapability.SetNull(); + ChipLogDetail(AppServer, "null src - %s", __FUNCTION__); + } + else + { + auto src = powerAdjustmentCapability.Value(); + auto target = mPowerAdjustmentCapability.Value(); + auto size = src.size(); + + if (size > 8) + { + return CHIP_ERROR_BAD_REQUEST; + } + + target.reduce_size(0); + + for (size_t i = 0; i < size; i++) + { + const_cast(target[i]) = src[i]; + } + } MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, PowerAdjustmentCapability::Id); return CHIP_NO_ERROR; } -CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable & forecast) +CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable forecast) { - mForecast = forecast; - mForecast.Value().forecastId++; - - // TODO update the member variable structure + if (forecast.IsNull()) + { + mForecast.SetNull(); + ChipLogDetail(AppServer, "null src - %s", __FUNCTION__); + } + else + { + auto src = forecast.Value(); + auto target = mForecast.Value(); + + target.forecastId++; + target.activeSlotNumber = src.activeSlotNumber; + target.startTime = src.startTime; + target.endTime = src.endTime; + target.earliestStartTime = src.earliestStartTime; + target.latestEndTime = src.latestEndTime; + target.isPauseable = src.isPauseable; + + auto slots = src.slots; + auto size = slots.size(); + target.slots.reduce_size(0); // clear them + ChipLogDetail(AppServer, "src.slots.size() %d - %s", (int) size, __FUNCTION__); + + for (size_t i = 0; i < size; i++) + { + const_cast(target.slots[i]) = + slots[i]; // TODO: test if this works for optional/nullable stuff + } + } MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, Forecast::Id); diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index d1964488f9097e..2694119f281a72 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -28,6 +28,7 @@ #include #include +using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; namespace chip { namespace app { namespace Clusters { @@ -135,23 +136,23 @@ class Delegate // ------------------------------------------------------------------ // Get attribute methods - virtual ESATypeEnum GetESAType() = 0; - virtual bool GetESACanGenerate() = 0; - virtual ESAStateEnum GetESAState() = 0; - virtual int64_t GetAbsMinPower() = 0; - virtual int64_t GetAbsMaxPower() = 0; - virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() = 0; - virtual DataModel::Nullable GetForecast() = 0; + virtual ESATypeEnum GetESAType() = 0; + virtual bool GetESACanGenerate() = 0; + virtual ESAStateEnum GetESAState() = 0; + virtual int64_t GetAbsMinPower() = 0; + virtual int64_t GetAbsMaxPower() = 0; + virtual PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() = 0; + virtual DataModel::Nullable GetForecast() = 0; // ------------------------------------------------------------------ // Set attribute methods - virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0; - virtual CHIP_ERROR SetESACanGenerate(bool) = 0; - virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0; - virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0; - virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0; - virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type &) = 0; - virtual CHIP_ERROR SetForecast(DataModel::Nullable &) = 0; + virtual CHIP_ERROR SetESAType(ESATypeEnum) = 0; + virtual CHIP_ERROR SetESACanGenerate(bool) = 0; + virtual CHIP_ERROR SetESAState(ESAStateEnum) = 0; + virtual CHIP_ERROR SetAbsMinPower(int64_t) = 0; + virtual CHIP_ERROR SetAbsMaxPower(int64_t) = 0; + virtual CHIP_ERROR SetPowerAdjustmentCapability(PowerAdjustmentCapability::TypeInfo::Type) = 0; + virtual CHIP_ERROR SetForecast(DataModel::Nullable) = 0; protected: EndpointId mEndpointId = 0; From 21cdca6a9f7e7bf1464202a1be650376e9e04afb Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 00:30:01 +0000 Subject: [PATCH 030/143] Updated based on review comments. Changed Epoch to be Matter 2000 based epochs. --- .../DeviceEnergyManagementDelegateImpl.cpp | 22 +++--- .../DeviceEnergyManagementDelegateImpl.cpp | 22 +++--- .../device-energy-management-server.cpp | 77 +++++++++++-------- .../device-energy-management-server.h | 38 +++++---- 4 files changed, 86 insertions(+), 73 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp index 4ca8fa77a061e0..d707ba48b54754 100644 --- a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -61,22 +61,22 @@ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime) { - Status status = Status::UnsupportedCommand; // Status::Success; - - // TODO: implement DataModel::Nullable forecast = GetForecast(); - if (!forecast.IsNull()) + if (forecast.IsNull()) { - uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration + return Status::Failure; + } - /* Modify start time and end time */ - forecast.Value().startTime = requestedStartTime; - forecast.Value().endTime = requestedStartTime + duration; + uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration - SetForecast(forecast); - } - return status; + /* Modify start time and end time */ + forecast.Value().startTime = requestedStartTime; + forecast.Value().endTime = requestedStartTime + duration; + + SetForecast(forecast); // This will increment forecast ID + + return Status::Success; } Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration) diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp index 4ca8fa77a061e0..d707ba48b54754 100644 --- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -61,22 +61,22 @@ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime) { - Status status = Status::UnsupportedCommand; // Status::Success; - - // TODO: implement DataModel::Nullable forecast = GetForecast(); - if (!forecast.IsNull()) + if (forecast.IsNull()) { - uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration + return Status::Failure; + } - /* Modify start time and end time */ - forecast.Value().startTime = requestedStartTime; - forecast.Value().endTime = requestedStartTime + duration; + uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration - SetForecast(forecast); - } - return status; + /* Modify start time and end time */ + forecast.Value().startTime = requestedStartTime; + forecast.Value().endTime = requestedStartTime + duration; + + SetForecast(forecast); // This will increment forecast ID + + return Status::Success; } Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 8d11afdddff042..bf05364fa67b71 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -238,7 +238,8 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po bool validArgs = false; Status status = Status::Success; - auto powerAdjustmentCapability = mDelegate.GetPowerAdjustmentCapability(); + PowerAdjustmentCapability::TypeInfo::Type powerAdjustmentCapability; + powerAdjustmentCapability = mDelegate.GetPowerAdjustmentCapability(); if (powerAdjustmentCapability.IsNull()) { @@ -268,7 +269,6 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po ChipLogProgress(Zcl, "DEM: %s Good PowerAdjustRequest() args.", __FUNCTION__); - /* Call the delegate to do the power adjustment */ status = mDelegate.PowerAdjustRequest(power, durationSec); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) @@ -293,7 +293,6 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, return; } - /* Call the delegate to cancel the power adjustment */ status = mDelegate.CancelPowerAdjustRequest(); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) @@ -335,7 +334,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, * LatestEndTime, then the command SHALL be rejected with CONSTRAINT_ERROR; * otherwise the command SHALL be rejected with FAILURE */ - /* earliestStartTime is optional based on the FA (ForecastAdjust) feature AND can be nullable */ + /* earliestStartTime is optional based on the FA (ForecastAdjust) feature AND is nullable */ if (forecast.Value().earliestStartTime.HasValue() || forecast.Value().latestEndTime.HasValue()) { /* These Should not be NULL since this command requires FA feature and these are mandatory for that */ @@ -344,20 +343,28 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, return; } - chip::System::Clock::Milliseconds64 cTMs; - auto chipError = chip::System::SystemClock().GetClock_RealTimeMS(cTMs); - if (chipError != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "DEM: Unable to get current time - error=%d (%s)]", chipError.AsInteger(), chipError.AsString()); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); - return; - } - uint32_t epochNow = std::chrono::duration_cast(cTMs).count(); - if (forecast.Value().earliestStartTime.Value().IsNull()) { + chip::System::Clock::Milliseconds64 cTMs; + CHIP_ERROR chipError = chip::System::SystemClock().GetClock_RealTimeMS(cTMs); + if (chipError != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "DEM: Unable to get current time - error=%d (%s)]", chipError.AsInteger(), chipError.AsString()); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + + auto unixEpoch = std::chrono::duration_cast(cTMs).count(); + uint32_t chipEpoch = 0; + if (!chip::UnixEpochToChipEpochTime(unixEpoch, chipEpoch)) + { + ChipLogError(Zcl, "DEM: unable to convert Unix Epoch time to Matter Epoch Time"); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); + return; + } + /* Null means - We can start immediately */ - earliestStartTime = epochNow; /* NOW */ + earliestStartTime = chipEpoch; /* NOW */ } else { @@ -368,23 +375,29 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration - if ((requestedStartTime < earliestStartTime) || ((requestedStartTime + duration) > latestEndTime)) + if (requestedStartTime < earliestStartTime) { - ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime %d, earlier than earliestStartTime %d.", __FUNCTION__, + requestedStartTime, earliestStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - else + + if ((requestedStartTime + duration) > latestEndTime) { - ChipLogProgress(Zcl, "DEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime + duration %d, later than latestEndTime %d.", __FUNCTION__, + requestedStartTime + duration, latestEndTime); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); + return; + } - status = mDelegate.StartTimeAdjustRequest(requestedStartTime); - ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); - if (status != Status::Success) - { - ChipLogError(Zcl, "DEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); - return; - } + ChipLogProgress(Zcl, "DEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); + status = mDelegate.StartTimeAdjustRequest(requestedStartTime); + ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); + if (status != Status::Success) + { + ChipLogError(Zcl, "DEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); + return; } return; @@ -434,7 +447,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable) { - ChipLogError(Zcl, "DEM: %s - activeSlotNumber %d is NOT pausible.", __FUNCTION__, activeSlotNumber); + ChipLogError(Zcl, "DEM: %s - activeSlotNumber %d is NOT pauseable.", __FUNCTION__, activeSlotNumber); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -455,7 +468,6 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq return; } - /* Finally - we can call the delegate to ask for a pause */ status = mDelegate.PauseRequest(duration); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) @@ -469,8 +481,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData) { - Status status = Status::Success; - + Status status = Status::Success; DataModel::Nullable forecast = mDelegate.GetForecast(); if (ESAStateEnum::kPaused != mDelegate.GetESAState()) @@ -480,7 +491,6 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR return; } - /* Call the delegate to resume */ status = mDelegate.ResumeRequest(); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) @@ -496,6 +506,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: { Status status = Status::Success; uint32_t forecastId = commandData.forecastId; + DataModel::Nullable forecast; if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { @@ -504,7 +515,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: return; } - auto forecast = mDelegate.GetForecast(); // DataModel::Nullable + forecast = mDelegate.GetForecast(); if (forecast.IsNull()) { ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); @@ -512,7 +523,6 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: return; } - /* Call the delegate to potentially update the forecast */ DataModel::DecodableList slotAdjustments = commandData.slotAdjustments; status = mDelegate.ModifyForecastRequest(forecastId, slotAdjustments); if (status != Status::Success) @@ -535,7 +545,6 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, return; } - /* delegate requested to generate a new forecast */ status = mDelegate.RequestConstraintBasedForecast(commandData.constraints); if (status != Status::Success) { diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index 2694119f281a72..b0725ca6685180 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -36,7 +36,9 @@ namespace DeviceEnergyManagement { using chip::Protocols::InteractionModel::Status; -/** @brief Defines methods for implementing application-specific logic for this Cluster. +/** + * @brief Defines methods for implementing application-specific logic for this Cluster. + * */ class Delegate { @@ -49,8 +51,7 @@ class Delegate * @brief Delegate should implement a handler to begin to adjust client power * consumption/generation to the level requested. * - * @param power Milli-Watts the ESA SHALL use during the adjustment period. Positive values indicate the direction of current - * flow -towards- a load. + * @param power Milli-Watts the ESA SHALL use during the adjustment period. * @param duration The duration that the ESA SHALL maintain the requested power for. * @return Success if the adjustment is accepted; otherwise the command SHALL be rejected with appropriate error. */ @@ -81,32 +82,34 @@ class Delegate virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) = 0; /** - * @brief Delegate implementation: - * If the ESA supports FA and either the SlotIsPauseable field is true in the ActiveSlotNumber index in the - * Slots list, or the IsPausable field is true in the Forecast attribute structure, and the ESAState is not - * UserOptOut then the ESA SHALL pause its current operation. + * @brief Delegate handler for PauseRequest command + * + * If the ESA supports FA and the SlotIsPauseable field is true in the ActiveSlotNumber + * index in the Slots list, and the ESAState is not UserOptOut then the ESA SHALL allow its current + * operation to be Paused. + * * During this state the ESA SHALL not consume or produce significant power (other than required to keep its * basic control system operational). - * The ESA SHALL also generate a Paused Event and the ESAState SHALL be restored to Paused. * - * @param duration Duration that the ESA SHALL be paused for. SHALL be between MinPauseDuration & MaxPauseDuration for current - * slot. - * @return Success if the ESA is paused, otherwise returns other IM_Statuses. + * @param duration Duration that the ESA SHALL be paused for. + * @return Success if the ESA is paused, otherwise returns other IM_Status. */ virtual Status PauseRequest(const uint32_t duration) = 0; /** - * @brief Delegate implementation: + * @brief Delegate handler for ResumeRequest command + * * If the ESA supports FA and it is currently Paused then the ESA SHALL resume its operation. * The ESA SHALL also generate a Resumed Event and the ESAState SHALL be updated accordingly to * reflect its current state. * - * @return Success if the ESA is resumed, otherwise returns other IM_Statuss. + * @return Success if the ESA is resumed, otherwise returns other IM_Status. */ virtual Status ResumeRequest() = 0; /** - * @brief Delegate should implement: + * @brief Delegate handler for ModifyForecastRequest + * * If the ESA supports FA, and the ESAState is not UserOptOut it SHALL attempt to adjust its power forecast. * This allows a one or more modifications in a single command by sending a list of modifications (one for each 'slot'). * Attempts to modify slots which have already past, SHALL result in the entire command being rejected. @@ -116,20 +119,21 @@ class Delegate * @param forecastId Indicates the ESA ForecastId that is to be modified. * @param slotAdjustments List of adjustments to be applied to the ESA, corresponding to the expected ESA forecastId. * @return Success if the entire list of SlotAdjustmentStruct are accepted, otherwise the command - * SHALL be rejected returning other IM_Statuss. + * SHALL be rejected returning other IM_Status. */ virtual Status ModifyForecastRequest(const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) = 0; /** - * @brief Delegate should implement: + * @brief Delegate handler for RequestConstraintBasedForecast + * * The ESA SHALL inspect the requested power limits to ensure that there are no overlapping elements. The ESA * manufacturer may also reject the request if it could cause the user’s preferences to be breached (e.g. may * cause the home to be too hot or too cold, or a battery to be insufficiently charged). * If the ESA can meet the requested power limits, it SHALL regenerate a new Power Forecast with a new ForecastId. * * @param constraints Sequence of turn up/down power requests that the ESA is being asked to constrain its operation within. - * @return Success if successfull, otherwise the command SHALL be rejected returning other IM_Statuss. + * @return Success if successful, otherwise the command SHALL be rejected returning other IM_Status. */ virtual Status RequestConstraintBasedForecast(const DataModel::DecodableList & constraints) = 0; From 21300701ff6a062aa94bf03fef8e1fa4ef1ffdb9 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 18:25:54 +0000 Subject: [PATCH 031/143] Turned on commands in DEM. Added DEM cluster server to energy-management-app. --- .../all-clusters-app.matter | 8 + .../all-clusters-common/all-clusters-app.zap | 73 ++++- .../energy-management-app.matter | 207 ++++++++++++ .../energy-management-app.zap | 307 ++++++++++++++++++ 4 files changed, 587 insertions(+), 8 deletions(-) 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 7607c5539c6c45..624de7a93a51b8 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 @@ -7519,6 +7519,14 @@ endpoint 1 { callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 2; + + handle command PowerAdjustRequest; + handle command CancelPowerAdjustRequest; + handle command StartTimeAdjustRequest; + handle command PauseRequest; + handle command ResumeRequest; + handle command ModifyForecastRequest; + handle command RequestConstraintBasedForecast; } server cluster EnergyEvse { 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 741c7491c5b707..e07bd514d324df 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 @@ -11737,6 +11737,64 @@ "side": "server", "enabled": 1, "apiMaturity": "provisional", + "commands": [ + { + "name": "PowerAdjustRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CancelPowerAdjustRequest", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StartTimeAdjustRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "PauseRequest", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ResumeRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ModifyForecastRequest", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RequestConstraintBasedForecast", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], "attributes": [ { "name": "ESAType", @@ -11828,7 +11886,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11844,7 +11902,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11860,7 +11918,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11876,7 +11934,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11892,7 +11950,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11908,7 +11966,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12549,8 +12607,7 @@ "maxInterval": 65534, "reportableChange": 0 } - ], - "events": [] + ] }, { "name": "Window Covering", 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 0452ec58d3eef8..3e841739756f22 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 @@ -900,6 +900,185 @@ cluster GroupKeyManagement = 63 { fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4; } +/** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */ +provisional cluster DeviceEnergyManagement = 152 { + revision 1; // NOTE: Default/not specifically set + + enum CauseEnum : enum8 { + kNormalCompletion = 0; + kOffline = 1; + kFault = 2; + kUserOptOut = 3; + } + + enum CostTypeEnum : enum8 { + kFinancial = 0; + kGHGEmissions = 1; + kComfort = 2; + kTemperature = 3; + } + + enum ESAStateEnum : enum8 { + kOffline = 0; + kOnline = 1; + kFault = 2; + kUserOptOut = 3; + kPowerAdjustActive = 4; + kPaused = 5; + } + + enum ESATypeEnum : enum8 { + kEVSE = 0; + kSpaceHeating = 1; + kWaterHeating = 2; + kSpaceCooling = 3; + kSpaceHeatingCooling = 4; + kBatteryStorage = 5; + kSolarPV = 6; + kFridgeFreezer = 7; + kWashingMachine = 8; + kDishwasher = 9; + kCooking = 10; + kHomeWaterPump = 11; + kIrrigationWaterPump = 12; + kPoolPump = 13; + kOther = 255; + } + + bitmap Feature : bitmap32 { + kPowerAdjustment = 0x1; + kPowerForecastReporting = 0x2; + kStateForecastReporting = 0x4; + kForecastAdjustment = 0x8; + } + + struct CostStruct { + CostTypeEnum costType = 0; + int32s value = 1; + int8u decimalPoints = 2; + optional int16u currency = 3; + } + + struct SlotStruct { + elapsed_s minDuration = 0; + elapsed_s maxDuration = 1; + elapsed_s defaultDuration = 2; + elapsed_s elapsedSlotTime = 3; + elapsed_s remainingSlotTime = 4; + boolean slotIsPauseable = 5; + elapsed_s minPauseDuration = 6; + elapsed_s maxPauseDuration = 7; + optional int16u manufacturerESAState = 8; + optional power_mw nominalPower = 9; + optional power_mw minPower = 10; + optional power_mw maxPower = 11; + optional energy_mwh nominalEnergy = 12; + optional CostStruct costs[] = 13; + optional power_mw minPowerAdjustment = 14; + optional power_mw maxPowerAdjustment = 15; + optional elapsed_s minDurationAdjustment = 16; + optional elapsed_s maxDurationAdjustment = 17; + } + + struct ForecastStruct { + int16u forecastId = 0; + nullable int16u activeSlotNumber = 1; + epoch_s startTime = 2; + epoch_s endTime = 3; + optional nullable epoch_s earliestStartTime = 4; + optional epoch_s latestEndTime = 5; + boolean isPauseable = 6; + SlotStruct slots[] = 7; + } + + struct ConstraintsStruct { + epoch_s startTime = 0; + elapsed_s duration = 1; + optional power_mw nominalPower = 2; + optional energy_mwh maximumEnergy = 3; + optional int8s loadControl = 4; + } + + struct PowerAdjustStruct { + power_mw minPower = 0; + power_mw maxPower = 1; + elapsed_s minDuration = 2; + elapsed_s maxDuration = 3; + } + + struct SlotAdjustmentStruct { + int8u slotIndex = 0; + power_mw nominalPower = 1; + elapsed_s duration = 2; + } + + info event PowerAdjustStart = 0 { + } + + info event PowerAdjustEnd = 1 { + CauseEnum cause = 0; + elapsed_s duration = 1; + energy_mwh energyUse = 2; + } + + info event Paused = 2 { + } + + info event Resumed = 3 { + } + + readonly attribute ESATypeEnum ESAType = 0; + readonly attribute boolean ESACanGenerate = 1; + readonly attribute ESAStateEnum ESAState = 2; + readonly attribute power_mw absMinPower = 3; + readonly attribute power_mw absMaxPower = 4; + readonly attribute optional nullable PowerAdjustStruct powerAdjustmentCapability[] = 5; + readonly attribute optional nullable ForecastStruct forecast = 6; + 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; + + request struct PowerAdjustRequestRequest { + power_mw power = 0; + elapsed_s duration = 1; + } + + request struct StartTimeAdjustRequestRequest { + epoch_s requestedStartTime = 0; + } + + request struct PauseRequestRequest { + elapsed_s duration = 0; + } + + request struct ModifyForecastRequestRequest { + int32u forecastId = 0; + SlotAdjustmentStruct slotAdjustments[] = 1; + } + + request struct RequestConstraintBasedForecastRequest { + ConstraintsStruct constraints[] = 0; + } + + /** Allows a client to request an adjustment in the power consumption of an ESA for a specified duration. */ + command PowerAdjustRequest(PowerAdjustRequestRequest): DefaultSuccess = 0; + /** Allows a client to cancel an ongoing PowerAdjustmentRequest operation. */ + command CancelPowerAdjustRequest(): DefaultSuccess = 1; + /** Allows a client to adjust the start time of a Forecast sequence that has not yet started operation (i.e. where the current Forecast StartTime is in the future). */ + command StartTimeAdjustRequest(StartTimeAdjustRequestRequest): DefaultSuccess = 2; + /** Allows a client to temporarily pause an operation and reduce the ESAs energy demand. */ + command PauseRequest(PauseRequestRequest): DefaultSuccess = 3; + /** Allows a client to cancel the PauseRequest command and enable earlier resumption of operation. */ + command ResumeRequest(): DefaultSuccess = 4; + /** Allows a client to modify a Forecast within the limits allowed by the ESA. */ + command ModifyForecastRequest(ModifyForecastRequestRequest): DefaultSuccess = 5; + /** Allows a client to ask the ESA to recompute its Forecast based on power and time constraints. */ + command RequestConstraintBasedForecast(RequestConstraintBasedForecastRequest): DefaultSuccess = 6; +} + /** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */ provisional cluster EnergyEvse = 153 { revision 1; // NOTE: Default/not specifically set @@ -1290,6 +1469,34 @@ endpoint 1 { callback attribute clusterRevision; } + server cluster DeviceEnergyManagement { + emits event PowerAdjustStart; + emits event PowerAdjustEnd; + emits event Paused; + emits event Resumed; + callback attribute ESAType default = 0; + callback attribute ESACanGenerate default = 0; + callback attribute ESAState default = 0; + callback attribute absMinPower default = 0; + callback attribute absMaxPower default = 0; + callback attribute powerAdjustmentCapability; + callback attribute forecast; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + + handle command PowerAdjustRequest; + handle command CancelPowerAdjustRequest; + handle command StartTimeAdjustRequest; + handle command PauseRequest; + handle command ResumeRequest; + handle command ModifyForecastRequest; + handle command RequestConstraintBasedForecast; + } + server cluster EnergyEvse { emits event EVConnected; emits event EVNotDetected; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index 55d62101227dab..b7d2271cea5b8b 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -2517,6 +2517,313 @@ } ] }, + { + "name": "Device Energy Management", + "code": 152, + "mfgCode": null, + "define": "DEVICE_ENERGY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "PowerAdjustRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CancelPowerAdjustRequest", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StartTimeAdjustRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "PauseRequest", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ResumeRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ModifyForecastRequest", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RequestConstraintBasedForecast", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "ESAType", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "ESATypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ESACanGenerate", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ESAState", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "ESAStateEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AbsMinPower", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AbsMaxPower", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PowerAdjustmentCapability", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Forecast", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "ForecastStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "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": "", + "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": "", + "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": "", + "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": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "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": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "PowerAdjustStart", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "PowerAdjustEnd", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Paused", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Resumed", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, { "name": "Energy EVSE", "code": 153, From b66fd0e1641ae9a8fad9b2e32e8b33761479d6d5 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 18:26:52 +0000 Subject: [PATCH 032/143] Added more comments to Delegate to describe expected behaviour. --- .../DeviceEnergyManagementDelegateImpl.cpp | 111 ++++++++++++++++-- .../DeviceEnergyManagementDelegateImpl.cpp | 111 ++++++++++++++++-- 2 files changed, 208 insertions(+), 14 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp index d707ba48b54754..74ad9e9e23f47a 100644 --- a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -32,6 +32,23 @@ using chip::Optional; using namespace chip::app; using CostsList = DataModel::List; +/** + * @brief Delegate handler for PowerAdjustRequest + * + * Note: checking of the validity of the PowerAdjustRequest has been done by the lower layer + * + * This function needs to notify the appliance that it should apply a new power setting. + * It should: + * 1) notify the appliance - if the appliance hardware cannot be adjusted, then return Failure + * 2) start a timer (or restart the existing PowerAdjust timer) for duration seconds + * 3) generate a PowerAdjustStart event (if there is not an existing PowerAdjustRequest running) + * 4) if appropriate, update the forecast with the new expected end time + * + * and when the timer expires: + * 5) notify the appliance's that it can resume its intended power setting (or go idle) + * 6) generate a PowerAdjustEnd event with cause NormalCompletion + * 7) if necessary, update the forecast with new expected end time + */ Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, const uint32_t duration) { Status status = Status::UnsupportedCommand; // Status::Success; @@ -46,7 +63,18 @@ Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, c return status; } +/** + * @brief Delegate handler for CancelPowerAdjustRequest + * + * Note: checking of the validity of the CancelPowerAdjustRequest has been done by the lower layer + * + * This function needs to notify the appliance that it should resume its intended power setting (or go idle). + * It should: + * 1) notify the appliance's that it can resume its intended power setting (or go idle) + * 2) generate a PowerAdjustEnd event with cause code Cancelled + * 3) if necessary, update the forecast with new expected end time + */ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() { Status status = Status::UnsupportedCommand; // Status::Success; @@ -59,6 +87,17 @@ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() return status; } +/** + * @brief Delegate handler for StartTimeAdjustRequest + * + * Note: checking of the validity of the StartTimeAdjustRequest has been done by the lower layer + * + * This function needs to notify the appliance that the forecast has been updated by a client. + * + * It should: + * 1) update the forecast attribute with the revised start time + * 2) send a callback notification to the appliance so it can refresh its internal schedule + */ Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime) { DataModel::Nullable forecast = GetForecast(); @@ -76,39 +115,97 @@ Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t req SetForecast(forecast); // This will increment forecast ID + // TODO: callback to the appliance to notify it of a new start time + return Status::Success; } - +/** + * @brief Delegate handler for Pause Request + * + * Note: checking of the validity of the Pause Request has been done by the lower layer + * + * This function needs to notify the appliance that it should now pause. + * It should: + * 1) pause the appliance - if the appliance hardware cannot be paused, then return Failure + * 2) start a timer for duration seconds + * 3) generate a Paused event + * 4) update the forecast with the new expected end time + * + * and when the timer expires: + * 5) restore the appliance's operational state + * 6) generate a Resumed event + * 7) if necessary, update the forecast with new expected end time + */ Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration) { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement + // TODO: implement the behaviour above return status; } +/** + * @brief Delegate handler for ResumeRequest + * + * Note: checking of the validity of the ResumeRequest has been done by the lower layer + * + * This function needs to notify the appliance that it should now resume operation + * + * It should: + * 1) restore the appliance's operational state + * 2) generate a Resumed event + * 3) update the forecast with new expected end time (given that the pause duration was shorter than originally requested) + * + */ Status DeviceEnergyManagementDelegate::ResumeRequest() { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement - mEsaState = ESAStateEnum::kOnline; - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + // TODO: implement the behaviour above + SetESAState(ESAStateEnum::kOnline); return status; } +/** + * @brief Delegate handler for ModifyForecastRequest + * + * Note: Only basic checking of the validity of the ModifyForecastRequest has been + * done by the lower layer. This is a more complex use-case and requires higher-level + * work by the delegate. + * + * It should: + * 1) determine if the new forecast adjustments are acceptable to the appliance + * - if not return Failure. For example, if it may cause the home to be too hot + * or too cold, or a battery to be insufficiently charged + * 2) if the slot adjustments are acceptable, then update the forecast + * 3) notify the appliance to follow the revised schedule + */ Status DeviceEnergyManagementDelegate::ModifyForecastRequest( const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement + + // TODO: implement the behaviour above return status; } +/** + * @brief Delegate handler for RequestConstraintBasedForecast + * + * Note: Only basic checking of the validity of the RequestConstraintBasedForecast has been + * done by the lower layer. This is a more complex use-case and requires higher-level + * work by the delegate. + * + * It should: + * 1) perform a higher level optimization (e.g. using tariff information, and user preferences) + * 2) if a solution can be found, then update the forecast, else return Failure + * 3) notify the appliance to follow the revised schedule + */ Status DeviceEnergyManagementDelegate::RequestConstraintBasedForecast( const DataModel::DecodableList & constraints) { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement + // TODO: implement the behaviour above return status; } diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp index d707ba48b54754..74ad9e9e23f47a 100644 --- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -32,6 +32,23 @@ using chip::Optional; using namespace chip::app; using CostsList = DataModel::List; +/** + * @brief Delegate handler for PowerAdjustRequest + * + * Note: checking of the validity of the PowerAdjustRequest has been done by the lower layer + * + * This function needs to notify the appliance that it should apply a new power setting. + * It should: + * 1) notify the appliance - if the appliance hardware cannot be adjusted, then return Failure + * 2) start a timer (or restart the existing PowerAdjust timer) for duration seconds + * 3) generate a PowerAdjustStart event (if there is not an existing PowerAdjustRequest running) + * 4) if appropriate, update the forecast with the new expected end time + * + * and when the timer expires: + * 5) notify the appliance's that it can resume its intended power setting (or go idle) + * 6) generate a PowerAdjustEnd event with cause NormalCompletion + * 7) if necessary, update the forecast with new expected end time + */ Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, const uint32_t duration) { Status status = Status::UnsupportedCommand; // Status::Success; @@ -46,7 +63,18 @@ Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, c return status; } +/** + * @brief Delegate handler for CancelPowerAdjustRequest + * + * Note: checking of the validity of the CancelPowerAdjustRequest has been done by the lower layer + * + * This function needs to notify the appliance that it should resume its intended power setting (or go idle). + * It should: + * 1) notify the appliance's that it can resume its intended power setting (or go idle) + * 2) generate a PowerAdjustEnd event with cause code Cancelled + * 3) if necessary, update the forecast with new expected end time + */ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() { Status status = Status::UnsupportedCommand; // Status::Success; @@ -59,6 +87,17 @@ Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() return status; } +/** + * @brief Delegate handler for StartTimeAdjustRequest + * + * Note: checking of the validity of the StartTimeAdjustRequest has been done by the lower layer + * + * This function needs to notify the appliance that the forecast has been updated by a client. + * + * It should: + * 1) update the forecast attribute with the revised start time + * 2) send a callback notification to the appliance so it can refresh its internal schedule + */ Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime) { DataModel::Nullable forecast = GetForecast(); @@ -76,39 +115,97 @@ Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t req SetForecast(forecast); // This will increment forecast ID + // TODO: callback to the appliance to notify it of a new start time + return Status::Success; } - +/** + * @brief Delegate handler for Pause Request + * + * Note: checking of the validity of the Pause Request has been done by the lower layer + * + * This function needs to notify the appliance that it should now pause. + * It should: + * 1) pause the appliance - if the appliance hardware cannot be paused, then return Failure + * 2) start a timer for duration seconds + * 3) generate a Paused event + * 4) update the forecast with the new expected end time + * + * and when the timer expires: + * 5) restore the appliance's operational state + * 6) generate a Resumed event + * 7) if necessary, update the forecast with new expected end time + */ Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration) { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement + // TODO: implement the behaviour above return status; } +/** + * @brief Delegate handler for ResumeRequest + * + * Note: checking of the validity of the ResumeRequest has been done by the lower layer + * + * This function needs to notify the appliance that it should now resume operation + * + * It should: + * 1) restore the appliance's operational state + * 2) generate a Resumed event + * 3) update the forecast with new expected end time (given that the pause duration was shorter than originally requested) + * + */ Status DeviceEnergyManagementDelegate::ResumeRequest() { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement - mEsaState = ESAStateEnum::kOnline; - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); + + // TODO: implement the behaviour above + SetESAState(ESAStateEnum::kOnline); return status; } +/** + * @brief Delegate handler for ModifyForecastRequest + * + * Note: Only basic checking of the validity of the ModifyForecastRequest has been + * done by the lower layer. This is a more complex use-case and requires higher-level + * work by the delegate. + * + * It should: + * 1) determine if the new forecast adjustments are acceptable to the appliance + * - if not return Failure. For example, if it may cause the home to be too hot + * or too cold, or a battery to be insufficiently charged + * 2) if the slot adjustments are acceptable, then update the forecast + * 3) notify the appliance to follow the revised schedule + */ Status DeviceEnergyManagementDelegate::ModifyForecastRequest( const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement + + // TODO: implement the behaviour above return status; } +/** + * @brief Delegate handler for RequestConstraintBasedForecast + * + * Note: Only basic checking of the validity of the RequestConstraintBasedForecast has been + * done by the lower layer. This is a more complex use-case and requires higher-level + * work by the delegate. + * + * It should: + * 1) perform a higher level optimization (e.g. using tariff information, and user preferences) + * 2) if a solution can be found, then update the forecast, else return Failure + * 3) notify the appliance to follow the revised schedule + */ Status DeviceEnergyManagementDelegate::RequestConstraintBasedForecast( const DataModel::DecodableList & constraints) { Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement + // TODO: implement the behaviour above return status; } From 622424683c8bb2978e3db27121a9c5edb02b5bbc Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 21:46:18 +0000 Subject: [PATCH 033/143] Updated BUILD.gn to remove duplicated files from all-clusters-common and energy-management-common --- .../DeviceEnergyManagementDelegateImpl.h | 83 -- .../include/DeviceEnergyManagementManager.h | 57 -- .../include/EVSECallbacks.h | 84 -- .../include/EnergyEvseDelegateImpl.h | 206 ----- .../include/EnergyEvseManager.h | 57 -- .../DeviceEnergyManagementDelegateImpl.cpp | 398 -------- .../src/DeviceEnergyManagementManager.cpp | 33 - .../src/EnergyEvseDelegateImpl.cpp | 847 ------------------ .../src/EnergyEvseManager.cpp | 33 - examples/all-clusters-app/linux/BUILD.gn | 14 +- 10 files changed, 8 insertions(+), 1804 deletions(-) delete mode 100644 examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h delete mode 100644 examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h delete mode 100644 examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h delete mode 100644 examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h delete mode 100644 examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h delete mode 100644 examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp delete mode 100644 examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp delete mode 100644 examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp delete mode 100644 examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h deleted file mode 100644 index 464a683510b3d7..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementDelegateImpl.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "app/clusters/device-energy-management-server/device-energy-management-server.h" - -#include -#include -#include - -using chip::Protocols::InteractionModel::Status; -namespace chip { -namespace app { -namespace Clusters { -namespace DeviceEnergyManagement { - -/** - * The application delegate. - */ -class DeviceEnergyManagementDelegate : public DeviceEnergyManagement::Delegate -{ -public: - virtual Status PowerAdjustRequest(const int64_t power, const uint32_t duration) override; - virtual Status CancelPowerAdjustRequest() override; - virtual Status StartTimeAdjustRequest(const uint32_t requestedStartTime) override; - virtual Status PauseRequest(const uint32_t duration) override; - virtual Status ResumeRequest() override; - virtual Status - ModifyForecastRequest(const uint32_t forecastId, - const DataModel::DecodableList & slotAdjustments) override; - virtual Status RequestConstraintBasedForecast( - const DataModel::DecodableList & constraints) override; - - // ------------------------------------------------------------------ - // Get attribute methods - virtual ESATypeEnum GetESAType() override; - virtual bool GetESACanGenerate() override; - virtual ESAStateEnum GetESAState() override; - virtual int64_t GetAbsMinPower() override; - virtual int64_t GetAbsMaxPower() override; - virtual Attributes::PowerAdjustmentCapability::TypeInfo::Type GetPowerAdjustmentCapability() override; - virtual DataModel::Nullable GetForecast() override; - - // ------------------------------------------------------------------ - // Set attribute methods - virtual CHIP_ERROR SetESAType(ESATypeEnum) override; - virtual CHIP_ERROR SetESACanGenerate(bool) override; - virtual CHIP_ERROR SetESAState(ESAStateEnum) override; - virtual CHIP_ERROR SetAbsMinPower(int64_t) override; - virtual CHIP_ERROR SetAbsMaxPower(int64_t) override; - virtual CHIP_ERROR SetPowerAdjustmentCapability(Attributes::PowerAdjustmentCapability::TypeInfo::Type) override; - virtual CHIP_ERROR SetForecast(DataModel::Nullable) override; - -private: - ESATypeEnum mEsaType; - bool mEsaCanGenerate; - ESAStateEnum mEsaState; - int64_t mAbsMinPower; - int64_t mAbsMaxPower; - Attributes::PowerAdjustmentCapability::TypeInfo::Type mPowerAdjustmentCapability; - DataModel::Nullable mForecast; -}; - -} // namespace DeviceEnergyManagement -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h b/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h deleted file mode 100644 index 6d131dd4ae90fa..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/include/DeviceEnergyManagementManager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include - -namespace chip { -namespace app { -namespace Clusters { - -using namespace chip::app::Clusters::DeviceEnergyManagement; -class DeviceEnergyManagementManager : public Instance -{ -public: - DeviceEnergyManagementManager(EndpointId aEndpointId, DeviceEnergyManagementDelegate & aDelegate, Feature aFeature, - OptionalCommands aOptionalCmds) : - DeviceEnergyManagement::Instance(aEndpointId, aDelegate, aFeature, aOptionalCmds) - { - mDelegate = &aDelegate; - } - - // Delete copy constructor and assignment operator. - DeviceEnergyManagementManager(const DeviceEnergyManagementManager &) = delete; - DeviceEnergyManagementManager(const DeviceEnergyManagementManager &&) = delete; - DeviceEnergyManagementManager & operator=(const DeviceEnergyManagementManager &) = delete; - - CHIP_ERROR Init(); - void Shutdown(); - - DeviceEnergyManagementDelegate * GetDelegate() { return mDelegate; }; - -private: - DeviceEnergyManagementDelegate * mDelegate; -}; - -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h b/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h deleted file mode 100644 index 5bdac2f8e853d6..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/include/EVSECallbacks.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -namespace chip { -namespace app { -namespace Clusters { - -using namespace chip::app::Clusters::EnergyEvse; - -/* This callbacks mechanism is intended to allow different delegates to - * dispatch notifications that something has changed. - * - * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement - * and potential future clusters. - */ -enum EVSECallbackType -{ - /* - * The State has changed (e.g. from Disabled to Charging, or vice-versa) - */ - StateChanged, - /* - * ChargeCurrent has changed - */ - ChargeCurrentChanged, - /* - * Charging Preferences have changed - */ - ChargingPreferencesChanged, - /* - * DeviceEnergyManagement has changed - */ - DeviceEnergyManagementChanged, -}; - -struct EVSECbInfo -{ - EVSECallbackType type; - - union - { - /* for type = StateChanged */ - struct - { - StateEnum state; - SupplyStateEnum supplyState; - } StateChange; - - /* for type = ChargeCurrentChanged */ - struct - { - int64_t maximumChargeCurrent; - } ChargingCurrent; - }; -}; - -typedef void (*EVSECallbackFunc)(const EVSECbInfo * cb, intptr_t arg); - -struct EVSECallbackWrapper -{ - EVSECallbackFunc handler; - intptr_t arg; -}; - -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h deleted file mode 100644 index f3c003d081fc6e..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseDelegateImpl.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "app/clusters/energy-evse-server/energy-evse-server.h" -#include - -#include -#include -#include - -using chip::Protocols::InteractionModel::Status; -namespace chip { -namespace app { -namespace Clusters { -namespace EnergyEvse { - -/** - * The application delegate. - */ - -class EnergyEvseDelegate : public EnergyEvse::Delegate -{ -public: - ~EnergyEvseDelegate(); - - /** - * @brief Called when EVSE cluster receives Disable command - */ - Status Disable() override; - - /** - * @brief Called when EVSE cluster receives EnableCharging command - * - * @param chargingEnabledUntil - * @param minimumChargeCurrent (in mA) - * @param maximumChargeCurrent (in mA) - */ - Status EnableCharging(const DataModel::Nullable & chargingEnabledUntil, const int64_t & minimumChargeCurrent, - const int64_t & maximumChargeCurrent) override; - - /** - * @brief Called when EVSE cluster receives EnableDischarging command - * - * @param dischargingEnabledUntil - * @param maximumChargeCurrent (in mA) - */ - Status EnableDischarging(const DataModel::Nullable & dischargingEnabledUntil, - const int64_t & maximumDischargeCurrent) override; - - /** - * @brief Called when EVSE cluster receives StartDiagnostics command - */ - Status StartDiagnostics() override; - - /** - * @brief Called by EVSE Hardware to register a single callback handler - */ - Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg); - - // ----------------------------------------------------------------- - // Internal API to allow an EVSE to change its internal state etc - Status HwSetMaxHardwareCurrentLimit(int64_t currentmA); - Status HwSetCircuitCapacity(int64_t currentmA); - Status HwSetCableAssemblyLimit(int64_t currentmA); - Status HwSetState(StateEnum state); - Status HwSetFault(FaultStateEnum fault); - Status HwSetRFID(ByteSpan uid); - Status HwSetVehicleID(const CharSpan & vehID); - - // ------------------------------------------------------------------ - // Get attribute methods - StateEnum GetState() override; - CHIP_ERROR SetState(StateEnum); - - SupplyStateEnum GetSupplyState() override; - CHIP_ERROR SetSupplyState(SupplyStateEnum); - - FaultStateEnum GetFaultState() override; - CHIP_ERROR SetFaultState(FaultStateEnum); - - DataModel::Nullable GetChargingEnabledUntil() override; - CHIP_ERROR SetChargingEnabledUntil(uint32_t); - - DataModel::Nullable GetDischargingEnabledUntil() override; - CHIP_ERROR SetDischargingEnabledUntil(uint32_t); - - int64_t GetCircuitCapacity() override; - CHIP_ERROR SetCircuitCapacity(int64_t); - - int64_t GetMinimumChargeCurrent() override; - CHIP_ERROR SetMinimumChargeCurrent(int64_t); - - int64_t GetMaximumChargeCurrent() override; - CHIP_ERROR SetMaximumChargeCurrent(int64_t); - - int64_t GetMaximumDischargeCurrent() override; - CHIP_ERROR SetMaximumDischargeCurrent(int64_t); - - int64_t GetUserMaximumChargeCurrent() override; - CHIP_ERROR SetUserMaximumChargeCurrent(int64_t) override; - - uint32_t GetRandomizationDelayWindow() override; - CHIP_ERROR SetRandomizationDelayWindow(uint32_t) override; - - /* PREF attributes */ - uint8_t GetNumberOfWeeklyTargets() override; - uint8_t GetNumberOfDailyTargets() override; - DataModel::Nullable GetNextChargeStartTime() override; - DataModel::Nullable GetNextChargeTargetTime() override; - DataModel::Nullable GetNextChargeRequiredEnergy() override; - DataModel::Nullable GetNextChargeTargetSoC() override; - - DataModel::Nullable GetApproximateEVEfficiency() override; - CHIP_ERROR SetApproximateEVEfficiency(uint16_t) override; - - /* SOC attributes */ - DataModel::Nullable GetStateOfCharge() override; - DataModel::Nullable GetBatteryCapacity() override; - /* PNC attributes*/ - DataModel::Nullable GetVehicleID() override; - /* Session SESS attributes */ - DataModel::Nullable GetSessionID() override; - DataModel::Nullable GetSessionDuration() override; - DataModel::Nullable GetSessionEnergyCharged() override; - DataModel::Nullable GetSessionEnergyDischarged() override; - -private: - /* Constants */ - static constexpr int DEFAULT_MIN_CHARGE_CURRENT = 6000; /* 6A */ - static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */ - static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW = 600; /* 600s */ - static constexpr int kMaxVehicleIDBufSize = 32; - - /* private variables for controlling the hardware - these are not attributes */ - int64_t mMaxHardwareCurrentLimit = 0; /* Hardware current limit in mA */ - int64_t mCableAssemblyCurrentLimit = 0; /* Cable limit detected when cable is plugged in, in mA */ - int64_t mMaximumChargingCurrentLimitFromCommand = 0; /* Value of current maximum limit when charging enabled */ - int64_t mActualChargingCurrentLimit = 0; - StateEnum mHwState = StateEnum::kNotPluggedIn; /* Hardware state */ - - /* Callback related */ - EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */ - Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent); - Status NotifyApplicationStateChange(); - - /** - * @brief Helper function to work out the charge limit based on conditions and settings - */ - Status ComputeMaxChargeCurrentLimit(); - - /* Attributes */ - StateEnum mState = StateEnum::kNotPluggedIn; - SupplyStateEnum mSupplyState = SupplyStateEnum::kDisabled; - FaultStateEnum mFaultState = FaultStateEnum::kNoError; - DataModel::Nullable mChargingEnabledUntil; // TODO Default to 0 to indicate disabled - DataModel::Nullable mDischargingEnabledUntil; // TODO Default to 0 to indicate disabled - int64_t mCircuitCapacity = 0; - int64_t mMinimumChargeCurrent = DEFAULT_MIN_CHARGE_CURRENT; - int64_t mMaximumChargeCurrent = 0; - int64_t mMaximumDischargeCurrent = 0; - int64_t mUserMaximumChargeCurrent = DEFAULT_USER_MAXIMUM_CHARGE_CURRENT; // TODO update spec - uint32_t mRandomizationDelayWindow = DEFAULT_RANDOMIZATION_DELAY_WINDOW; - /* PREF attributes */ - uint8_t mNumberOfWeeklyTargets = 0; - uint8_t mNumberOfDailyTargets = 1; - DataModel::Nullable mNextChargeStartTime; - DataModel::Nullable mNextChargeTargetTime; - DataModel::Nullable mNextChargeRequiredEnergy; - DataModel::Nullable mNextChargeTargetSoC; - DataModel::Nullable mApproximateEVEfficiency; - - /* SOC attributes */ - DataModel::Nullable mStateOfCharge; - DataModel::Nullable mBatteryCapacity; - - /* PNC attributes*/ - DataModel::Nullable mVehicleID; - - /* Session SESS attributes */ - DataModel::Nullable mSessionID; - DataModel::Nullable mSessionDuration; - DataModel::Nullable mSessionEnergyCharged; - DataModel::Nullable mSessionEnergyDischarged; -}; - -} // namespace EnergyEvse -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h b/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h deleted file mode 100644 index 9875c397990ef2..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/include/EnergyEvseManager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include - -namespace chip { -namespace app { -namespace Clusters { - -using namespace chip::app::Clusters::EnergyEvse; -class EnergyEvseManager : public Instance -{ -public: - EnergyEvseManager(EndpointId aEndpointId, EnergyEvseDelegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs, - OptionalCommands aOptionalCmds) : - EnergyEvse::Instance(aEndpointId, aDelegate, aFeature, aOptionalAttrs, aOptionalCmds) - { - mDelegate = &aDelegate; - } - - // Delete copy constructor and assignment operator. - EnergyEvseManager(const EnergyEvseManager &) = delete; - EnergyEvseManager(const EnergyEvseManager &&) = delete; - EnergyEvseManager & operator=(const EnergyEvseManager &) = delete; - - CHIP_ERROR Init(); - void Shutdown(); - - EnergyEvseDelegate * GetDelegate() { return mDelegate; }; - -private: - EnergyEvseDelegate * mDelegate; -}; - -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp deleted file mode 100644 index 74ad9e9e23f47a..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ /dev/null @@ -1,398 +0,0 @@ -/* - * - * 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 "DeviceEnergyManagementDelegateImpl.h" - -#include -#include -#include - -using namespace chip; -using namespace chip::app; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::DeviceEnergyManagement; -using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; - -using chip::Optional; -using namespace chip::app; -using CostsList = DataModel::List; - -/** - * @brief Delegate handler for PowerAdjustRequest - * - * Note: checking of the validity of the PowerAdjustRequest has been done by the lower layer - * - * This function needs to notify the appliance that it should apply a new power setting. - * It should: - * 1) notify the appliance - if the appliance hardware cannot be adjusted, then return Failure - * 2) start a timer (or restart the existing PowerAdjust timer) for duration seconds - * 3) generate a PowerAdjustStart event (if there is not an existing PowerAdjustRequest running) - * 4) if appropriate, update the forecast with the new expected end time - * - * and when the timer expires: - * 5) notify the appliance's that it can resume its intended power setting (or go idle) - * 6) generate a PowerAdjustEnd event with cause NormalCompletion - * 7) if necessary, update the forecast with new expected end time - */ -Status DeviceEnergyManagementDelegate::PowerAdjustRequest(const int64_t power, const uint32_t duration) -{ - Status status = Status::UnsupportedCommand; // Status::Success; - - // TODO: implement - mEsaState = ESAStateEnum::kPowerAdjustActive; - - // TODO: Generate a PowerAdjustStart Event, then begins to adjust its power - // When done, raise PowerAdjustEnd & ESAState set to kOnline. - - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); - - return status; -} -/** - * @brief Delegate handler for CancelPowerAdjustRequest - * - * Note: checking of the validity of the CancelPowerAdjustRequest has been done by the lower layer - * - * This function needs to notify the appliance that it should resume its intended power setting (or go idle). - - * It should: - * 1) notify the appliance's that it can resume its intended power setting (or go idle) - * 2) generate a PowerAdjustEnd event with cause code Cancelled - * 3) if necessary, update the forecast with new expected end time - */ -Status DeviceEnergyManagementDelegate::CancelPowerAdjustRequest() -{ - Status status = Status::UnsupportedCommand; // Status::Success; - - // TODO: implement - /* TODO: If the command is accepted, the ESA SHALL generate an PowerAdjustEnd Event. */ - mEsaState = ESAStateEnum::kOnline; - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); - - return status; -} - -/** - * @brief Delegate handler for StartTimeAdjustRequest - * - * Note: checking of the validity of the StartTimeAdjustRequest has been done by the lower layer - * - * This function needs to notify the appliance that the forecast has been updated by a client. - * - * It should: - * 1) update the forecast attribute with the revised start time - * 2) send a callback notification to the appliance so it can refresh its internal schedule - */ -Status DeviceEnergyManagementDelegate::StartTimeAdjustRequest(const uint32_t requestedStartTime) -{ - DataModel::Nullable forecast = GetForecast(); - - if (forecast.IsNull()) - { - return Status::Failure; - } - - uint32_t duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration - - /* Modify start time and end time */ - forecast.Value().startTime = requestedStartTime; - forecast.Value().endTime = requestedStartTime + duration; - - SetForecast(forecast); // This will increment forecast ID - - // TODO: callback to the appliance to notify it of a new start time - - return Status::Success; -} -/** - * @brief Delegate handler for Pause Request - * - * Note: checking of the validity of the Pause Request has been done by the lower layer - * - * This function needs to notify the appliance that it should now pause. - * It should: - * 1) pause the appliance - if the appliance hardware cannot be paused, then return Failure - * 2) start a timer for duration seconds - * 3) generate a Paused event - * 4) update the forecast with the new expected end time - * - * and when the timer expires: - * 5) restore the appliance's operational state - * 6) generate a Resumed event - * 7) if necessary, update the forecast with new expected end time - */ -Status DeviceEnergyManagementDelegate::PauseRequest(const uint32_t duration) -{ - Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement the behaviour above - return status; -} - -/** - * @brief Delegate handler for ResumeRequest - * - * Note: checking of the validity of the ResumeRequest has been done by the lower layer - * - * This function needs to notify the appliance that it should now resume operation - * - * It should: - * 1) restore the appliance's operational state - * 2) generate a Resumed event - * 3) update the forecast with new expected end time (given that the pause duration was shorter than originally requested) - * - */ -Status DeviceEnergyManagementDelegate::ResumeRequest() -{ - Status status = Status::UnsupportedCommand; // Status::Success; - - // TODO: implement the behaviour above - SetESAState(ESAStateEnum::kOnline); - - return status; -} - -/** - * @brief Delegate handler for ModifyForecastRequest - * - * Note: Only basic checking of the validity of the ModifyForecastRequest has been - * done by the lower layer. This is a more complex use-case and requires higher-level - * work by the delegate. - * - * It should: - * 1) determine if the new forecast adjustments are acceptable to the appliance - * - if not return Failure. For example, if it may cause the home to be too hot - * or too cold, or a battery to be insufficiently charged - * 2) if the slot adjustments are acceptable, then update the forecast - * 3) notify the appliance to follow the revised schedule - */ -Status DeviceEnergyManagementDelegate::ModifyForecastRequest( - const uint32_t forecastId, const DataModel::DecodableList & slotAdjustments) -{ - Status status = Status::UnsupportedCommand; // Status::Success; - - // TODO: implement the behaviour above - return status; -} - -/** - * @brief Delegate handler for RequestConstraintBasedForecast - * - * Note: Only basic checking of the validity of the RequestConstraintBasedForecast has been - * done by the lower layer. This is a more complex use-case and requires higher-level - * work by the delegate. - * - * It should: - * 1) perform a higher level optimization (e.g. using tariff information, and user preferences) - * 2) if a solution can be found, then update the forecast, else return Failure - * 3) notify the appliance to follow the revised schedule - */ -Status DeviceEnergyManagementDelegate::RequestConstraintBasedForecast( - const DataModel::DecodableList & constraints) -{ - Status status = Status::UnsupportedCommand; // Status::Success; - // TODO: implement the behaviour above - return status; -} - -// ------------------------------------------------------------------ -// Get attribute methods -ESATypeEnum DeviceEnergyManagementDelegate::GetESAType() -{ - return mEsaType; -} - -bool DeviceEnergyManagementDelegate::GetESACanGenerate() -{ - return mEsaCanGenerate; -} - -ESAStateEnum DeviceEnergyManagementDelegate::GetESAState() -{ - return mEsaState; -} - -int64_t DeviceEnergyManagementDelegate::GetAbsMinPower() -{ - return mAbsMinPower; -} - -int64_t DeviceEnergyManagementDelegate::GetAbsMaxPower() -{ - return mAbsMaxPower; -} - -PowerAdjustmentCapability::TypeInfo::Type DeviceEnergyManagementDelegate::GetPowerAdjustmentCapability() -{ - return mPowerAdjustmentCapability; -} - -DataModel::Nullable DeviceEnergyManagementDelegate::GetForecast() -{ - return mForecast; -} - -// ------------------------------------------------------------------ -// Set attribute methods - -CHIP_ERROR DeviceEnergyManagementDelegate::SetESAType(ESATypeEnum newValue) -{ - ESATypeEnum oldValue = mEsaType; - - if (newValue >= ESATypeEnum::kUnknownEnumValue) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mEsaType = newValue; - if (oldValue != newValue) - { - ChipLogDetail(AppServer, "mEsaType updated to %d", static_cast(mEsaType)); - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAType::Id); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR DeviceEnergyManagementDelegate::SetESACanGenerate(bool newValue) -{ - bool oldValue = mEsaCanGenerate; - - mEsaCanGenerate = newValue; - if (oldValue != newValue) - { - ChipLogDetail(AppServer, "mEsaCanGenerate updated to %d", static_cast(mEsaCanGenerate)); - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESACanGenerate::Id); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR DeviceEnergyManagementDelegate::SetESAState(ESAStateEnum newValue) -{ - ESAStateEnum oldValue = mEsaState; - - if (newValue >= ESAStateEnum::kUnknownEnumValue) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mEsaState = newValue; - if (oldValue != newValue) - { - ChipLogDetail(AppServer, "mEsaState updated to %d", static_cast(mEsaState)); - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, ESAState::Id); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMinPower(int64_t newValue) -{ - int64_t oldValue = mAbsMinPower; - - mAbsMinPower = newValue; - if (oldValue != newValue) - { - ChipLogDetail(AppServer, "mAbsMinPower updated to %d", static_cast(mAbsMinPower)); - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMinPower::Id); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) -{ - int64_t oldValue = mAbsMaxPower; - - mAbsMaxPower = newValue; - if (oldValue != newValue) - { - ChipLogDetail(AppServer, "mAbsMaxPower updated to %d", static_cast(mAbsMaxPower)); - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, AbsMaxPower::Id); - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR -DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability(PowerAdjustmentCapability::TypeInfo::Type powerAdjustmentCapability) -{ - if (powerAdjustmentCapability.IsNull()) - { - mPowerAdjustmentCapability.SetNull(); - ChipLogDetail(AppServer, "null src - %s", __FUNCTION__); - } - else - { - auto src = powerAdjustmentCapability.Value(); - auto target = mPowerAdjustmentCapability.Value(); - auto size = src.size(); - - if (size > 8) - { - return CHIP_ERROR_BAD_REQUEST; - } - - target.reduce_size(0); - - for (size_t i = 0; i < size; i++) - { - const_cast(target[i]) = src[i]; - } - } - - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, PowerAdjustmentCapability::Id); - return CHIP_NO_ERROR; -} - -CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable forecast) -{ - if (forecast.IsNull()) - { - mForecast.SetNull(); - ChipLogDetail(AppServer, "null src - %s", __FUNCTION__); - } - else - { - auto src = forecast.Value(); - auto target = mForecast.Value(); - - target.forecastId++; - target.activeSlotNumber = src.activeSlotNumber; - target.startTime = src.startTime; - target.endTime = src.endTime; - target.earliestStartTime = src.earliestStartTime; - target.latestEndTime = src.latestEndTime; - target.isPauseable = src.isPauseable; - - auto slots = src.slots; - auto size = slots.size(); - target.slots.reduce_size(0); // clear them - ChipLogDetail(AppServer, "src.slots.size() %d - %s", (int) size, __FUNCTION__); - - for (size_t i = 0; i < size; i++) - { - const_cast(target.slots[i]) = - slots[i]; // TODO: test if this works for optional/nullable stuff - } - } - - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, Forecast::Id); - - return CHIP_NO_ERROR; -} diff --git a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp b/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp deleted file mode 100644 index c31e0624e4c743..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * 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::app; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::DeviceEnergyManagement; - -CHIP_ERROR DeviceEnergyManagementManager::Init() -{ - return Instance::Init(); -} - -void DeviceEnergyManagementManager::Shutdown() -{ - Instance::Shutdown(); -} diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp deleted file mode 100644 index 4cc83eaaf8a835..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp +++ /dev/null @@ -1,847 +0,0 @@ -/* - * - * 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 -#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::EnergyEvse; -using namespace chip::app::Clusters::EnergyEvse::Attributes; - -using chip::app::LogEvent; -using chip::Protocols::InteractionModel::Status; - -EnergyEvseDelegate::~EnergyEvseDelegate() -{ - // TODO Fix this as part of issue #30993 refactoring - if (!mVehicleID.IsNull()) - { - ChipLogDetail(AppServer, "Freeing VehicleID"); - delete[] mVehicleID.Value().data(); - } -} - -/** - * @brief Called when EVSE cluster receives Disable command - */ -Status EnergyEvseDelegate::Disable() -{ - ChipLogProgress(AppServer, "EnergyEvseDelegate::Disable()"); - - /* Update State */ - switch (mHwState) - { - case StateEnum::kNotPluggedIn: - SetState(StateEnum::kNotPluggedIn); - break; - - case StateEnum::kPluggedInNoDemand: - SetState(StateEnum::kPluggedInNoDemand); - break; - - case StateEnum::kPluggedInDemand: - SetState(StateEnum::kPluggedInDemand); - break; - - default: - ChipLogError(AppServer, "Unexpected EVSE hardware state"); - SetState(StateEnum::kFault); - break; - } - - /* update SupplyState */ - SetSupplyState(SupplyStateEnum::kDisabled); - - /* update ChargingEnabledUntil & DischargingEnabledUntil to show 0 */ - SetChargingEnabledUntil(0); - SetDischargingEnabledUntil(0); - - /* update MinimumChargeCurrent & MaximumChargeCurrent to 0 */ - SetMinimumChargeCurrent(0); - SetMaximumChargeCurrent(0); - - /* update MaximumDischargeCurrent to 0 */ - SetMaximumDischargeCurrent(0); - - NotifyApplicationStateChange(); - // TODO: Generate events - - return Status::Success; -} - -/** - * @brief Called when EVSE cluster receives EnableCharging command - * - * @param chargingEnabledUntil (can be null to indefinite charging) - * @param minimumChargeCurrent (in mA) - * @param maximumChargeCurrent (in mA) - */ -Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable & chargingEnabledUntil, - const int64_t & minimumChargeCurrent, const int64_t & maximumChargeCurrent) -{ - ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableCharging()"); - - if (maximumChargeCurrent < kMinimumChargeCurrent || maximumChargeCurrent > kMaximumChargeCurrent) - { - ChipLogError(AppServer, "Maximum Current outside limits"); - return Status::ConstraintError; - } - - if (minimumChargeCurrent < kMinimumChargeCurrent || minimumChargeCurrent > kMaximumChargeCurrent) - { - ChipLogError(AppServer, "Maximum Current outside limits"); - return Status::ConstraintError; - } - - if (minimumChargeCurrent > maximumChargeCurrent) - { - ChipLogError(AppServer, "Minium Current > Maximum Current!"); - return Status::ConstraintError; - } - - if (chargingEnabledUntil.IsNull()) - { - /* Charging enabled indefinitely */ - ChipLogError(AppServer, "Charging enabled indefinitely"); - } - else - { - /* check chargingEnabledUntil is in the future */ - ChipLogError(AppServer, "Charging enabled until: %lu", static_cast(chargingEnabledUntil.Value())); - // TODO - // if (checkChargingEnabled) - } - - /* Check current state isn't already enabled */ - - /* If charging is already enabled, check that the parameters may have - changed, these may override an existing charging command */ - switch (mHwState) - { - case StateEnum::kNotPluggedIn: - // TODO handle errors here - SetState(StateEnum::kNotPluggedIn); - break; - - case StateEnum::kPluggedInNoDemand: - // TODO handle errors here - // TODO REFACTOR per Andrei's comment in PR30857 - can we collapse this switch statement? - SetState(StateEnum::kPluggedInNoDemand); - break; - - case StateEnum::kPluggedInDemand: - /* If the EVSE is asking for demand then enable charging */ - SetState(StateEnum::kPluggedInCharging); - break; - - default: - ChipLogError(AppServer, "Unexpected EVSE hardware state"); - SetState(StateEnum::kFault); - break; - } - - /* update SupplyState to say that charging is now enabled */ - SetSupplyState(SupplyStateEnum::kChargingEnabled); - - /* If it looks ok, store the min & max charging current */ - mMaximumChargingCurrentLimitFromCommand = maximumChargeCurrent; - SetMinimumChargeCurrent(minimumChargeCurrent); - // TODO persist these to KVS - - // TODO: Generate events - - NotifyApplicationStateChange(); - - return this->ComputeMaxChargeCurrentLimit(); -} - -/** - * @brief Called when EVSE cluster receives EnableDischarging command - * - * @param dischargingEnabledUntil (can be null to indefinite discharging) - * @param maximumChargeCurrent (in mA) - */ -Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable & dischargingEnabledUntil, - const int64_t & maximumDischargeCurrent) -{ - ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called."); - - /* update SupplyState */ - SetSupplyState(SupplyStateEnum::kDischargingEnabled); - - // TODO: Generate events - - NotifyApplicationStateChange(); - - return Status::Success; -} - -/** - * @brief Called when EVSE cluster receives StartDiagnostics command - */ -Status EnergyEvseDelegate::StartDiagnostics() -{ - /* For EVSE manufacturers to customize */ - ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()"); - - /* update SupplyState to indicate we are now in Diagnostics mode */ - SetSupplyState(SupplyStateEnum::kDisabledDiagnostics); - - // TODO: Generate events - - // TODO: Notify Application to implement Diagnostics - - NotifyApplicationStateChange(); - - return Status::Success; -} - -/* --------------------------------------------------------------------------- - * EVSE Hardware interface below - */ - -/** - * @brief Called by EVSE Hardware to register a callback handler mechanism - * - * This is normally called at start-up. - * - * @param EVSECallbackFunct - function pointer to call - * @param intptr_t - optional context to provide back to callback handler - */ -Status EnergyEvseDelegate::HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg) -{ - if (mCallbacks.handler != nullptr) - { - ChipLogError(AppServer, "Callback handler already initialized"); - return Status::Failure; - } - mCallbacks.handler = handler; - mCallbacks.arg = arg; - - return Status::Success; -} - -/** - * @brief Called by EVSE Hardware to notify the delegate of the maximum - * current limit supported by the hardware. - * - * This is normally called at start-up. - * - * @param currentmA - Maximum current limit supported by the hardware - */ -Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA) -{ - if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent) - { - return Status::ConstraintError; - } - - /* there is no attribute to store this so store in private variable */ - mMaxHardwareCurrentLimit = currentmA; - - return this->ComputeMaxChargeCurrentLimit(); -} - -/** - * @brief Called by EVSE Hardware to notify the delegate of maximum electrician - * set current limit. - * - * This is normally called at start-up when reading from DIP-switch - * settings. - * - * @param currentmA - Maximum current limit specified by electrician - */ -Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA) -{ - if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent) - { - return Status::ConstraintError; - } - - mCircuitCapacity = currentmA; - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id); - - return this->ComputeMaxChargeCurrentLimit(); -} - -/** - * @brief Called by EVSE Hardware to notify the delegate of the cable assembly - * current limit. - * - * This is normally called when the EV is plugged into the EVSE and the - * PP voltage is measured by the EVSE. A pull-up resistor in the cable - * causes a voltage drop. Different current limits can be indicated - * using different resistors, which results in different voltages - * measured by the EVSE. - * - * @param currentmA - Maximum current limit detected from Cable assembly - */ -Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA) -{ - if (currentmA < kMinimumChargeCurrent || currentmA > kMaximumChargeCurrent) - { - return Status::ConstraintError; - } - - /* there is no attribute to store this so store in private variable */ - mCableAssemblyCurrentLimit = currentmA; - - return this->ComputeMaxChargeCurrentLimit(); -} - -/** - * @brief Called by EVSE Hardware to indicate if EV is detected - * - * The only allowed states that the EVSE hardware can set are: - * kNotPluggedIn - * kPluggedInNoDemand - * kPluggedInDemand - * - * @param StateEnum - the state of the EV being plugged in and asking for demand etc - */ -Status EnergyEvseDelegate::HwSetState(StateEnum state) -{ - switch (state) - { - case StateEnum::kNotPluggedIn: - // TODO - work out logic here - mHwState = state; - break; - case StateEnum::kPluggedInNoDemand: - // TODO - work out logic here - mHwState = state; - break; - case StateEnum::kPluggedInDemand: - // TODO - work out logic here - mHwState = state; - break; - - default: - /* All other states should be managed by the Delegate */ - // TODO (assert?) - break; - } - - return Status::Success; -} - -/** - * @brief Called by EVSE Hardware to indicate a fault - * - * @param FaultStateEnum - the fault condition detected - */ -Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault) -{ - ChipLogProgress(AppServer, "EnergyEvseDelegate::Fault()"); - - if (fault == FaultStateEnum::kNoError) - { - /* Update State to previous state */ - // TODO: need to work out the logic here! - - /* Update SupplyState to previous state */ - } - else - { - /* Update State & SupplyState */ - SetState(StateEnum::kFault); - SetSupplyState(SupplyStateEnum::kDisabledError); - } - - /* Update FaultState */ - SetFaultState(fault); - - // TODO: Generate events - - return Status::Success; -} - -/** - * @brief Called by EVSE Hardware to Send a RFID event - * - * @param ByteSpan RFID tag value (max 10 octets) - */ -Status EnergyEvseDelegate::HwSetRFID(ByteSpan uid) -{ - Events::Rfid::Type event{ .uid = uid }; - EventNumber eventNumber; - CHIP_ERROR error = LogEvent(event, mEndpointId, eventNumber); - if (CHIP_NO_ERROR != error) - { - ChipLogError(Zcl, "[Notify] Unable to send notify event: %s [endpointId=%d]", error.AsString(), mEndpointId); - return Status::Failure; - } - - return Status::Success; -} - -/** - * @brief Called by EVSE Hardware to share the VehicleID - * - * This routine will make a copy of the string so the callee doesn't - * have to hold onto it forever. - * - * @param CharSpan containing up to 32 chars. - */ -Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue) -{ - // TODO this code to be refactored - See Issue #30993 - if (!mVehicleID.IsNull() && newValue.data_equal(mVehicleID.Value())) - { - return Status::Success; - } - - /* create a copy of the string so the callee doesn't have to keep it */ - char * destinationBuffer = new char[kMaxVehicleIDBufSize]; - - MutableCharSpan destinationString(destinationBuffer, kMaxVehicleIDBufSize); - CHIP_ERROR err = CopyCharSpanToMutableCharSpan(newValue, destinationString); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "HwSetVehicleID - could not copy vehicleID"); - delete[] destinationBuffer; - return Status::Failure; - } - - if (!mVehicleID.IsNull()) - { - delete[] mVehicleID.Value().data(); - } - - mVehicleID = MakeNullable(static_cast(destinationString)); - - ChipLogDetail(AppServer, "VehicleID updated %.*s", static_cast(mVehicleID.Value().size()), mVehicleID.Value().data()); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, VehicleID::Id); - - return Status::Success; -} - -/* --------------------------------------------------------------------------- - * Functions below are private helper functions internal to the delegate - */ - -/** - * @brief Called to compute the safe charging current limit - * - * mActualChargingCurrentLimit is the minimum of: - * - MaxHardwareCurrentLimit (of the hardware) - * - CircuitCapacity (set by the electrician - less than the hardware) - * - CableAssemblyLimit (detected when the cable is inserted) - * - MaximumChargeCurrent (from charging command) - * - UserMaximumChargeCurrent (could dynamically change) - * - */ -Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit() -{ - int64_t oldValue; - - oldValue = mActualChargingCurrentLimit; - mActualChargingCurrentLimit = mMaxHardwareCurrentLimit; - mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCircuitCapacity); - mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCableAssemblyCurrentLimit); - mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mMaximumChargingCurrentLimitFromCommand); - mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mUserMaximumChargeCurrent); - - /* Set the actual max charging current attribute */ - mMaximumChargeCurrent = mActualChargingCurrentLimit; - - if (oldValue != mMaximumChargeCurrent) - { - ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %ld", static_cast(mMaximumChargeCurrent)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id); - - /* Call the EV Charger hardware current limit callback */ - NotifyApplicationCurrentLimitChange(mMaximumChargeCurrent); - } - return Status::Success; -} - -Status EnergyEvseDelegate::NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent) -{ - EVSECbInfo cbInfo; - - cbInfo.type = EVSECallbackType::ChargeCurrentChanged; - cbInfo.ChargingCurrent.maximumChargeCurrent = maximumChargeCurrent; - - if (mCallbacks.handler != nullptr) - { - mCallbacks.handler(&cbInfo, mCallbacks.arg); - } - - return Status::Success; -} - -Status EnergyEvseDelegate::NotifyApplicationStateChange() -{ - EVSECbInfo cbInfo; - - cbInfo.type = EVSECallbackType::StateChanged; - cbInfo.StateChange.state = mState; - cbInfo.StateChange.supplyState = mSupplyState; - - if (mCallbacks.handler != nullptr) - { - mCallbacks.handler(&cbInfo, mCallbacks.arg); - } - - return Status::Success; -} - -/** - * Attribute methods - */ -/* State */ -StateEnum EnergyEvseDelegate::GetState() -{ - return mState; -} - -CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue) -{ - StateEnum oldValue = mState; - if (newValue >= StateEnum::kUnknownEnumValue) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mState = newValue; - if (oldValue != mState) - { - ChipLogDetail(AppServer, "State updated to %d", static_cast(mState)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id); - } - - return CHIP_NO_ERROR; -} - -/* SupplyState */ -SupplyStateEnum EnergyEvseDelegate::GetSupplyState() -{ - return mSupplyState; -} - -CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue) -{ - SupplyStateEnum oldValue = mSupplyState; - - if (newValue >= SupplyStateEnum::kUnknownEnumValue) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mSupplyState = newValue; - if (oldValue != mSupplyState) - { - ChipLogDetail(AppServer, "SupplyState updated to %d", static_cast(mSupplyState)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id); - } - return CHIP_NO_ERROR; -} - -/* FaultState */ -FaultStateEnum EnergyEvseDelegate::GetFaultState() -{ - return mFaultState; -} - -CHIP_ERROR EnergyEvseDelegate::SetFaultState(FaultStateEnum newValue) -{ - FaultStateEnum oldValue = mFaultState; - - if (newValue >= FaultStateEnum::kUnknownEnumValue) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mFaultState = newValue; - if (oldValue != mFaultState) - { - ChipLogDetail(AppServer, "FaultState updated to %d", static_cast(mFaultState)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, FaultState::Id); - } - return CHIP_NO_ERROR; -} - -/* ChargingEnabledUntil */ -DataModel::Nullable EnergyEvseDelegate::GetChargingEnabledUntil() -{ - return mChargingEnabledUntil; -} - -CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue) -{ - DataModel::Nullable oldValue = mChargingEnabledUntil; - - mChargingEnabledUntil = MakeNullable(newValue); - if ((oldValue.IsNull()) || (oldValue.Value() != newValue)) - { - ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %lu", - static_cast(mChargingEnabledUntil.Value())); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id); - } - return CHIP_NO_ERROR; -} - -/* DischargingEnabledUntil */ -DataModel::Nullable EnergyEvseDelegate::GetDischargingEnabledUntil() -{ - return mDischargingEnabledUntil; -} - -CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue) -{ - DataModel::Nullable oldValue = mDischargingEnabledUntil; - - mDischargingEnabledUntil = MakeNullable(newValue); - if ((oldValue.IsNull()) || (oldValue.Value() != newValue)) - { - ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %lu", - static_cast(mDischargingEnabledUntil.Value())); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id); - } - return CHIP_NO_ERROR; -} - -/* CircuitCapacity */ -int64_t EnergyEvseDelegate::GetCircuitCapacity() -{ - return mCircuitCapacity; -} - -CHIP_ERROR EnergyEvseDelegate::SetCircuitCapacity(int64_t newValue) -{ - int64_t oldValue = mCircuitCapacity; - - if (newValue >= kMaximumChargeCurrent) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mCircuitCapacity = newValue; - if (oldValue != mCircuitCapacity) - { - ChipLogDetail(AppServer, "CircuitCapacity updated to %ld", static_cast(mCircuitCapacity)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id); - } - return CHIP_NO_ERROR; -} - -/* MinimumChargeCurrent */ -int64_t EnergyEvseDelegate::GetMinimumChargeCurrent() -{ - return mMinimumChargeCurrent; -} - -CHIP_ERROR EnergyEvseDelegate::SetMinimumChargeCurrent(int64_t newValue) -{ - int64_t oldValue = mMinimumChargeCurrent; - - if (newValue >= kMaximumChargeCurrent) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mMinimumChargeCurrent = newValue; - if (oldValue != mMinimumChargeCurrent) - { - ChipLogDetail(AppServer, "MinimumChargeCurrent updated to %ld", static_cast(mMinimumChargeCurrent)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MinimumChargeCurrent::Id); - } - return CHIP_NO_ERROR; -} - -/* MaximumChargeCurrent */ -int64_t EnergyEvseDelegate::GetMaximumChargeCurrent() -{ - return mMaximumChargeCurrent; -} - -CHIP_ERROR EnergyEvseDelegate::SetMaximumChargeCurrent(int64_t newValue) -{ - int64_t oldValue = mMaximumChargeCurrent; - - if (newValue >= kMaximumChargeCurrent) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mMaximumChargeCurrent = newValue; - if (oldValue != mMaximumChargeCurrent) - { - ChipLogDetail(AppServer, "MaximumChargeCurrent updated to %ld", static_cast(mMaximumChargeCurrent)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumChargeCurrent::Id); - } - return CHIP_NO_ERROR; -} - -/* MaximumDischargeCurrent */ -int64_t EnergyEvseDelegate::GetMaximumDischargeCurrent() -{ - return mMaximumDischargeCurrent; -} - -CHIP_ERROR EnergyEvseDelegate::SetMaximumDischargeCurrent(int64_t newValue) -{ - int64_t oldValue = mMaximumDischargeCurrent; - - if (newValue >= kMaximumChargeCurrent) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mMaximumDischargeCurrent = newValue; - if (oldValue != mMaximumDischargeCurrent) - { - ChipLogDetail(AppServer, "MaximumDischargeCurrent updated to %ld", static_cast(mMaximumDischargeCurrent)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, MaximumDischargeCurrent::Id); - } - return CHIP_NO_ERROR; -} - -/* UserMaximumChargeCurrent */ -int64_t EnergyEvseDelegate::GetUserMaximumChargeCurrent() -{ - return mUserMaximumChargeCurrent; -} - -CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue) -{ - if ((newValue < 0) || (newValue > kMaximumChargeCurrent)) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - int64_t oldValue = mUserMaximumChargeCurrent; - mUserMaximumChargeCurrent = newValue; - if (oldValue != newValue) - { - ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %ld", static_cast(mUserMaximumChargeCurrent)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id); - } - - return CHIP_NO_ERROR; -} - -/* RandomizationDelayWindow */ -uint32_t EnergyEvseDelegate::GetRandomizationDelayWindow() -{ - return mRandomizationDelayWindow; -} - -CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue) -{ - uint32_t oldValue = mRandomizationDelayWindow; - if (newValue > kMaxRandomizationDelayWindow) - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } - - mRandomizationDelayWindow = newValue; - if (oldValue != newValue) - { - ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %lu", - static_cast(mRandomizationDelayWindow)); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, RandomizationDelayWindow::Id); - } - return CHIP_NO_ERROR; -} - -/* PREF attributes */ -uint8_t EnergyEvseDelegate::GetNumberOfWeeklyTargets() -{ - return mNumberOfWeeklyTargets; -} -uint8_t EnergyEvseDelegate::GetNumberOfDailyTargets() -{ - return mNumberOfDailyTargets; -} -DataModel::Nullable EnergyEvseDelegate::GetNextChargeStartTime() -{ - return mNextChargeStartTime; -} -DataModel::Nullable EnergyEvseDelegate::GetNextChargeTargetTime() -{ - return mNextChargeTargetTime; -} -DataModel::Nullable EnergyEvseDelegate::GetNextChargeRequiredEnergy() -{ - return mNextChargeRequiredEnergy; -} -DataModel::Nullable EnergyEvseDelegate::GetNextChargeTargetSoC() -{ - return mNextChargeTargetSoC; -} - -/* ApproximateEVEfficiency */ -DataModel::Nullable EnergyEvseDelegate::GetApproximateEVEfficiency() -{ - return mApproximateEVEfficiency; -} - -CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue) -{ - DataModel::Nullable oldValue = mApproximateEVEfficiency; - - mApproximateEVEfficiency = MakeNullable(newValue); - if ((oldValue.IsNull()) || (oldValue.Value() != newValue)) - { - ChipLogDetail(AppServer, "ApproximateEVEfficiency updated to %d", mApproximateEVEfficiency.Value()); - MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ApproximateEVEfficiency::Id); - } - - return CHIP_NO_ERROR; -} - -/* SOC attributes */ -DataModel::Nullable EnergyEvseDelegate::GetStateOfCharge() -{ - return mStateOfCharge; -} -DataModel::Nullable EnergyEvseDelegate::GetBatteryCapacity() -{ - return mBatteryCapacity; -} - -/* PNC attributes*/ -DataModel::Nullable EnergyEvseDelegate::GetVehicleID() -{ - return mVehicleID; -} - -/* Session SESS attributes */ -DataModel::Nullable EnergyEvseDelegate::GetSessionID() -{ - return mSessionID; -} -DataModel::Nullable EnergyEvseDelegate::GetSessionDuration() -{ - return mSessionDuration; -} -DataModel::Nullable EnergyEvseDelegate::GetSessionEnergyCharged() -{ - return mSessionEnergyCharged; -} -DataModel::Nullable EnergyEvseDelegate::GetSessionEnergyDischarged() -{ - return mSessionEnergyDischarged; -} diff --git a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp b/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp deleted file mode 100644 index 0d84d8856212e0..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * 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::app; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::EnergyEvse; - -CHIP_ERROR EnergyEvseManager::Init() -{ - return Instance::Init(); -} - -void EnergyEvseManager::Shutdown() -{ - Instance::Shutdown(); -} diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index b3117fd74cf8a6..9442436f793e1f 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -21,10 +21,10 @@ import("${chip_root}/src/platform/device.gni") source_set("chip-all-clusters-common") { sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", @@ -60,8 +60,10 @@ source_set("chip-all-clusters-common") { "${chip_root}/third_party/jsoncpp", ] - include_dirs = - [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] + include_dirs = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include" + ] cflags = [ "-Wconversion" ] From e4e299ed096b192991380179b31e3220006c4dc1 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 21:56:57 +0000 Subject: [PATCH 034/143] Aim to fix compile issues on other platforms due to logging of %d --- .../device-energy-management-server.cpp | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index bf05364fa67b71..1d656c2e366fee 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -349,7 +349,8 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, CHIP_ERROR chipError = chip::System::SystemClock().GetClock_RealTimeMS(cTMs); if (chipError != CHIP_NO_ERROR) { - ChipLogError(Zcl, "DEM: Unable to get current time - error=%d (%s)]", chipError.AsInteger(), chipError.AsString()); + ChipLogError(Zcl, "DEM: Unable to get current time - error=%ld (%s)]", + static_cast(chipError.AsInteger()), chipError.AsString()); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -377,26 +378,28 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (requestedStartTime < earliestStartTime) { - ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime %d, earlier than earliestStartTime %d.", __FUNCTION__, - requestedStartTime, earliestStartTime); + ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime %ld, earlier than earliestStartTime %ld.", __FUNCTION__, + static_cast(requestedStartTime), static_cast(earliestStartTime)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } if ((requestedStartTime + duration) > latestEndTime) { - ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime + duration %d, later than latestEndTime %d.", __FUNCTION__, - requestedStartTime + duration, latestEndTime); + ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime + duration %ld, later than latestEndTime %ld.", __FUNCTION__, + static_cast(requestedStartTime + duration), static_cast(latestEndTime)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - ChipLogProgress(Zcl, "DEM: %s - Good requestedStartTime %d.", __FUNCTION__, requestedStartTime); + ChipLogProgress(Zcl, "DEM: %s - Good requestedStartTime %ld.", __FUNCTION__, + static_cast(requestedStartTime)); status = mDelegate.StartTimeAdjustRequest(requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s - StartTimeAdjustRequest(%d) FAILURE", __FUNCTION__, requestedStartTime); + ChipLogError(Zcl, "DEM: %s - StartTimeAdjustRequest(%ld) FAILURE", __FUNCTION__, + static_cast(requestedStartTime)); return; } @@ -455,7 +458,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if ((duration < forecast.Value().slots[activeSlotNumber].minPauseDuration) && (duration > forecast.Value().slots[activeSlotNumber].maxPauseDuration)) { - ChipLogError(Zcl, "DEM: %s - out of range pause duration %d", __FUNCTION__, duration); + ChipLogError(Zcl, "DEM: %s - out of range pause duration %ld", __FUNCTION__, static_cast(duration)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -472,7 +475,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s - mDelegate.PauseRequest(%d) FAILURE", __FUNCTION__, duration); + ChipLogError(Zcl, "DEM: %s - mDelegate.PauseRequest(%ld) FAILURE", __FUNCTION__, static_cast(duration)); return; } From 6c00dcd413d524ebdce475907126e1981c5edbd1 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 20 Dec 2023 21:58:00 +0000 Subject: [PATCH 035/143] Restyled by gn --- examples/all-clusters-app/linux/BUILD.gn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 9442436f793e1f..63eeb1d836c93a 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -21,10 +21,6 @@ import("${chip_root}/src/platform/device.gni") source_set("chip-all-clusters-common") { sources = [ - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", @@ -44,6 +40,10 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "AllClustersCommandDelegate.cpp", "AppOptions.cpp", "WindowCoveringManager.cpp", @@ -62,7 +62,7 @@ source_set("chip-all-clusters-common") { include_dirs = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include" + "${chip_root}/examples/energy-management-app/energy-management-common/include", ] cflags = [ "-Wconversion" ] From 9232e5ec84b38dc644c157ddb03bb2776a0b0af8 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 22:27:50 +0000 Subject: [PATCH 036/143] Updated build files to remove duplicate copies from all-clusters-common to energy-management-common --- examples/all-clusters-app/ameba/chip_main.cmake | 9 +++++++-- examples/all-clusters-app/asr/BUILD.gn | 8 ++++++-- examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn | 8 ++++++-- examples/all-clusters-app/cc13x4_26x4/BUILD.gn | 8 ++++++-- examples/all-clusters-app/infineon/psoc6/BUILD.gn | 8 ++++++-- examples/all-clusters-app/nxp/mw320/BUILD.gn | 8 ++++++-- examples/all-clusters-app/tizen/BUILD.gn | 13 +++++++++---- examples/energy-management-app/linux/BUILD.gn | 2 ++ examples/shell/shell_common/BUILD.gn | 13 +++++++++---- 9 files changed, 57 insertions(+), 20 deletions(-) diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index f3c6a54854c475..cc30f3706f9c67 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -156,8 +156,7 @@ list( ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp - ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp - ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp @@ -176,6 +175,11 @@ list( ${chip_dir}/examples/all-clusters-app/ameba/main/ManualOperationCommand.cpp ${chip_dir}/examples/all-clusters-app/ameba/main/SmokeCOAlarmManager.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp + ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_hook.c ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_table.c @@ -220,6 +224,7 @@ target_include_directories( ${chip_dir}/zzz_generated/app-common ${chip_dir}/examples/all-clusters-app/all-clusters-common ${chip_dir}/examples/all-clusters-app/all-clusters-common/include + ${chip_dir}/examples/energy-management-app/energy-management-common/include ${chip_dir}/examples/all-clusters-app/ameba/main/include ${chip_dir}/examples/platform/ameba ${chip_dir}/examples/platform/ameba/route_hook diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn index 75c4a3171cfd4a..defdc9dccd64bf 100755 --- a/examples/all-clusters-app/asr/BUILD.gn +++ b/examples/all-clusters-app/asr/BUILD.gn @@ -71,17 +71,20 @@ asr_executable("clusters_app") { output_name = "chip-asr-clusters-example.out" sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${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/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/resource-monitoring-delegates.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "${examples_plat_dir}/ButtonHandler.cpp", "${examples_plat_dir}/CHIPDeviceManager.cpp", "${examples_plat_dir}/LEDWidget.cpp", @@ -111,6 +114,7 @@ asr_executable("clusters_app") { "${examples_plat_dir}", "${asr_project_dir}/include", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", "${chip_root}/src", "${chip_root}/src/lib", "${chip_root}/src/lib/support", diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn index ad07e2c7a0da32..d1f56667f5f453 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn @@ -75,18 +75,21 @@ ti_simplelink_executable("all-clusters-app") { output_name = "chip-${ti_simplelink_board}-all-clusters-example.out" sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${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/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/resource-monitoring-delegates.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", "${project_dir}/main/AppTask.cpp", "${project_dir}/main/ClusterManager.cpp", @@ -112,6 +115,7 @@ ti_simplelink_executable("all-clusters-app") { "${project_dir}", "${project_dir}/main", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", "${chip_root}/examples/providers/", ] diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index c35afae97aabba..9efcf90d520501 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -78,18 +78,21 @@ ti_simplelink_executable("all-clusters-app") { output_name = "chip-${ti_simplelink_board}-all-clusters-example.out" sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${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/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/resource-monitoring-delegates.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", "${project_dir}/main/AppTask.cpp", "${project_dir}/main/ClusterManager.cpp", @@ -116,6 +119,7 @@ ti_simplelink_executable("all-clusters-app") { "${project_dir}", "${project_dir}/main", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", "${chip_root}/examples/providers/", ] diff --git a/examples/all-clusters-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn index b99dc84405e841..69b0786d24bde4 100644 --- a/examples/all-clusters-app/infineon/psoc6/BUILD.gn +++ b/examples/all-clusters-app/infineon/psoc6/BUILD.gn @@ -107,17 +107,20 @@ psoc6_executable("clusters_app") { output_name = "chip-psoc6-clusters-example.out" sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${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/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/resource-monitoring-delegates.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/init_psoc6Platform.cpp", "src/AppTask.cpp", @@ -141,6 +144,7 @@ psoc6_executable("clusters_app") { "${examples_plat_dir}", "${psoc6_project_dir}/include", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", ] defines = [] diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index ab7be5a04d64c1..ece2c443fb3681 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -71,20 +71,24 @@ mw320_executable("shell_mw320") { "${chip_root}/src", "${chip_root}/src/app/util", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", "${chip_root}/examples/all-clusters-app/nxp/mw320/include", ] sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${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/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/resource-monitoring-delegates.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "${chip_root}/src/lib/shell/streamer_mw320.cpp", "binding-handler.cpp", "include/CHIPProjectConfig.h", diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 6960ec6aa6d516..db0d69d8eb92d4 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -23,18 +23,21 @@ assert(chip_build_tools) source_set("chip-all-clusters-common") { sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${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/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/resource-monitoring-delegates.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", ] deps = [ @@ -43,8 +46,10 @@ source_set("chip-all-clusters-common") { "${chip_root}/src/lib/shell:shell_core", ] - include_dirs = - [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] + include_dirs = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", + ] } executable("chip-all-clusters-app") { diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn index 8597caabfc35b9..bcc8045edbf00e 100644 --- a/examples/energy-management-app/linux/BUILD.gn +++ b/examples/energy-management-app/linux/BUILD.gn @@ -36,6 +36,8 @@ config("includes") { executable("chip-energy-management-app") { sources = [ + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", diff --git a/examples/shell/shell_common/BUILD.gn b/examples/shell/shell_common/BUILD.gn index b870628717d8e5..35dceff96796c3 100644 --- a/examples/shell/shell_common/BUILD.gn +++ b/examples/shell/shell_common/BUILD.gn @@ -64,17 +64,22 @@ static_library("shell_common") { import("${chip_root}/src/app/chip_data_model.gni") sources += [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/EnergyEvseManager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.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/energy-evse-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", ] - include_dirs = - [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] + include_dirs = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", + ] public_deps += [ "${chip_root}/examples/all-clusters-app/all-clusters-common" ] From a5267e384d8b92f668f44d9086c05cdebf50d134 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 22:54:11 +0000 Subject: [PATCH 037/143] Fixed ESP32 include path --- examples/all-clusters-app/esp32/main/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 5680634c786678..e8851aa5a4d3d5 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -18,6 +18,7 @@ # The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/include" "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" From 363f79c19ef2cdd1eaf9f0257dbd97769243e58b Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 23:43:47 +0000 Subject: [PATCH 038/143] Added DEM into energy-management-app - refactored main.cpp. --- .../src/EVSEManufacturerImpl.cpp | 10 +- examples/energy-management-app/linux/main.cpp | 202 +++++++++++++----- 2 files changed, 156 insertions(+), 56 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 8daf1781103831..f0b412729e2620 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -23,15 +23,15 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; -CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance) +CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * evseInstance, DeviceEnergyManagementManager * demInstance) { /* Manufacturers should modify this to do any custom initialisation */ /* Register callbacks */ - EnergyEvseDelegate * dg = aInstance->GetDelegate(); + EnergyEvseDelegate * dg = evseInstance->GetDelegate(); if (dg == nullptr) { - ChipLogError(AppServer, "Delegate is not initialized"); + ChipLogError(AppServer, "EVSE Delegate is not initialized"); return CHIP_ERROR_UNINITIALIZED; } @@ -62,7 +62,7 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance) return CHIP_NO_ERROR; } -CHIP_ERROR EVSEManufacturer::Shutdown(EnergyEvseManager * aInstance) +CHIP_ERROR EVSEManufacturer::Shutdown(EnergyEvseManager * evseInstance, DeviceEnergyManagementManager * demInstance) { return CHIP_NO_ERROR; @@ -88,6 +88,6 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ static_cast(cb->ChargingCurrent.maximumChargeCurrent)); break; default: - ChipLogError(AppServer, "Unhandler EVSE Callback type %d", static_cast(cb->type)); + ChipLogError(AppServer, "Unhandled EVSE Callback type %d", static_cast(cb->type)); } } diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp index dddc6f53d76b20..f494ebb20dd1de 100644 --- a/examples/energy-management-app/linux/main.cpp +++ b/examples/energy-management-app/linux/main.cpp @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -35,55 +36,133 @@ using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; -static EnergyEvseDelegate * gDelegate = nullptr; -static EnergyEvseManager * gInstance = nullptr; -static EVSEManufacturer * gEvseManufacturer = nullptr; +static EnergyEvseDelegate * gEvseDelegate = nullptr; +static EnergyEvseManager * gEvseInstance = nullptr; +static DeviceEnergyManagementDelegate * gDEMDelegate = nullptr; +static DeviceEnergyManagementManager * gDEMInstance = nullptr; +static EVSEManufacturer * gEvseManufacturer = nullptr; -void ApplicationInit() +CHIP_ERROR DeviceEnergyManagementInit() { - CHIP_ERROR err; + if ((gDEMDelegate != nullptr) || (gDEMInstance != nullptr)) + { + ChipLogError(AppServer, "DEM Instance or Delegate already exist."); + return CHIP_ERROR_INCORRECT_STATE; + } - if ((gDelegate != nullptr) || (gInstance != nullptr) || (gEvseManufacturer != nullptr)) + gDEMDelegate = new DeviceEnergyManagementDelegate(); + if (gDEMDelegate == nullptr) { - ChipLogError(AppServer, "EVSE Instance or Delegate, EvseManufacturer already exist."); - return; + ChipLogError(AppServer, "Failed to allocate memory for DeviceEnergyManagementDelegate"); + return CHIP_ERROR_NO_MEMORY; + } + + /* Manufacturer may optionally not support all features, commands & attributes */ + gDEMInstance = new DeviceEnergyManagementManager( + EndpointId(ENERGY_EVSE_ENDPOINT), *gDEMDelegate, + BitMask( + DeviceEnergyManagement::Feature::kPowerForecastReporting, DeviceEnergyManagement::Feature::kStateForecastReporting, + DeviceEnergyManagement::Feature::kPowerAdjustment, DeviceEnergyManagement::Feature::kForecastAdjustment), + BitMask( + DeviceEnergyManagement::OptionalCommands::kSupportsModifyForecastRequest, + DeviceEnergyManagement::OptionalCommands::kSupportsRequestConstraintBasedForecast)); + + if (gDEMInstance == nullptr) + { + ChipLogError(AppServer, "Failed to allocate memory for DeviceEnergyManagementManager"); + delete gDEMDelegate; + gDEMDelegate = nullptr; + return CHIP_ERROR_NO_MEMORY; + } + + CHIP_ERROR err = gDEMInstance->Init(); /* Register Attribute & Command handlers */ + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Init failed on gDEMInstance"); + delete gDEMInstance; + delete gDEMDelegate; + gDEMInstance = nullptr; + gDEMDelegate = nullptr; + return err; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DeviceEnergyManagementShutdown() +{ + delete gDEMInstance; + delete gDEMDelegate; + gDEMInstance = nullptr; + gDEMDelegate = nullptr; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR EnergyEvseInit() +{ + if ((gEvseDelegate != nullptr) || (gEvseInstance != nullptr)) + { + ChipLogError(AppServer, "EVSE Instance or Delegate already exist."); + return CHIP_ERROR_INCORRECT_STATE; } - gDelegate = new EnergyEvseDelegate(); - if (gDelegate == nullptr) + gEvseDelegate = new EnergyEvseDelegate(); + if (gEvseDelegate == nullptr) { ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseDelegate"); - return; + return CHIP_ERROR_NO_MEMORY; } /* Manufacturer may optionally not support all features, commands & attributes */ - gInstance = - new EnergyEvseManager(EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate, - BitMask( - EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, - EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x), - BitMask(OptionalAttributes::kSupportsUserMaximumChargingCurrent, - OptionalAttributes::kSupportsRandomizationWindow, - OptionalAttributes::kSupportsApproximateEvEfficiency), - BitMask(OptionalCommands::kSupportsStartDiagnostics)); - - if (gInstance == nullptr) + gEvseInstance = new EnergyEvseManager( + EndpointId(ENERGY_EVSE_ENDPOINT), *gEvseDelegate, + BitMask(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, + EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, + EnergyEvse::Feature::kV2x), + BitMask(EnergyEvse::OptionalAttributes::kSupportsUserMaximumChargingCurrent, + EnergyEvse::OptionalAttributes::kSupportsRandomizationWindow, + EnergyEvse::OptionalAttributes::kSupportsApproximateEvEfficiency), + BitMask(EnergyEvse::OptionalCommands::kSupportsStartDiagnostics)); + + if (gEvseInstance == nullptr) { ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseManager"); - delete gDelegate; - gDelegate = nullptr; - return; + delete gEvseDelegate; + gEvseDelegate = nullptr; + return CHIP_ERROR_NO_MEMORY; } - err = gInstance->Init(); /* Register Attribute & Command handlers */ + CHIP_ERROR err = gEvseInstance->Init(); /* Register Attribute & Command handlers */ if (err != CHIP_NO_ERROR) { - ChipLogError(AppServer, "Init failed on gInstance"); - delete gInstance; - delete gDelegate; - gInstance = nullptr; - gDelegate = nullptr; - return; + ChipLogError(AppServer, "Init failed on gEvseInstance"); + delete gEvseInstance; + delete gEvseDelegate; + gEvseInstance = nullptr; + gEvseDelegate = nullptr; + return err; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR EnergyEvseShutdown() +{ + delete gEvseInstance; + delete gEvseDelegate; + gEvseInstance = nullptr; + gEvseDelegate = nullptr; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR EVSEManufacturerInit() +{ + if (gEvseManufacturer != nullptr) + { + ChipLogError(AppServer, "EvseManufacturer already exist."); + return CHIP_ERROR_INCORRECT_STATE; } /* Now create EVSEManufacturer*/ @@ -91,24 +170,47 @@ void ApplicationInit() if (gEvseManufacturer == nullptr) { ChipLogError(AppServer, "Failed to allocate memory for EvseManufacturer"); - delete gInstance; - delete gDelegate; - gInstance = nullptr; - gDelegate = nullptr; - return; + return CHIP_ERROR_NO_MEMORY; } /* Call Manufacturer specific init */ - err = gEvseManufacturer->Init(gInstance); + CHIP_ERROR err = gEvseManufacturer->Init(gEvseInstance, gDEMInstance); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Init failed on gEvseManufacturer"); delete gEvseManufacturer; - delete gInstance; - delete gDelegate; gEvseManufacturer = nullptr; - gInstance = nullptr; - gDelegate = nullptr; + return err; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR EVSEManufacturerShutdown() +{ + delete gEvseManufacturer; + gEvseManufacturer = nullptr; + + return CHIP_NO_ERROR; +} + +void ApplicationInit() +{ + if (DeviceEnergyManagementInit() != CHIP_NO_ERROR) + { + return; + } + + if (EnergyEvseInit() != CHIP_NO_ERROR) + { + DeviceEnergyManagementShutdown(); + return; + } + + if (EVSEManufacturerInit() != CHIP_NO_ERROR) + { + DeviceEnergyManagementShutdown(); + EnergyEvseShutdown(); return; } } @@ -118,17 +220,15 @@ void ApplicationShutdown() ChipLogDetail(AppServer, "Energy Management App: ApplicationShutdown()"); /* Shutdown the EVSEManufacturer*/ - gEvseManufacturer->Shutdown(gInstance); + gEvseManufacturer->Shutdown(gEvseInstance, gDEMInstance); - /* Shutdown the Instance - deregister attribute & command handler */ - gInstance->Shutdown(); + /* Shutdown the Instances - deregister attribute & command handlers */ + gEvseInstance->Shutdown(); + gDEMInstance->Shutdown(); - delete gEvseManufacturer; - delete gInstance; - delete gDelegate; - gEvseManufacturer = nullptr; - gInstance = nullptr; - gDelegate = nullptr; + EVSEManufacturerShutdown(); /* Free the EVSEManufacturer */ + EnergyEvseShutdown(); /* Free the EnergyEvse */ + DeviceEnergyManagementShutdown(); /* Free the DEM */ } int main(int argc, char * argv[]) From 0db5eb03a2b73d749c25e31c6a854e59d6671c50 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 23:44:45 +0000 Subject: [PATCH 039/143] Added DEM into EVSEManufacturerImpl.h --- .../energy-management-common/include/EVSEManufacturerImpl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h index 4ff45e925674aa..f47e17508513a9 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h @@ -18,6 +18,7 @@ #pragma once +#include #include using chip::Protocols::InteractionModel::Status; @@ -36,12 +37,12 @@ class EVSEManufacturer /** * @brief Called at start up to apply hardware settings */ - CHIP_ERROR Init(EnergyEvseManager * aInstance); + CHIP_ERROR Init(EnergyEvseManager * evseInstance, DeviceEnergyManagementManager * demInstance); /** * @brief Called at shutdown */ - CHIP_ERROR Shutdown(EnergyEvseManager * aInstance); + CHIP_ERROR Shutdown(EnergyEvseManager * evseInstance, DeviceEnergyManagementManager * demInstance); /** * @brief Main Callback handler from delegate to user code From 23e174aa988446046bbacea0185ffb3f62a81c6f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 20 Dec 2023 23:45:35 +0000 Subject: [PATCH 040/143] Fix - avoid using global namespace in header file --- .../energy-management-common/include/EnergyEvseManager.h | 3 ++- .../device-energy-management-server.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h index 9875c397990ef2..d2463d2fa20f97 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h @@ -26,8 +26,8 @@ namespace chip { namespace app { namespace Clusters { +namespace EnergyEvse { -using namespace chip::app::Clusters::EnergyEvse; class EnergyEvseManager : public Instance { public: @@ -52,6 +52,7 @@ class EnergyEvseManager : public Instance EnergyEvseDelegate * mDelegate; }; +} // namespace EnergyEvse } // namespace Clusters } // namespace app } // namespace chip diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index b0725ca6685180..457a3782fed4c5 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -28,12 +28,13 @@ #include #include -using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; namespace chip { namespace app { namespace Clusters { namespace DeviceEnergyManagement { +using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; + using chip::Protocols::InteractionModel::Status; /** From 77a33bed83773a750ce37a7e036b6b8a96ca5046 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 20 Dec 2023 23:46:33 +0000 Subject: [PATCH 041/143] Restyled by gn --- examples/all-clusters-app/asr/BUILD.gn | 2 +- examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn | 2 +- examples/all-clusters-app/cc13x4_26x4/BUILD.gn | 4 ++-- examples/all-clusters-app/infineon/psoc6/BUILD.gn | 2 +- examples/all-clusters-app/nxp/mw320/BUILD.gn | 2 +- examples/all-clusters-app/tizen/BUILD.gn | 2 +- examples/energy-management-app/linux/BUILD.gn | 2 +- examples/shell/shell_common/BUILD.gn | 10 +++++----- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn index defdc9dccd64bf..df2ac9a6b90147 100755 --- a/examples/all-clusters-app/asr/BUILD.gn +++ b/examples/all-clusters-app/asr/BUILD.gn @@ -74,7 +74,7 @@ asr_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${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/device-energy-management-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/resource-monitoring-delegates.cpp", diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn index d1f56667f5f453..502c8d097d59b9 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn @@ -79,7 +79,7 @@ ti_simplelink_executable("all-clusters-app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${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/device-energy-management-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/resource-monitoring-delegates.cpp", diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index 9efcf90d520501..180b88572a9174 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -82,7 +82,7 @@ ti_simplelink_executable("all-clusters-app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${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/device-energy-management-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/resource-monitoring-delegates.cpp", @@ -119,7 +119,7 @@ ti_simplelink_executable("all-clusters-app") { "${project_dir}", "${project_dir}/main", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", "${chip_root}/examples/providers/", ] diff --git a/examples/all-clusters-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn index 69b0786d24bde4..166db52c3a7da5 100644 --- a/examples/all-clusters-app/infineon/psoc6/BUILD.gn +++ b/examples/all-clusters-app/infineon/psoc6/BUILD.gn @@ -144,7 +144,7 @@ psoc6_executable("clusters_app") { "${examples_plat_dir}", "${psoc6_project_dir}/include", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", ] defines = [] diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index ece2c443fb3681..b1901b6ea77ce6 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -78,7 +78,7 @@ mw320_executable("shell_mw320") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp", "${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/device-energy-management-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/resource-monitoring-delegates.cpp", diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index db0d69d8eb92d4..09994a8fed1cfe 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -27,7 +27,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${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/device-energy-management-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/resource-monitoring-delegates.cpp", diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn index bcc8045edbf00e..8fb53878129c60 100644 --- a/examples/energy-management-app/linux/BUILD.gn +++ b/examples/energy-management-app/linux/BUILD.gn @@ -37,7 +37,7 @@ config("includes") { executable("chip-energy-management-app") { sources = [ "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", diff --git a/examples/shell/shell_common/BUILD.gn b/examples/shell/shell_common/BUILD.gn index 35dceff96796c3..28b26af3ae211f 100644 --- a/examples/shell/shell_common/BUILD.gn +++ b/examples/shell/shell_common/BUILD.gn @@ -65,7 +65,7 @@ static_library("shell_common") { sources += [ "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.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/device-energy-management-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/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", @@ -76,10 +76,10 @@ static_library("shell_common") { "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", ] - include_dirs = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", - ] + include_dirs = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/include", + ] public_deps += [ "${chip_root}/examples/all-clusters-app/all-clusters-common" ] From 8744697b702a9cc0e26c961cca54719bcdaaea4a Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 21 Dec 2023 00:08:44 +0000 Subject: [PATCH 042/143] Updated CMakeLists.txt to remove duplicate energy-management files. --- examples/all-clusters-app/mbed/CMakeLists.txt | 10 ++++++++-- examples/all-clusters-app/nrfconnect/CMakeLists.txt | 9 +++++++-- examples/all-clusters-app/openiotsdk/CMakeLists.txt | 9 +++++++-- examples/all-clusters-app/telink/CMakeLists.txt | 9 +++++++-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/examples/all-clusters-app/mbed/CMakeLists.txt b/examples/all-clusters-app/mbed/CMakeLists.txt index 79a48c85938f78..c05444608c02fc 100644 --- a/examples/all-clusters-app/mbed/CMakeLists.txt +++ b/examples/all-clusters-app/mbed/CMakeLists.txt @@ -7,6 +7,7 @@ get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH) get_filename_component(MBED_COMMON ${CHIP_ROOT}/examples/platform/mbed REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) get_filename_component(ALL_CLUSTERS_COMMON ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(ENERGY_MANAGEMENT_COMMON ${CHIP_ROOT}/examples/energy-management-app/energy-management-common/ REALPATH) get_filename_component(NLIO_ROOT ${CHIP_ROOT}/third_party/nlio/repo/include REALPATH) configure_file( @@ -49,6 +50,7 @@ target_include_directories(${APP_TARGET} PRIVATE main/include/ ${MBED_COMMON}/util/include ${ALL_CLUSTERS_COMMON}/include + ${ENERGY_MANAGEMENT_COMMON}/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${NLIO_ROOT} @@ -63,13 +65,17 @@ target_sources(${APP_TARGET} PRIVATE ${ALL_CLUSTERS_COMMON}/src/air-quality-instance.cpp ${ALL_CLUSTERS_COMMON}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON}/src/fan-stub.cpp - ${ALL_CLUSTERS_COMMON}/src/EnergyEvseDelegateImpl.cpp - ${ALL_CLUSTERS_COMMON}/src/EnergyEvseManager.cpp + ${ALL_CLUSTERS_COMMON}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON}/src/energy-evse-stub.cpp ${ALL_CLUSTERS_COMMON}/src/resource-monitoring-delegates.cpp ${ALL_CLUSTERS_COMMON}/src/smco-stub.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-temperature-levels.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp + ) chip_configure_data_model(${APP_TARGET} diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index 72b93e0647724c..1aa797cce5d169 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -19,6 +19,7 @@ get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connect get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconnect REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(ENERGY_MANAGEMENT_COMMON_DIR ${CHIP_ROOT}/examples/energy-management-app/energy-management-common/ REALPATH) include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) @@ -49,6 +50,7 @@ include(${CHIP_ROOT}/src/app/chip_data_model.cmake) target_include_directories(app PRIVATE main/include ${ALL_CLUSTERS_COMMON_DIR}/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${NRFCONNECT_COMMON}/util/include) @@ -61,13 +63,16 @@ target_sources(app PRIVATE ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseManager.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp) chip_configure_data_model(app diff --git a/examples/all-clusters-app/openiotsdk/CMakeLists.txt b/examples/all-clusters-app/openiotsdk/CMakeLists.txt index dce8295b300cb4..ad451ac2235657 100644 --- a/examples/all-clusters-app/openiotsdk/CMakeLists.txt +++ b/examples/all-clusters-app/openiotsdk/CMakeLists.txt @@ -20,6 +20,7 @@ get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH) get_filename_component(OPEN_IOT_SDK_CONFIG ${CHIP_ROOT}/config/openiotsdk REALPATH) get_filename_component(OPEN_IOT_SDK_EXAMPLE_COMMON ${CHIP_ROOT}/examples/platform/openiotsdk REALPATH) get_filename_component(ALL_CLUSTERS_COMMON ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(ENERGY_MANAGEMENT_COMMON ${CHIP_ROOT}/examples/energy-management-app/energy-management-common/ REALPATH) list(APPEND CMAKE_MODULE_PATH ${OPEN_IOT_SDK_CONFIG}/cmake) @@ -47,6 +48,7 @@ target_include_directories(${APP_TARGET} PRIVATE main/include ${ALL_CLUSTERS_COMMON}/include + ${ENERGY_MANAGEMENT_COMMON}/include ) target_sources(${APP_TARGET} @@ -57,12 +59,15 @@ target_sources(${APP_TARGET} ${ALL_CLUSTERS_COMMON}/src/air-quality-instance.cpp ${ALL_CLUSTERS_COMMON}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON}/src/fan-stub.cpp - ${ALL_CLUSTERS_COMMON}/src/EnergyEvseDelegateImpl.cpp - ${ALL_CLUSTERS_COMMON}/src/EnergyEvseManager.cpp + ${ALL_CLUSTERS_COMMON}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON}/src/energy-evse-stub.cpp ${ALL_CLUSTERS_COMMON}/src/resource-monitoring-delegates.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp ${ALL_CLUSTERS_COMMON}/src/binding-handler.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp ) target_link_libraries(${APP_TARGET} diff --git a/examples/all-clusters-app/telink/CMakeLists.txt b/examples/all-clusters-app/telink/CMakeLists.txt index fa279aa4c8a90f..ab422a38530d84 100644 --- a/examples/all-clusters-app/telink/CMakeLists.txt +++ b/examples/all-clusters-app/telink/CMakeLists.txt @@ -19,6 +19,7 @@ get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connect get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(ENERGY_MANAGEMENT_COMMON_DIR ${CHIP_ROOT}/examples/energy-management-app/energy-management-common/ REALPATH) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") @@ -65,6 +66,7 @@ target_compile_options(app PRIVATE -fpermissive) target_include_directories(app PRIVATE include ${ALL_CLUSTERS_COMMON_DIR}/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${TELINK_COMMON}/common/include @@ -84,10 +86,13 @@ target_sources(app PRIVATE ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/fan-stub.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/EnergyEvseManager.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp ${TELINK_COMMON}/util/src/LEDWidget.cpp From 2f744c6c786e822be85e12332f61193ed5e5bafe Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 21 Dec 2023 00:26:19 +0000 Subject: [PATCH 043/143] Added device-energy-management-server to ESP32 all-clusters CMakeLists.txt --- examples/all-clusters-app/esp32/main/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index e8851aa5a4d3d5..798bdec98b8e3b 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -73,6 +73,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/device-energy-management-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-evse-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server" From 88003efc9f7864ee24c7b0a198d881e468b85ff4 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 21 Dec 2023 09:26:32 +0000 Subject: [PATCH 044/143] Removed return at end of void function. --- .../device-energy-management-server.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 1d656c2e366fee..098ee4241e8ee5 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -275,7 +275,6 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po { ChipLogError(Zcl, "DEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); } - return; } void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, @@ -300,8 +299,6 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, ChipLogError(Zcl, "DEM: %s Failed to CancelPowerAdjustRequest()", __FUNCTION__); return; } - - return; } void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, @@ -402,8 +399,6 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, static_cast(requestedStartTime)); return; } - - return; } void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseRequest::DecodableType & commandData) @@ -478,8 +473,6 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq ChipLogError(Zcl, "DEM: %s - mDelegate.PauseRequest(%ld) FAILURE", __FUNCTION__, static_cast(duration)); return; } - - return; } void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeRequest::DecodableType & commandData) @@ -501,8 +494,6 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR ChipLogError(Zcl, "DEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); return; } - - return; } void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands::ModifyForecastRequest::DecodableType & commandData) From 0bad68b9a9101f69e90e38969dd854935d6086d7 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 21 Dec 2023 09:33:22 +0000 Subject: [PATCH 045/143] Added include to all-clusters-minimal in ESP32 --- examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt index 33582927c19d26..cae8b64315a232 100644 --- a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt @@ -19,6 +19,7 @@ # The list of src and include dirs must be in sync with that in all-clusters-minimal-app/esp32/main/component.mk set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/include" "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" @@ -80,6 +81,8 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/device-energy-management-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-evse-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server" From 082f1b7e3c321c4e099fcfdec8eacdb5263068ae Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 22 Dec 2023 09:28:56 +0000 Subject: [PATCH 046/143] Removed __FUNCTION__ from logs --- .../DeviceEnergyManagementDelegateImpl.cpp | 5 +- .../device-energy-management-server.cpp | 60 +++++++++---------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp index 74ad9e9e23f47a..25a9afd6a766cc 100644 --- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -335,7 +335,7 @@ DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability(PowerAdjustmentCapa if (powerAdjustmentCapability.IsNull()) { mPowerAdjustmentCapability.SetNull(); - ChipLogDetail(AppServer, "null src - %s", __FUNCTION__); + ChipLogDetail(AppServer, "DEM: PowerAdjustmentCapability is null"); } else { @@ -365,7 +365,7 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable= pas.minPower) && (durationSec >= pas.minDuration) && (power <= pas.maxPower) && (durationSec <= pas.maxDuration)) { - ChipLogProgress(Zcl, "DEM: %s Good PowerAdjustment args", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: Good PowerAdjustment args"); validArgs = true; break; } @@ -262,18 +262,18 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po if (!validArgs) { - ChipLogError(Zcl, "DEM: %s invalid request range", __FUNCTION__); + ChipLogError(Zcl, "DEM: invalid request range"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - ChipLogProgress(Zcl, "DEM: %s Good PowerAdjustRequest() args.", __FUNCTION__); + ChipLogProgress(Zcl, "DEM: Good PowerAdjustRequest() args."); status = mDelegate.PowerAdjustRequest(power, durationSec); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s Failed to PowerAdjustRequest() args.", __FUNCTION__); + ChipLogError(Zcl, "DEM: Failed to PowerAdjustRequest() args."); } } @@ -287,7 +287,7 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, esaStatus = mDelegate.GetESAState(); if (ESAStateEnum::kPowerAdjustActive != esaStatus) { - ChipLogError(Zcl, "DEM: %s - kPowerAdjustActive != esaStatus", __FUNCTION__); + ChipLogError(Zcl, "DEM: kPowerAdjustActive != esaStatus"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -296,7 +296,7 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s Failed to CancelPowerAdjustRequest()", __FUNCTION__); + ChipLogError(Zcl, "DEM: Failed to CancelPowerAdjustRequest()"); return; } } @@ -314,14 +314,14 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (forecast.IsNull()) { - ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: Forecast is Null"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogError(Zcl, "DEM: ESAState = kUserOptOut"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -335,14 +335,14 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (forecast.Value().earliestStartTime.HasValue() || forecast.Value().latestEndTime.HasValue()) { /* These Should not be NULL since this command requires FA feature and these are mandatory for that */ - ChipLogError(Zcl, "DEM: %s - EarliestStartTime / LatestEndTime not valid", __FUNCTION__); + ChipLogError(Zcl, "DEM: EarliestStartTime / LatestEndTime not valid"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (forecast.Value().earliestStartTime.Value().IsNull()) { - chip::System::Clock::Milliseconds64 cTMs; + System::Clock::Milliseconds64 cTMs; CHIP_ERROR chipError = chip::System::SystemClock().GetClock_RealTimeMS(cTMs); if (chipError != CHIP_NO_ERROR) { @@ -375,7 +375,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (requestedStartTime < earliestStartTime) { - ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime %ld, earlier than earliestStartTime %ld.", __FUNCTION__, + ChipLogError(Zcl, "DEM: Bad requestedStartTime %ld, earlier than earliestStartTime %ld.", static_cast(requestedStartTime), static_cast(earliestStartTime)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; @@ -383,19 +383,19 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if ((requestedStartTime + duration) > latestEndTime) { - ChipLogError(Zcl, "DEM: %s - Bad requestedStartTime + duration %ld, later than latestEndTime %ld.", __FUNCTION__, + ChipLogError(Zcl, "DEM: Bad requestedStartTime + duration %ld, later than latestEndTime %ld.", static_cast(requestedStartTime + duration), static_cast(latestEndTime)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - ChipLogProgress(Zcl, "DEM: %s - Good requestedStartTime %ld.", __FUNCTION__, + ChipLogProgress(Zcl, "DEM: Good requestedStartTime %ld.", static_cast(requestedStartTime)); status = mDelegate.StartTimeAdjustRequest(requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s - StartTimeAdjustRequest(%ld) FAILURE", __FUNCTION__, + ChipLogError(Zcl, "DEM: StartTimeAdjustRequest(%ld) FAILURE", static_cast(requestedStartTime)); return; } @@ -411,14 +411,14 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if (forecast.IsNull()) { - ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: Forecast is Null"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -429,7 +429,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq uint16_t activeSlotNumber; if (forecast.Value().activeSlotNumber.IsNull()) { - ChipLogError(Zcl, "DEM: %s - activeSlotNumber Is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: activeSlotNumber Is Null"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -437,7 +437,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq activeSlotNumber = forecast.Value().activeSlotNumber.Value(); if (activeSlotNumber >= forecast.Value().slots.size()) { - ChipLogError(Zcl, "DEM: %s - Bad activeSlotNumber %d , size()=%d.", __FUNCTION__, activeSlotNumber, + ChipLogError(Zcl, "DEM: Bad activeSlotNumber %d , size()=%d.", activeSlotNumber, static_cast(forecast.Value().slots.size())); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; @@ -445,7 +445,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable) { - ChipLogError(Zcl, "DEM: %s - activeSlotNumber %d is NOT pauseable.", __FUNCTION__, activeSlotNumber); + ChipLogError(Zcl, "DEM: activeSlotNumber %d is NOT pauseable.", activeSlotNumber); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -453,7 +453,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if ((duration < forecast.Value().slots[activeSlotNumber].minPauseDuration) && (duration > forecast.Value().slots[activeSlotNumber].maxPauseDuration)) { - ChipLogError(Zcl, "DEM: %s - out of range pause duration %ld", __FUNCTION__, static_cast(duration)); + ChipLogError(Zcl, "DEM: out of range pause duration %ld", static_cast(duration)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } @@ -461,7 +461,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq err = mDelegate.SetESAState(ESAStateEnum::kPaused); if (CHIP_NO_ERROR != err) { - ChipLogError(Zcl, "DEM: %s - SetESAState(paused) FAILURE", __FUNCTION__); + ChipLogError(Zcl, "DEM: SetESAState(paused) FAILURE"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -470,7 +470,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s - mDelegate.PauseRequest(%ld) FAILURE", __FUNCTION__, static_cast(duration)); + ChipLogError(Zcl, "DEM: mDelegate.PauseRequest(%ld) FAILURE", static_cast(duration)); return; } } @@ -482,7 +482,7 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR if (ESAStateEnum::kPaused != mDelegate.GetESAState()) { - ChipLogError(Zcl, "DEM: %s - ESAState not Paused.", __FUNCTION__); + ChipLogError(Zcl, "DEM: ESAState not Paused."); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -491,7 +491,7 @@ void Instance::HandleResumeRequest(HandlerContext & ctx, const Commands::ResumeR ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s - mDelegate.ResumeRequest() FAILURE", __FUNCTION__); + ChipLogError(Zcl, "DEM: mDelegate.ResumeRequest() FAILURE"); return; } } @@ -504,7 +504,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogError(Zcl, "DEM: ESAState = kUserOptOut"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -512,7 +512,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: forecast = mDelegate.GetForecast(); if (forecast.IsNull()) { - ChipLogError(Zcl, "DEM: %s - Forecast is Null", __FUNCTION__); + ChipLogError(Zcl, "DEM: Forecast is Null"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -521,7 +521,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands: status = mDelegate.ModifyForecastRequest(forecastId, slotAdjustments); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s - mDelegate.ModifyForecastRequest() FAILURE", __FUNCTION__); + ChipLogError(Zcl, "DEM: mDelegate.ModifyForecastRequest() FAILURE"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -534,7 +534,7 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut", __FUNCTION__); + ChipLogError(Zcl, "DEM: ESAState = kUserOptOut"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } @@ -542,7 +542,7 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx, status = mDelegate.RequestConstraintBasedForecast(commandData.constraints); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: %s - mDelegate.commandData.constraints() FAILURE", __FUNCTION__); + ChipLogError(Zcl, "DEM: mDelegate.commandData.constraints() FAILURE"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } From db4e85bae8ad42b5921b938d48377c569c684f63 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 26 Dec 2023 10:23:17 +0000 Subject: [PATCH 047/143] Removed stray %s --- .../device-energy-management-server.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 39b0c0e50135f7..60b341022d68cb 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -389,14 +389,12 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, return; } - ChipLogProgress(Zcl, "DEM: Good requestedStartTime %ld.", - static_cast(requestedStartTime)); + ChipLogProgress(Zcl, "DEM: Good requestedStartTime %ld.", static_cast(requestedStartTime)); status = mDelegate.StartTimeAdjustRequest(requestedStartTime); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: StartTimeAdjustRequest(%ld) FAILURE", - static_cast(requestedStartTime)); + ChipLogError(Zcl, "DEM: StartTimeAdjustRequest(%ld) FAILURE", static_cast(requestedStartTime)); return; } } @@ -418,7 +416,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq if (ESAStateEnum::kUserOptOut == mDelegate.GetESAState()) { - ChipLogError(Zcl, "DEM: %s - ESAState = kUserOptOut"); + ChipLogError(Zcl, "DEM: ESAState = kUserOptOut"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } From f7652064f7bae4c43945824adf32d68e1684a615 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 26 Dec 2023 10:46:17 +0000 Subject: [PATCH 048/143] Added FeatureMap handling in sdk (not in ember) --- .../all-clusters-common/all-clusters-app.matter | 4 ++-- .../all-clusters-common/all-clusters-app.zap | 17 ++++++++--------- .../energy-management-app.matter | 4 ++-- .../energy-management-app.zap | 16 ++++++++-------- .../device-energy-management-server.cpp | 3 +++ .../energy-evse-server/energy-evse-server.cpp | 4 ++++ 6 files changed, 27 insertions(+), 21 deletions(-) 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 c79296da267040..6784c9d249fe90 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 @@ -7550,7 +7550,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0; + callback attribute featureMap default = 0; ram attribute clusterRevision default = 2; handle command PowerAdjustRequest; @@ -7592,7 +7592,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0; + callback attribute featureMap default = 0; ram attribute clusterRevision default = 2; handle command GetTargetsResponse; 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 d827e1e122954f..28c219ed59dfa0 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 @@ -8426,7 +8426,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8458,7 +8458,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8474,7 +8474,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8490,7 +8490,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8506,7 +8506,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12117,7 +12117,7 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -12720,7 +12720,7 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -22967,5 +22967,4 @@ } ], "log": [] -} - +} \ No newline at end of file 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 3e841739756f22..d9de9f7e8b79ba 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 @@ -1485,7 +1485,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0; + callback attribute featureMap default = 0; ram attribute clusterRevision default = 2; handle command PowerAdjustRequest; @@ -1533,7 +1533,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 1; + callback attribute featureMap default = 1; ram attribute clusterRevision default = 2; handle command GetTargetsResponse; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index b7d2271cea5b8b..8ed4aa6e2167d7 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -2674,7 +2674,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2690,7 +2690,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2706,7 +2706,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2722,7 +2722,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2738,7 +2738,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2754,7 +2754,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2767,7 +2767,7 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -3370,7 +3370,7 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 60b341022d68cb..02f3a74523567a 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -87,6 +87,9 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); } return aEncoder.Encode(mDelegate.GetForecast()); + /* FeatureMap - is held locally */ + case FeatureMap::Id: + return aEncoder.Encode(mFeature); } /* Allow all other unhandled attributes to fall through to Ember */ diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp index 60f9e24be0f962..949a43867ab141 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp +++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp @@ -125,6 +125,10 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu return aEncoder.Encode(mDelegate.GetSessionEnergyCharged()); case SessionEnergyDischarged::Id: return aEncoder.Encode(mDelegate.GetSessionEnergyDischarged()); + + /* FeatureMap - is held locally */ + case FeatureMap::Id: + return aEncoder.Encode(mFeature); } /* Allow all other unhandled attributes to fall through to Ember */ return CHIP_NO_ERROR; From a098fbdc68253d62357e1c8b2964a39f7d246668 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 27 Dec 2023 12:12:46 +0000 Subject: [PATCH 049/143] Removed extra chip:: --- .../device-energy-management-server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 02f3a74523567a..673f1ea638011f 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -346,7 +346,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (forecast.Value().earliestStartTime.Value().IsNull()) { System::Clock::Milliseconds64 cTMs; - CHIP_ERROR chipError = chip::System::SystemClock().GetClock_RealTimeMS(cTMs); + CHIP_ERROR chipError = System::SystemClock().GetClock_RealTimeMS(cTMs); if (chipError != CHIP_NO_ERROR) { ChipLogError(Zcl, "DEM: Unable to get current time - error=%ld (%s)]", @@ -355,9 +355,9 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, return; } - auto unixEpoch = std::chrono::duration_cast(cTMs).count(); + auto unixEpoch = std::chrono::duration_cast(cTMs).count(); uint32_t chipEpoch = 0; - if (!chip::UnixEpochToChipEpochTime(unixEpoch, chipEpoch)) + if (!UnixEpochToChipEpochTime(unixEpoch, chipEpoch)) { ChipLogError(Zcl, "DEM: unable to convert Unix Epoch time to Matter Epoch Time"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); From dac77cb32ac160d20fcb6b7fa29e6597ec365591 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 27 Dec 2023 12:13:32 +0000 Subject: [PATCH 050/143] Used CHIP_ERROR_FORMAT, err.Format() mechanism --- .../device-energy-management-server.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 673f1ea638011f..96130daa654388 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -346,11 +346,10 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, if (forecast.Value().earliestStartTime.Value().IsNull()) { System::Clock::Milliseconds64 cTMs; - CHIP_ERROR chipError = System::SystemClock().GetClock_RealTimeMS(cTMs); - if (chipError != CHIP_NO_ERROR) + CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); + if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "DEM: Unable to get current time - error=%ld (%s)]", - static_cast(chipError.AsInteger()), chipError.AsString()); + ChipLogError(Zcl, "DEM: Unable to get current time - err:%" CHIP_ERROR_FORMAT, err.Format()); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } From 8ea64dde32ba6ef694f64f7ae5b58ddef9a1442f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 27 Dec 2023 13:01:01 +0000 Subject: [PATCH 051/143] Refactored StartTimeAdjust based on review comments. --- .../device-energy-management-server.cpp | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 96130daa654388..f5c7f4b47a83de 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -307,15 +307,15 @@ void Instance::HandleCancelPowerAdjustRequest(HandlerContext & ctx, void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, const Commands::StartTimeAdjustRequest::DecodableType & commandData) { - Status status = Status::Success; - uint32_t earliestStartTime = 0; - uint32_t latestEndTime = 0; - DataModel::Nullable forecast = mDelegate.GetForecast(); - + Status status = Status::Success; + uint32_t earliestStartTimeEpoch = 0; + uint32_t latestEndTimeEpoch = 0; + uint32_t requestedStartTimeEpoch = commandData.requestedStartTime; uint32_t duration; - uint32_t requestedStartTime = commandData.requestedStartTime; - if (forecast.IsNull()) + DataModel::Nullable forecastNullable = mDelegate.GetForecast(); + + if (forecastNullable.IsNull()) { ChipLogError(Zcl, "DEM: Forecast is Null"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); @@ -329,21 +329,30 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, return; } - /* If the RequestedStartTime value resulted in a time shift which is + /* Temporary variable to save calling .Value() on forecastNullable */ + auto & forecast = forecastNullable.Value(); + + /** + * If the RequestedStartTime value resulted in a time shift which is * outside the time constraints of EarliestStartTime and * LatestEndTime, then the command SHALL be rejected with CONSTRAINT_ERROR; - * otherwise the command SHALL be rejected with FAILURE + * in other failure scenarios the command SHALL be rejected with FAILURE */ - /* earliestStartTime is optional based on the FA (ForecastAdjust) feature AND is nullable */ - if (forecast.Value().earliestStartTime.HasValue() || forecast.Value().latestEndTime.HasValue()) + /* earliestStartTime is optional based on the StartTimeAdjust (STA) feature AND is nullable */ + if (!(forecast.earliestStartTime.HasValue()) || !(forecast.latestEndTime.HasValue())) { - /* These Should not be NULL since this command requires FA feature and these are mandatory for that */ - ChipLogError(Zcl, "DEM: EarliestStartTime / LatestEndTime not valid"); + /* These should not be NULL since this command requires STA feature and these are mandatory for that */ + ChipLogError(Zcl, "DEM: EarliestStartTime / LatestEndTime do not have values"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; } - if (forecast.Value().earliestStartTime.Value().IsNull()) + /* Temporary variable to save keep calling .Value() on the Optional element */ + auto & earliestStartTimeOptional = forecast.earliestStartTime.Value(); + /* Latest End Time is optional & cannot be null - unlike earliestStartTime! */ + latestEndTimeEpoch = forecast.latestEndTime.Value(); + + if (earliestStartTimeOptional.IsNull()) { System::Clock::Milliseconds64 cTMs; CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); @@ -364,39 +373,38 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, } /* Null means - We can start immediately */ - earliestStartTime = chipEpoch; /* NOW */ + earliestStartTimeEpoch = chipEpoch; /* NOW */ } else { - earliestStartTime = forecast.Value().earliestStartTime.Value().Value(); + earliestStartTimeEpoch = earliestStartTimeOptional.Value(); } - /* Latest End Time is optional & cannot be null - unlike earliestStartTime! */ - latestEndTime = forecast.Value().latestEndTime.Value(); - - duration = forecast.Value().endTime - forecast.Value().startTime; // the current entire forecast duration - if (requestedStartTime < earliestStartTime) + duration = forecast.endTime - forecast.startTime; // the current entire forecast duration + if (requestedStartTimeEpoch < earliestStartTimeEpoch) { ChipLogError(Zcl, "DEM: Bad requestedStartTime %ld, earlier than earliestStartTime %ld.", - static_cast(requestedStartTime), static_cast(earliestStartTime)); + static_cast(requestedStartTimeEpoch), + static_cast(earliestStartTimeEpoch)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - if ((requestedStartTime + duration) > latestEndTime) + if ((requestedStartTimeEpoch + duration) > latestEndTimeEpoch) { - ChipLogError(Zcl, "DEM: Bad requestedStartTime + duration %ld, later than latestEndTime %ld.", - static_cast(requestedStartTime + duration), static_cast(latestEndTime)); + ChipLogError(Zcl, "DEM: Bad requestedStartTimeEpoch + duration %ld, later than latestEndTime %ld.", + static_cast(requestedStartTimeEpoch + duration), + static_cast(latestEndTimeEpoch)); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError); return; } - ChipLogProgress(Zcl, "DEM: Good requestedStartTime %ld.", static_cast(requestedStartTime)); - status = mDelegate.StartTimeAdjustRequest(requestedStartTime); + ChipLogProgress(Zcl, "DEM: Good requestedStartTimeEpoch %ld.", static_cast(requestedStartTimeEpoch)); + status = mDelegate.StartTimeAdjustRequest(requestedStartTimeEpoch); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status); if (status != Status::Success) { - ChipLogError(Zcl, "DEM: StartTimeAdjustRequest(%ld) FAILURE", static_cast(requestedStartTime)); + ChipLogError(Zcl, "DEM: StartTimeAdjustRequest(%ld) FAILURE", static_cast(requestedStartTimeEpoch)); return; } } From 7e0e5e737c6e024673f05ce5f8f9490511609435 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 27 Dec 2023 13:14:07 +0000 Subject: [PATCH 052/143] Removed unnecessary Write Attributes function --- .../device-energy-management-server.cpp | 5 ----- .../device-energy-management-server.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index f5c7f4b47a83de..255976b61da748 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -96,11 +96,6 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu return CHIP_NO_ERROR; } -CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) -{ - return CHIP_ERROR_NOT_IMPLEMENTED; // Nothing writable in this cluster ! -} - // CommandHandlerInterface CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & cluster, CommandIdCallback callback, void * context) { diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index 457a3782fed4c5..ce9641104e5db4 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -195,7 +195,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface // AttributeAccessInterface CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; - CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; + // NOTE there are no writable attributes // CommandHandlerInterface void InvokeCommand(HandlerContext & handlerContext) override; From 3f0cdedbc478f219df4cbfcb3fa1d1f32fadea9a Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 27 Dec 2023 18:22:36 +0000 Subject: [PATCH 053/143] Beginnings of Session handling --- .../include/EnergyEvseDelegateImpl.h | 52 +++++++- .../src/EnergyEvseDelegateImpl.cpp | 118 +++++++++++++++++- 2 files changed, 161 insertions(+), 9 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index f3c003d081fc6e..6f80064d2dd9b6 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -31,6 +31,51 @@ namespace app { namespace Clusters { namespace EnergyEvse { +/** + * Helper class to handle all of the session related info + */ +class EvseSession +{ +public: + /** + * @brief This function samples the start-time, and energy meter to hold the session info + * + * @param chargingMeterValue - The current value of the energy meter (charging) in mWh + * @param dischargingMeterValue - The current value of the energy meter (discharging) in mWh + */ + void StartSession(int64_t chargingMeterValue, int64_t dischargingMeterValue); + + /** + * @brief This function updates the session Duration to allow read attributes to return latest values + */ + void RecalculateSessionDuration(); + + /** + * @brief This function updates the EnergyCharged meter value + * + * @param chargingMeterValue - The value of the energy meter (charging) in mWh + */ + void UpdateEnergyCharged(int64_t chargingMeterValue); + + /** + * @brief This function updates the EnergyDischarged meter value + * + * @param dischargingMeterValue - The value of the energy meter (discharging) in mWh + */ + void UpdateEnergyDischarged(int64_t dischargingMeterValue); + + /* Public members - represent attributes in the cluster */ + DataModel::Nullable mSessionID; + DataModel::Nullable mSessionDuration; + DataModel::Nullable mSessionEnergyCharged; + DataModel::Nullable mSessionEnergyDischarged; + +private: + uint32_t mStartTime = 0; // Epoch_s - 0 means it hasn't started yet + int64_t mSessionEnergyChargedAtStart = 0; // in mWh - 0 means it hasn't been set yet + int64_t mSessionEnergyDischargedAtStart = 0; // in mWh - 0 means it hasn't been set yet +}; + /** * The application delegate. */ @@ -193,11 +238,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate /* PNC attributes*/ DataModel::Nullable mVehicleID; - /* Session SESS attributes */ - DataModel::Nullable mSessionID; - DataModel::Nullable mSessionDuration; - DataModel::Nullable mSessionEnergyCharged; - DataModel::Nullable mSessionEnergyDischarged; + /* Session Object */ + EvseSession mSession; }; } // namespace EnergyEvse diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 4cc83eaaf8a835..3ea92aa78d6298 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -831,17 +831,127 @@ DataModel::Nullable EnergyEvseDelegate::GetVehicleID() /* Session SESS attributes */ DataModel::Nullable EnergyEvseDelegate::GetSessionID() { - return mSessionID; + return mSession.mSessionID; } DataModel::Nullable EnergyEvseDelegate::GetSessionDuration() { - return mSessionDuration; + mSession.RecalculateSessionDuration(); + return mSession.mSessionDuration; } DataModel::Nullable EnergyEvseDelegate::GetSessionEnergyCharged() { - return mSessionEnergyCharged; + return mSession.mSessionEnergyCharged; } DataModel::Nullable EnergyEvseDelegate::GetSessionEnergyDischarged() { - return mSessionEnergyDischarged; + return mSession.mSessionEnergyDischarged; +} + +/** + * @brief Helper function to get current timestamp in Epoch format + * + * @param chipEpoch reference to hold return timestamp + */ +CHIP_ERROR GetEpochTS(uint32_t & chipEpoch) +{ + chipEpoch = 0; + + System::Clock::Milliseconds64 cTMs; + CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "EVSE: Unable to get current time - err:%" CHIP_ERROR_FORMAT, err.Format()); + return err; + } + + auto unixEpoch = std::chrono::duration_cast(cTMs).count(); + if (!UnixEpochToChipEpochTime(unixEpoch, chipEpoch)) + { + ChipLogError(Zcl, "EVSE: unable to convert Unix Epoch time to Matter Epoch Time"); + return err; + } + + return CHIP_NO_ERROR; +} + +/** + * @brief This function samples the start-time, and energy meter to hold the session info + * + * @param chargingMeterValue - The current value of the energy meter (charging) in mWh + * @param dischargingMeterValue - The current value of the energy meter (discharging) in mWh + */ +void EvseSession::StartSession(int64_t chargingMeterValue, int64_t dischargingMeterValue) +{ + /* Get Timestamp */ + uint32_t chipEpoch = 0; + if (GetEpochTS(chipEpoch) != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "EVSE: Failed to get timestamp when starting session"); + return; + } + mStartTime = chipEpoch; + + mSessionEnergyChargedAtStart = chargingMeterValue; + mSessionEnergyDischargedAtStart = dischargingMeterValue; + + if (mSessionID.IsNull()) + { + mSessionID = MakeNullable(static_cast(0)); + } + else + { + mSessionID = MakeNullable(mSessionID.Value()++); + } + + /* Reset other session values */ + mSessionDuration = MakeNullable(static_cast(0)); + mSessionEnergyCharged = MakeNullable(static_cast(0)); + mSessionEnergyDischarged = MakeNullable(static_cast(0)); + + // TODO persist mSessionID + // TODO persist mStartTime + // TODO persist mSessionEnergyChargedAtStart + // TODO persist mSessionEnergyDischargedAtStart + + // TODO call MatterReportingAttributeChangeCallback +} + +/** + * @brief This function updates the session attrs to allow read attributes to return latest values + */ +void EvseSession::RecalculateSessionDuration() +{ + /* Get Timestamp */ + uint32_t chipEpoch = 0; + if (GetEpochTS(chipEpoch) != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "EVSE: Failed to get timestamp when updating session duration"); + return; + } + + uint32_t duration = chipEpoch - mStartTime; + mSessionDuration = MakeNullable(duration); + // TODO call MatterReportingAttributeChangeCallback +} + +/** + * @brief This function updates the EnergyCharged meter value + * + * @param chargingMeterValue - The value of the energy meter (charging) in mWh + */ +void EvseSession::UpdateEnergyCharged(int64_t chargingMeterValue) +{ + mSessionEnergyCharged = MakeNullable(chargingMeterValue - mSessionEnergyChargedAtStart); + // TODO call MatterReportingAttributeChangeCallback +} + +/** + * @brief This function updates the EnergyDischarged meter value + * + * @param dischargingMeterValue - The value of the energy meter (discharging) in mWh + */ +void EvseSession::UpdateEnergyDischarged(int64_t dischargingMeterValue) +{ + mSessionEnergyDischarged = MakeNullable(dischargingMeterValue - mSessionEnergyDischargedAtStart); + // TODO call MatterReportingAttributeChangeCallback } From 2990233368235d1e1b8abbe2bd779ff8dd026efb Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 28 Dec 2023 19:50:33 +0000 Subject: [PATCH 054/143] Added beginnings of EVConnected,EVNotDetected,EnergyTransferStarted,EnergyTransferStopped handling. State machine is not finished. Callback to read Energy Meter added --- .../include/EVSECallbacks.h | 17 ++ .../include/EVSEManufacturerImpl.h | 2 + .../include/EnergyEvseDelegateImpl.h | 14 +- .../src/EVSEManufacturerImpl.cpp | 18 +- .../src/EnergyEvseDelegateImpl.cpp | 243 ++++++++++++++++-- 5 files changed, 274 insertions(+), 20 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h index 5bdac2f8e853d6..e72ee80ef9fcca 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h +++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h @@ -44,12 +44,22 @@ enum EVSECallbackType * Charging Preferences have changed */ ChargingPreferencesChanged, + /* + * Energy Meter Reading requested + */ + EnergyMeterReadingRequested, /* * DeviceEnergyManagement has changed */ DeviceEnergyManagementChanged, }; +enum ChargingDischargingType +{ + kCharging, + kDischarging +}; + struct EVSECbInfo { EVSECallbackType type; @@ -68,6 +78,13 @@ struct EVSECbInfo { int64_t maximumChargeCurrent; } ChargingCurrent; + + /* for type = EnergyMeterReadingRequested */ + struct + { + ChargingDischargingType meterType; + int64_t * energyMeterValuePtr; + } EnergyMeterReadingRequest; }; }; diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h index 4ff45e925674aa..4bb7cfb1dcafbf 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h @@ -49,6 +49,8 @@ class EVSEManufacturer static void ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_t arg); private: + int64_t mLastChargingEnergyMeter = 0; + int64_t mLastDischargingEnergyMeter = 0; }; } // namespace EnergyEvse diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 6f80064d2dd9b6..c7be153da04fd0 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -37,6 +37,7 @@ namespace EnergyEvse { class EvseSession { public: + EvseSession(EndpointId aEndpoint) { mEndpointId = aEndpoint; } /** * @brief This function samples the start-time, and energy meter to hold the session info * @@ -71,6 +72,8 @@ class EvseSession DataModel::Nullable mSessionEnergyDischarged; private: + EndpointId mEndpointId = 0; + uint32_t mStartTime = 0; // Epoch_s - 0 means it hasn't started yet int64_t mSessionEnergyChargedAtStart = 0; // in mWh - 0 means it hasn't been set yet int64_t mSessionEnergyDischargedAtStart = 0; // in mWh - 0 means it hasn't been set yet @@ -129,6 +132,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate Status HwSetRFID(ByteSpan uid); Status HwSetVehicleID(const CharSpan & vehID); + Status SendEVConnectedEvent(); + Status SendEVNotDetectedEvent(); + Status SendEnergyTransferStartedEvent(); + Status SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum reason); + // ------------------------------------------------------------------ // Get attribute methods StateEnum GetState() override; @@ -204,6 +212,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */ Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent); Status NotifyApplicationStateChange(); + Status GetEVSEEnergyMeterValue(ChargingDischargingType meterType, int64_t & aMeterValue); /** * @brief Helper function to work out the charge limit based on conditions and settings @@ -239,7 +248,10 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate DataModel::Nullable mVehicleID; /* Session Object */ - EvseSession mSession; + EvseSession mSession = EvseSession(mEndpointId); + + /* Helper variable to hold meter val since last EnergyTransferStarted event */ + int64_t mMeterValueAtEnergyTransferStart; }; } // namespace EnergyEvse diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 8daf1781103831..a49ae50d96a4c0 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -35,7 +35,7 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance) return CHIP_ERROR_UNINITIALIZED; } - dg->HwRegisterEvseCallbackHandler(ApplicationCallbackHandler, reinterpret_cast(nullptr)); + dg->HwRegisterEvseCallbackHandler(ApplicationCallbackHandler, reinterpret_cast(this)); /* Set the EVSE Hardware Maximum current limit */ // For Manufacturer to specify the hardware capability in mA @@ -78,6 +78,8 @@ CHIP_ERROR EVSEManufacturer::Shutdown(EnergyEvseManager * aInstance) */ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_t arg) { + EVSEManufacturer * pClass = reinterpret_cast(arg); + switch (cb->type) { case EVSECallbackType::StateChanged: @@ -87,7 +89,19 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ ChipLogProgress(AppServer, "EVSE callback - maxChargeCurrent changed to %ld", static_cast(cb->ChargingCurrent.maximumChargeCurrent)); break; + case EVSECallbackType::EnergyMeterReadingRequested: + ChipLogProgress(AppServer, "EVSE callback - EnergyMeterReadingRequested"); + if (cb->EnergyMeterReadingRequest.meterType == ChargingDischargingType::kCharging) + { + *(cb->EnergyMeterReadingRequest.energyMeterValuePtr) = pClass->mLastChargingEnergyMeter; + } + else + { + *(cb->EnergyMeterReadingRequest.energyMeterValuePtr) = pClass->mLastDischargingEnergyMeter; + } + break; + default: - ChipLogError(AppServer, "Unhandler EVSE Callback type %d", static_cast(cb->type)); + ChipLogError(AppServer, "Unhandled EVSE Callback type %d", static_cast(cb->type)); } } diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 3ea92aa78d6298..d54e936581e264 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -309,36 +309,95 @@ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA) return this->ComputeMaxChargeCurrentLimit(); } +bool IsEvPluggedIn(StateEnum state) +{ + if ((state == StateEnum::kNotPluggedIn) || (state == StateEnum::kFault) || (state == StateEnum::kSessionEnding)) + { + return false; + } + else + { + return true; + } +} + +bool IsEvTransferringEnergy(StateEnum state) +{ + if ((state == StateEnum::kPluggedInCharging) || (state == StateEnum::kPluggedInDischarging)) + { + return true; + } + else + { + return false; + } +} /** * @brief Called by EVSE Hardware to indicate if EV is detected * - * The only allowed states that the EVSE hardware can set are: + * The only allowed states that the EVSE hardware can tell us about are: * kNotPluggedIn * kPluggedInNoDemand * kPluggedInDemand * + * The actual overall state is more complex and includes faults, + * enable & disable charging or discharging etc. + * * @param StateEnum - the state of the EV being plugged in and asking for demand etc */ -Status EnergyEvseDelegate::HwSetState(StateEnum state) +Status EnergyEvseDelegate::HwSetState(StateEnum newState) { - switch (state) + switch (newState) { case StateEnum::kNotPluggedIn: - // TODO - work out logic here - mHwState = state; - break; - case StateEnum::kPluggedInNoDemand: - // TODO - work out logic here - mHwState = state; + if (IsEvPluggedIn(mState)) + { + /* EV was plugged in, but no longer is */ + mSession.RecalculateSessionDuration(); + if (IsEvTransferringEnergy(mState)) + { + /* + * EV was transferring current - unusual to get to this case without + * first having the state set to kPluggedInNoDemand or kPluggedInDemand + */ + mSession.RecalculateSessionDuration(); + SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kOther); + } + + SendEVNotDetectedEvent(); + SetState(newState); + } break; + + case StateEnum::kPluggedInNoDemand: /* deliberate fall-thru */ case StateEnum::kPluggedInDemand: - // TODO - work out logic here - mHwState = state; + if (IsEvPluggedIn(mState)) + { + /* EV was already plugged in before */ + if (IsEvTransferringEnergy(mState)) + { + mSession.RecalculateSessionDuration(); + SendEnergyTransferStoppedEvent(newState == StateEnum::kPluggedInNoDemand + ? EnergyTransferStoppedReasonEnum::kEVStopped + : EnergyTransferStoppedReasonEnum::kEVSEStopped); + } + SetState(newState); + } + else + { + /* EV was not plugged in - start a new session */ + // TODO get energy meter readings + mSession.StartSession(0, 0); + SendEVConnectedEvent(); + + /* If*/ + + SetState(newState); + } break; default: /* All other states should be managed by the Delegate */ - // TODO (assert?) break; } @@ -507,6 +566,153 @@ Status EnergyEvseDelegate::NotifyApplicationStateChange() return Status::Success; } +Status EnergyEvseDelegate::GetEVSEEnergyMeterValue(ChargingDischargingType meterType, int64_t & aMeterValue) +{ + EVSECbInfo cbInfo; + + cbInfo.type = EVSECallbackType::EnergyMeterReadingRequested; + + cbInfo.EnergyMeterReadingRequest.meterType = meterType; + cbInfo.EnergyMeterReadingRequest.energyMeterValuePtr = &aMeterValue; + + if (mCallbacks.handler != nullptr) + { + mCallbacks.handler(&cbInfo, mCallbacks.arg); + } + + return Status::Success; +} + +Status EnergyEvseDelegate::SendEVConnectedEvent() +{ + Events::EVConnected::Type event; + EventNumber eventNumber; + + if (mSession.mSessionID.IsNull()) + { + ChipLogError(AppServer, "SessionID is Null"); + return Status::Failure; + } + + event.sessionID = mSession.mSessionID.Value(); + + CHIP_ERROR err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to send notify event: %" CHIP_ERROR_FORMAT, err.Format()); + return Status::Failure; + } + return Status::Success; +} + +Status EnergyEvseDelegate::SendEVNotDetectedEvent() +{ + Events::EVNotDetected::Type event; + EventNumber eventNumber; + + if (mSession.mSessionID.IsNull()) + { + ChipLogError(AppServer, "SessionID is Null"); + return Status::Failure; + } + + event.sessionID = mSession.mSessionID.Value(); + event.state = mState; + event.sessionDuration = mSession.mSessionDuration.Value(); + event.sessionEnergyCharged = mSession.mSessionEnergyCharged.Value(); + event.sessionEnergyDischarged = MakeOptional(mSession.mSessionEnergyDischarged.Value()); + + CHIP_ERROR err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to send notify event: %" CHIP_ERROR_FORMAT, err.Format()); + return Status::Failure; + } + return Status::Success; +} + +Status EnergyEvseDelegate::SendEnergyTransferStartedEvent() +{ + Events::EnergyTransferStarted::Type event; + EventNumber eventNumber; + + if (mSession.mSessionID.IsNull()) + { + ChipLogError(AppServer, "SessionID is Null"); + return Status::Failure; + } + + event.sessionID = mSession.mSessionID.Value(); + event.state = mState; + /** + * A positive value indicates the EV has been enabled for charging and the value is + * taken directly from the MaximumChargeCurrent attribute. + * A negative value indicates that the EV has been enabled for discharging and the value can be taken + * from the MaximumDischargeCurrent attribute with its sign inverted. + */ + + if (mState == StateEnum::kPluggedInCharging) + { + /* Sample the energy meter for charging */ + GetEVSEEnergyMeterValue(ChargingDischargingType::kCharging, mMeterValueAtEnergyTransferStart); + event.maximumCurrent = mMaximumChargeCurrent; + } + else if (mState == StateEnum::kPluggedInDischarging) + { + /* Sample the energy meter for discharging */ + GetEVSEEnergyMeterValue(ChargingDischargingType::kDischarging, mMeterValueAtEnergyTransferStart); + + /* discharging should have a negative current */ + event.maximumCurrent = -mMaximumDischargeCurrent; + } + + CHIP_ERROR err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to send notify event: %" CHIP_ERROR_FORMAT, err.Format()); + return Status::Failure; + } + + return Status::Success; +} +Status EnergyEvseDelegate::SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum reason) +{ + Events::EnergyTransferStopped::Type event; + EventNumber eventNumber; + + if (mSession.mSessionID.IsNull()) + { + ChipLogError(AppServer, "SessionID is Null"); + return Status::Failure; + } + + event.sessionID = mSession.mSessionID.Value(); + event.state = mState; + event.reason = reason; + int64_t meterValueNow = 0; + + if (mState == StateEnum::kPluggedInCharging) + { + GetEVSEEnergyMeterValue(ChargingDischargingType::kCharging, meterValueNow); + event.energyTransferred = meterValueNow - mMeterValueAtEnergyTransferStart; + } + else if (mState == StateEnum::kPluggedInDischarging) + { + GetEVSEEnergyMeterValue(ChargingDischargingType::kDischarging, meterValueNow); + + /* discharging should have a negative value */ + event.energyTransferred = mMeterValueAtEnergyTransferStart - meterValueNow; + } + + CHIP_ERROR err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to send notify event: %" CHIP_ERROR_FORMAT, err.Format()); + return Status::Failure; + } + return Status::Success; +} + /** * Attribute methods */ @@ -908,12 +1114,15 @@ void EvseSession::StartSession(int64_t chargingMeterValue, int64_t dischargingMe mSessionEnergyCharged = MakeNullable(static_cast(0)); mSessionEnergyDischarged = MakeNullable(static_cast(0)); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionID::Id); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionDuration::Id); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionEnergyCharged::Id); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionEnergyDischarged::Id); + // TODO persist mSessionID // TODO persist mStartTime // TODO persist mSessionEnergyChargedAtStart // TODO persist mSessionEnergyDischargedAtStart - - // TODO call MatterReportingAttributeChangeCallback } /** @@ -931,7 +1140,7 @@ void EvseSession::RecalculateSessionDuration() uint32_t duration = chipEpoch - mStartTime; mSessionDuration = MakeNullable(duration); - // TODO call MatterReportingAttributeChangeCallback + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionDuration::Id); } /** @@ -942,7 +1151,7 @@ void EvseSession::RecalculateSessionDuration() void EvseSession::UpdateEnergyCharged(int64_t chargingMeterValue) { mSessionEnergyCharged = MakeNullable(chargingMeterValue - mSessionEnergyChargedAtStart); - // TODO call MatterReportingAttributeChangeCallback + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionEnergyCharged::Id); } /** @@ -953,5 +1162,5 @@ void EvseSession::UpdateEnergyCharged(int64_t chargingMeterValue) void EvseSession::UpdateEnergyDischarged(int64_t dischargingMeterValue) { mSessionEnergyDischarged = MakeNullable(dischargingMeterValue - mSessionEnergyDischargedAtStart); - // TODO call MatterReportingAttributeChangeCallback + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionEnergyDischarged::Id); } From c7034536d48f8f5db93affe7e5c8b475f9d12ede Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 29 Dec 2023 00:33:20 +0000 Subject: [PATCH 055/143] Added framework for EVSE Test Event triggers --- .../src/EVSEManufacturerImpl.cpp | 35 +++++++++++++++++++ examples/platform/linux/AppMain.cpp | 10 ++++++ examples/platform/linux/BUILD.gn | 9 ++++- src/app/chip_data_model.gni | 7 ++++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index a49ae50d96a4c0..a8bdb85c35c84d 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -18,7 +18,9 @@ #include #include +#include +using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; @@ -105,3 +107,36 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ ChipLogError(AppServer, "Unhandled EVSE Callback type %d", static_cast(cb->type)); } } + +bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) +{ + EnergyEvseTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case EnergyEvseTrigger::kBasicFunctionality: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality install"); + break; + case EnergyEvseTrigger::kBasicFunctionalityClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality clear"); + break; + case EnergyEvseTrigger::kEVPluggedIn: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV plugged in"); + break; + case EnergyEvseTrigger::kEVPluggedInClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV unplugged"); + break; + case EnergyEvseTrigger::kEVChargeDemand: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge Demand"); + break; + case EnergyEvseTrigger::kEVChargeDemandClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge NoDemand"); + break; + + default: + + return false; + } + + return true; +} \ No newline at end of file diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index 79e3e08edce718..1d2127aad36dba 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -80,6 +80,9 @@ #if CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER #include #endif +#if CHIP_DEVICE_CONFIG_ENABLE_ENERGY_EVSE_TRIGGER +#include +#endif #include #include @@ -552,6 +555,13 @@ void ChipLinuxAppMainLoop(AppMainLoopImplementation * impl) }; otherDelegate = &smokeCOTestEventTriggerDelegate; #endif +#if CHIP_DEVICE_CONFIG_ENABLE_ENERGY_EVSE_TRIGGER + static EnergyEvseTestEventTriggerDelegate energyEvseTestEventTriggerDelegate{ + ByteSpan(LinuxDeviceOptions::GetInstance().testEventTriggerEnableKey), otherDelegate + }; + otherDelegate = &energyEvseTestEventTriggerDelegate; +#endif + // For general testing of TestEventTrigger, we have a common "core" event trigger delegate. static SampleTestEventTriggerDelegate testEventTriggerDelegate; VerifyOrDie(testEventTriggerDelegate.Init(ByteSpan(LinuxDeviceOptions::GetInstance().testEventTriggerEnableKey), diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 46229c5f7ed42c..7c2ea169437b21 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -21,6 +21,7 @@ import("${chip_root}/src/tracing/tracing_args.gni") declare_args() { chip_enable_smoke_co_trigger = false + chip_enable_energy_evse_trigger = false } config("app-main-config") { @@ -37,6 +38,10 @@ source_set("smco-test-event-trigger") { sources = [ "${chip_root}/src/app/clusters/smoke-co-alarm-server/SmokeCOTestEventTriggerDelegate.h" ] } +source_set("energy-evse-test-event-trigger") { + sources = [ "${chip_root}/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h" ] +} + source_set("app-main") { defines = [ "ENABLE_TRACING=${matter_enable_tracing_support}" ] sources = [ @@ -94,7 +99,9 @@ source_set("app-main") { ] } - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=${chip_enable_smoke_co_trigger}" ] + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=${chip_enable_smoke_co_trigger}", + "CHIP_DEVICE_CONFIG_ENABLE_ENERGY_EVSE_TRIGGER=${chip_enable_energy_evse_trigger}" ] + public_configs = [ ":app-main-config" ] } diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index b882c875dc3ac2..835e1467b57e15 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -329,6 +329,13 @@ template("chip_data_model") { "${_app_root}/clusters/${cluster}/${cluster}.cpp", "${_app_root}/clusters/${cluster}/${cluster}.h", ] + } else if (cluster == "energy-evse-server") { + sources += [ + "${_app_root}/clusters/${cluster}/${cluster}.cpp", + "${_app_root}/clusters/${cluster}/${cluster}.h", + "${_app_root}/clusters/${cluster}/EnergyEvseTestEventTriggerDelegate.cpp", + "${_app_root}/clusters/${cluster}/EnergyEvseTestEventTriggerDelegate.h", + ] } else { sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ] } From bfc9bfb5f02309547422b78bb2c436963f40fdc4 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 29 Dec 2023 00:34:18 +0000 Subject: [PATCH 056/143] Added EnergyEvseTestEventTrigger delegates --- .../EnergyEvseTestEventTriggerDelegate.cpp | 42 ++++++++++++ .../EnergyEvseTestEventTriggerDelegate.h | 66 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.cpp create mode 100644 src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h diff --git a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.cpp b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.cpp new file mode 100644 index 00000000000000..78fb87085f3b10 --- /dev/null +++ b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.cpp @@ -0,0 +1,42 @@ +/* + * + * 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. + */ + +#include "EnergyEvseTestEventTriggerDelegate.h" + +using namespace chip::app::Clusters::EnergyEvse; + +namespace chip { + +bool EnergyEvseTestEventTriggerDelegate::DoesEnableKeyMatch(const ByteSpan & enableKey) const +{ + return !mEnableKey.empty() && mEnableKey.data_equal(enableKey); +} + +CHIP_ERROR EnergyEvseTestEventTriggerDelegate::HandleEventTrigger(uint64_t eventTrigger) +{ + if (HandleEnergyEvseTestEventTrigger(eventTrigger)) + { + return CHIP_NO_ERROR; + } + if (mOtherDelegate != nullptr) + { + return mOtherDelegate->HandleEventTrigger(eventTrigger); + } + return CHIP_ERROR_INVALID_ARGUMENT; +} + +} // namespace chip diff --git a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h new file mode 100644 index 00000000000000..489ca7974eefcb --- /dev/null +++ b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +namespace chip { + +enum class EnergyEvseTrigger : uint64_t +{ + // Scenarios + kBasicFunctionality = 0x0099000000000000, // Basic Functionality Test Event | Simulate installation with + // _{A_CIRCUIT_CAPACITY}_=32A and _{A_USER_MAXIMUM_CHARGE_CURRENT}_=32A + kBasicFunctionalityClear = 0x0099000000000001, // Basic Functionality Test Event Clear | End simulation of installation + kEVPluggedIn = 0x0099000000000002, // EV Plugged-in Test Event | Simulate plugging + // the EV into the EVSE using a cable of 63A capacity + kEVPluggedInClear = 0x0099000000000003, // EV Plugged-in Test Event Clear | Simulate unplugging the EV + kEVChargeDemand = 0x0099000000000004, // EV Charge Demand Test Event | Simulate the EV presenting charge demand to the EVSE + kEVChargeDemandClear = 0x0099000000000005, // EV Charge Demand Test Event Clear | Simulate the EV becoming fully charged + +}; + +class EnergyEvseTestEventTriggerDelegate : public TestEventTriggerDelegate +{ +public: + explicit EnergyEvseTestEventTriggerDelegate(const ByteSpan & enableKey, TestEventTriggerDelegate * otherDelegate) : + mEnableKey(enableKey), mOtherDelegate(otherDelegate) + {} + + bool DoesEnableKeyMatch(const ByteSpan & enableKey) const override; + CHIP_ERROR HandleEventTrigger(uint64_t eventTrigger) override; + +private: + ByteSpan mEnableKey; + TestEventTriggerDelegate * mOtherDelegate; +}; + +} // namespace chip + +/** + * @brief User handler for handling the test event trigger + * + * @note If TestEventTrigger is enabled, it needs to be implemented in the app + * + * @param eventTrigger Event trigger to handle + * + * @retval true on success + * @retval false if error happened + */ +bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger); From 590e63f1ed9890d14c61cd106fb332f6c3247f75 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 29 Dec 2023 01:06:11 +0000 Subject: [PATCH 057/143] Restyled by whitespace --- .../energy-management-common/src/EVSEManufacturerImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index a8bdb85c35c84d..7b671e2d73e3bf 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -139,4 +139,4 @@ bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) } return true; -} \ No newline at end of file +} From 451428e8ef1605f6da2cf2283cdc1fed69987db3 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 29 Dec 2023 01:06:14 +0000 Subject: [PATCH 058/143] Restyled by gn --- examples/platform/linux/BUILD.gn | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 7c2ea169437b21..576192ca6cc2f0 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -99,9 +99,10 @@ source_set("app-main") { ] } - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=${chip_enable_smoke_co_trigger}", - "CHIP_DEVICE_CONFIG_ENABLE_ENERGY_EVSE_TRIGGER=${chip_enable_energy_evse_trigger}" ] - + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SMOKE_CO_TRIGGER=${chip_enable_smoke_co_trigger}", + "CHIP_DEVICE_CONFIG_ENABLE_ENERGY_EVSE_TRIGGER=${chip_enable_energy_evse_trigger}", + ] public_configs = [ ":app-main-config" ] } From 22d25045a50d97aa1c58c99121427f5eb4def81f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 29 Dec 2023 08:09:40 +0000 Subject: [PATCH 059/143] Added :energy-evse-test-event-trigger to public_deps to see if it resolves build errors --- examples/platform/linux/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 576192ca6cc2f0..70605c3a7dee44 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -65,6 +65,7 @@ source_set("app-main") { public_deps = [ ":smco-test-event-trigger", + ":energy-evse-test-event-trigger", "${chip_root}/src/lib", "${chip_root}/src/platform/logging:force_stdio", ] From 85c68edf4b298e89db4075b84de078a77893ce5c Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 29 Dec 2023 08:10:28 +0000 Subject: [PATCH 060/143] Restyled by gn --- examples/platform/linux/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 70605c3a7dee44..c926a9998e8207 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -64,8 +64,8 @@ source_set("app-main") { ] public_deps = [ - ":smco-test-event-trigger", ":energy-evse-test-event-trigger", + ":smco-test-event-trigger", "${chip_root}/src/lib", "${chip_root}/src/platform/logging:force_stdio", ] From a897decdbf4a8e55ee4d12991cabe7c30b7c34ff Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 30 Dec 2023 13:13:09 +0000 Subject: [PATCH 061/143] Fixed Darwin compile error - do not use else after return --- .../src/EnergyEvseDelegateImpl.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index d54e936581e264..431886b83a64f2 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -315,10 +315,7 @@ bool IsEvPluggedIn(StateEnum state) { return false; } - else - { - return true; - } + return true; } bool IsEvTransferringEnergy(StateEnum state) @@ -327,10 +324,7 @@ bool IsEvTransferringEnergy(StateEnum state) { return true; } - else - { - return false; - } + return false; } /** * @brief Called by EVSE Hardware to indicate if EV is detected From 9ccf8e557e08e85eec0fd7aaac86c535c50f7947 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 31 Dec 2023 23:35:46 +0000 Subject: [PATCH 062/143] Refactored code so that the EvseManufacturer instance could be retrieved for Test Event triggers --- .../include/EVSEManufacturerImpl.h | 17 ++++- .../src/EVSEManufacturerImpl.cpp | 70 ++++++++++++++----- examples/energy-management-app/linux/main.cpp | 11 ++- 3 files changed, 74 insertions(+), 24 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h index 4bb7cfb1dcafbf..01f46a9d717e19 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h @@ -33,15 +33,26 @@ namespace EnergyEvse { class EVSEManufacturer { public: + EVSEManufacturer(EnergyEvseManager * aInstance) { mInstance = aInstance; } + EnergyEvseManager * GetInstance() { return mInstance; } + EnergyEvseDelegate * GetDelegate() + { + if (mInstance) + { + return mInstance->GetDelegate(); + } + return nullptr; + } + /** * @brief Called at start up to apply hardware settings */ - CHIP_ERROR Init(EnergyEvseManager * aInstance); + CHIP_ERROR Init(); /** * @brief Called at shutdown */ - CHIP_ERROR Shutdown(EnergyEvseManager * aInstance); + CHIP_ERROR Shutdown(); /** * @brief Main Callback handler from delegate to user code @@ -49,6 +60,8 @@ class EVSEManufacturer static void ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_t arg); private: + EnergyEvseManager * mInstance; + int64_t mLastChargingEnergyMeter = 0; int64_t mLastDischargingEnergyMeter = 0; }; diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 7b671e2d73e3bf..682d1b07d77f2c 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -25,12 +25,15 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; -CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance) +/* Function prototype - this should be implemented somewhere in main.cpp or similar */ +EVSEManufacturer * GetEvseManufacturer(); + +CHIP_ERROR EVSEManufacturer::Init() { /* Manufacturers should modify this to do any custom initialisation */ /* Register callbacks */ - EnergyEvseDelegate * dg = aInstance->GetDelegate(); + EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); if (dg == nullptr) { ChipLogError(AppServer, "Delegate is not initialized"); @@ -39,34 +42,28 @@ CHIP_ERROR EVSEManufacturer::Init(EnergyEvseManager * aInstance) dg->HwRegisterEvseCallbackHandler(ApplicationCallbackHandler, reinterpret_cast(this)); - /* Set the EVSE Hardware Maximum current limit */ // For Manufacturer to specify the hardware capability in mA - dg->HwSetMaxHardwareCurrentLimit(32000); + // dg->HwSetMaxHardwareCurrentLimit(32000); // For Manufacturer to specify the CircuitCapacity (e.g. from DIP switches) - dg->HwSetCircuitCapacity(20000); - - /* For now let's pretend the EV is plugged in, and asking for demand */ - dg->HwSetState(StateEnum::kPluggedInDemand); - dg->HwSetCableAssemblyLimit(63000); + // dg->HwSetCircuitCapacity(20000); - /* For now let's pretend the vehicle ID is set */ - dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_123456789")); - dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_9876543210")); + // For now let's pretend the EV is plugged in, and asking for demand + // dg->HwSetState(StateEnum::kPluggedInDemand); + // dg->HwSetCableAssemblyLimit(63000); - /* This next one will fail because it is too long */ - dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_9876543210TOOOOOOOOOOOOOOOOOOO")); + // For now let's pretend the vehicle ID is set + // dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_123456789")); - /* For now let's pretend the RFID sensor was triggered - send an event */ - uint8_t uid[10] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE }; - dg->HwSetRFID(ByteSpan(uid)); + // For now let's pretend the RFID sensor was triggered - send an event + // uint8_t uid[10] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE }; + // dg->HwSetRFID(ByteSpan(uid)); return CHIP_NO_ERROR; } -CHIP_ERROR EVSEManufacturer::Shutdown(EnergyEvseManager * aInstance) +CHIP_ERROR EVSEManufacturer::Shutdown() { - return CHIP_NO_ERROR; } @@ -108,6 +105,35 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ } } +void SetTestEventTrigger_BasicFunctionality() +{ + EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); + + // TODO save the values so we can restore them in the clear event + dg->HwSetCircuitCapacity(32000); + dg->SetUserMaximumChargeCurrent(32000); + dg->HwSetState(StateEnum::kNotPluggedIn); +} +void SetTestEventTrigger_BasicFunctionalityClear() {} + +void SetTestEventTrigger_EVPluggedIn() +{ + EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); + + // TODO save the values so we can restore them in the clear event + dg->HwSetState(StateEnum::kPluggedInNoDemand); +} +void SetTestEventTrigger_EVPluggedInClear() {} + +void SetTestEventTrigger_EVChargeDemand() +{ + EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); + + // TODO save the values so we can restore them in the clear event + dg->HwSetState(StateEnum::kPluggedInDemand); +} +void SetTestEventTrigger_EVChargeDemandClear() {} + bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) { EnergyEvseTrigger trigger = static_cast(eventTrigger); @@ -116,21 +142,27 @@ bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) { case EnergyEvseTrigger::kBasicFunctionality: ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality install"); + SetTestEventTrigger_BasicFunctionality(); break; case EnergyEvseTrigger::kBasicFunctionalityClear: ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => Basic Functionality clear"); + SetTestEventTrigger_BasicFunctionalityClear(); break; case EnergyEvseTrigger::kEVPluggedIn: ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV plugged in"); + SetTestEventTrigger_EVPluggedIn(); break; case EnergyEvseTrigger::kEVPluggedInClear: ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV unplugged"); + SetTestEventTrigger_EVPluggedInClear(); break; case EnergyEvseTrigger::kEVChargeDemand: ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge Demand"); + SetTestEventTrigger_EVChargeDemand(); break; case EnergyEvseTrigger::kEVChargeDemandClear: ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge NoDemand"); + SetTestEventTrigger_EVChargeDemandClear(); break; default: diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp index dddc6f53d76b20..83cdecbe83db15 100644 --- a/examples/energy-management-app/linux/main.cpp +++ b/examples/energy-management-app/linux/main.cpp @@ -39,6 +39,11 @@ static EnergyEvseDelegate * gDelegate = nullptr; static EnergyEvseManager * gInstance = nullptr; static EVSEManufacturer * gEvseManufacturer = nullptr; +EVSEManufacturer * GetEvseManufacturer() +{ + return gEvseManufacturer; +} + void ApplicationInit() { CHIP_ERROR err; @@ -87,7 +92,7 @@ void ApplicationInit() } /* Now create EVSEManufacturer*/ - gEvseManufacturer = new EVSEManufacturer(); + gEvseManufacturer = new EVSEManufacturer(gInstance); if (gEvseManufacturer == nullptr) { ChipLogError(AppServer, "Failed to allocate memory for EvseManufacturer"); @@ -99,7 +104,7 @@ void ApplicationInit() } /* Call Manufacturer specific init */ - err = gEvseManufacturer->Init(gInstance); + err = gEvseManufacturer->Init(); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Init failed on gEvseManufacturer"); @@ -118,7 +123,7 @@ void ApplicationShutdown() ChipLogDetail(AppServer, "Energy Management App: ApplicationShutdown()"); /* Shutdown the EVSEManufacturer*/ - gEvseManufacturer->Shutdown(gInstance); + gEvseManufacturer->Shutdown(); /* Shutdown the Instance - deregister attribute & command handler */ gInstance->Shutdown(); From 57cde7a5ef0ef9d28407cba40959e28d5ba8081b Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 31 Dec 2023 23:36:30 +0000 Subject: [PATCH 063/143] Started adding TC_EEVSE_2_2.py --- src/python_testing/TC_EEVSE_2_2.py | 253 +++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 src/python_testing/TC_EEVSE_2_2.py diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py new file mode 100644 index 00000000000000..bca70f873cc7bf --- /dev/null +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -0,0 +1,253 @@ +# +# 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. + +import datetime +import logging +import time + +import chip.clusters as Clusters +import pytz +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, TestStep +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class TC_EEVSE_2_2(MatterBaseTest): + async def read_evse_attribute_expect_success(self, endpoint, attribute): + full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) + cluster = Clusters.Objects.EnergyEvse + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + + async def write_user_max_charge(self, endpoint, user_max_charge): + result = await self.default_controller.WriteAttribute(self.dut_node_id, + [(endpoint, + Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) + asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") + + async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 60000, + min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( + chargingEnabledUntil=charge_until, + minimumChargeCurrent=6000, + maximumChargeCurrent=60000), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_disable_command(self, endpoint: int = 0, expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), endpoint=1) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + def desc_TC_EEVSE_2_2(self) -> str: + """Returns a description of this test""" + return "5.1.3. [TC-EEVSE-2.2] Primary functionality with DUT as Server" + + def pics_TC_EEVSE_2_2(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + # In this case - there is no feature flags needed to run this test case + return None + + def steps_TC_EEVSE_2_2(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), + TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + ] + + return steps + + async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): + try: + await self.send_single_cmd(endpoint=0, + cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( + enableKey, + eventTrigger) + ) + + except InteractionModelError as e: + asserts.fail(f"Unexpected error returned - {e.status}") + + # TC_EEVSE_2_2 tests steps + async def steps_2_check_test_event_triggers_enabled(self): + full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled + cluster = Clusters.Objects.GeneralDiagnostics + test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) + asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") + + async def steps_3_send_test_event_triggers(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000000) + + @async_test_body + async def test_TC_EEVSE_2_2(self): + print_steps = True + + # Part 1 + self.step("1") + + # Part 2 + self.step("2") + await self.steps_2_check_test_event_triggers_enabled() + + # Part 3 + self.step("3") + await self.steps_3_send_test_event_triggers() + self.step("3a") + state = await self.read_evse_attribute_expect_success(endpoint=1, attribute="State") + asserts.assert_equal(state, Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn, + f"Unexpected State value - expected kNotPluggedIn (0), was {state}") + self.step("3b") + self.step("3c") + self.step("3d") + self.print_step("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)") + self.print_step("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)") + self.print_step("3d", "TH reads from the DUT the SessionID attribute") + + # Part 4 + self.print_step("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event") + self.print_step("4", "Verify Event EEVSE.S.E00(EVConnected) sent") + + self.print_step("4a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)") + + # Part 5 + self.print_step( + "5", "TH sends command EnableCharging with ChargingEnabledUntil=2 minutes in the future, minimumChargeCurrent=6000, maximumChargeCurrent=60000") + # get epoch time for ChargeUntil variable (2 minutes from now) + utc_time_2_mins = datetime.datetime.now(pytz.utc) + datetime.timedelta(minutes=2) + epoch_time = (utc_time_2_mins - datetime.datetime(2000, 1, 1, tzinfo=pytz.utc)).total_seconds() + await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=6000, max_charge=60000) + + # Part 6 + self.print_step("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event") + self.print_step("6", "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent") + + self.print_step('6a', 'TH reads from the DUT the State attribute. Verify it is 3 (PluggedinCharging)') + current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') + asserts.assert_equal(current_state, 3, f'State should be 3, but is actually {current_state}') + + self.print_step('6b', 'TH reads from the DUT the SupplyState attribute. Verify it is 1 (ChargingEnabled)') + current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') + asserts.assert_equal(current_supply_state, 1, f'SupplyState should be 1, but is actually {current_supply_state}') + + self.print_step('6c', f'TH reads from the DUT the ChargingEnabledUntil attribute. Verify it is the {epoch_time}') + charge_until_time = await self.read_evse_attribute_expect_success(endpoint=1, attribute='ChargingEnabledUntil') + asserts.assert_equal(charge_until_time, epoch_time, + f'ChargingEnabledUntil should be {epoch_time}, but is actually {charge_until_time}') + + self.print_step('6d', 'TH reads from the DUT the MinimumChargeCurrent attribute. Verify it is the commanded value (6000)') + minimum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MinimumChargeCurrent') + asserts.assert_equal(minimum_charge_value, 6000, + f'MinimumChargeValue should be 6000, but is actually {minimum_charge_value}') + + self.print_step( + '6e', 'TH reads from the DUT the MaximumChargeCurrent attribute. Verify it is the MIN(command value (60000), CircuitCapacity)') + maximum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MinimumChargeCurrent') + circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute='CircuitCapacity') + expected_max_charge = min(6000, circuit_capacity) + asserts.assert_equal(maximum_charge_value, expected_max_charge, + f'MaximumChargeValue should be {expected_max_charge}, but is actually {maximum_charge_value}') + + # Part 7 + self.print_step(7, 'Wait for 2 minutes') + time.sleep(120) + + self.print_step('7a', 'TH reads from the DUT the State attribute. Verify it is 2 (PluggedinDemand)') + current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') + asserts.assert_equal(current_state, 2, f'State should be 2, but is actually {current_state}') + + self.print_step('7b', 'TH reads from the DUT the SupplyState attribute. Verify it is 0 (Disabled)') + current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') + asserts.assert_equal(current_supply_state, 0, f'SupplyState should be 0, but is actually {current_supply_state}') + + # Part 8 + self.print_step( + 8, 'TH sends command EnableCharging with ChargingEnabledUntil=NULL, minimumChargeCurrent = 6000, maximumChargeCurrent=12000') + await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=6000, max_charge=12000) + + self.print_step('8a', 'TH reads from the DUT the State attribute. Verify it is 3 (PluggedinCharging)') + current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') + asserts.assert_equal(current_state, 3, f'State should be 3, but is actually {current_state}') + + self.print_step('8b', 'TH reads from the DUT the SupplyState attribute. Verify it is 1 (ChargingEnabled)') + current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') + asserts.assert_equal(current_supply_state, 1, f'SupplyState should be 1, but is actually {current_supply_state}') + + self.print_step('8c', f'TH reads from the DUT the ChargingEnabledUntil attribute. Verify it is the {epoch_time}') + charge_until_time = await self.read_evse_attribute_expect_success(endpoint=1, attribute='ChargingEnabledUntil') + asserts.assert_equal(charge_until_time, epoch_time, + f'ChargingEnabledUntil should be {epoch_time}, but is actually {charge_until_time}') + + self.print_step('8d', 'TH reads from the DUT the MinimumChargeCurrent attribute. Verify it is the commanded value (6000)') + minimum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MinimumChargeCurrent') + asserts.assert_equal(minimum_charge_value, 6000, + f'MinimumChargeValue should be 6000, but is actually {minimum_charge_value}') + + self.print_step( + '8e', 'TH reads from the DUT the MaximumChargeCurrent attribute. Verify it is the MIN(command value (60000), CircuitCapacity)') + maximum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MaximumChargeCurrent') + circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute='CircuitCapacity') + expected_max_charge = min(12000, circuit_capacity) + asserts.assert_equal(maximum_charge_value, expected_max_charge, + f'MaximumChargeValue should be {expected_max_charge}, but is actually {maximum_charge_value}') + + # Part 9 + # This may not work as the optional attribute may not be currently supported. + self.print_step(9, 'If the optional attribute is supported TH writes to the DUT UserMaximumChargeCurrent=6000') + self.write_user_max_charge(1, user_max_charge=6000) + + self.print_step('9a', 'After a few seconds TH reads from the DUT the MaximumChargeCurrent') + time.sleep(3) + maximum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MaximumChargeCurrent') + circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute='CircuitCapacity') + expected_max_charge = min(maximum_charge_value, circuit_capacity) + asserts.assert_equal(maximum_charge_value, expected_max_charge, + f'MaximumChargeValue should be {expected_max_charge}, but is actually {maximum_charge_value}') + + # Part 10 - TODO Requires Test Event Triggers + + # Part 11 - TODO Requires Test Event Triggers + + # Part 12 - TODO Requires Test Event Triggers + + # Part 13 + self.print_step(13, 'TH sends a Disable command') + await self.send_disable_command(endpoint=1) + + self.print_step('13a', 'TH reads from the DUT the State attribute. Verify it is 2 (PluggedinDemand)') + current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') + asserts.assert_equal(current_state, 2, f'State should be 2, but is actually {current_state}') + + self.print_step('13b', 'TH reads from the DUT the SupplyState attribute. Verify it is 0 (Disabled)') + current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') + asserts.assert_equal(current_supply_state, 0, f'SupplyState should be 0, but is actually {current_supply_state}') + + # Part 14 - TODO Requires Test Event Triggers + + # Part 15 - TODO Requires Test Event Triggers + + # Part 16 - TODO Requires Test Event Triggers + + +if __name__ == "__main__": + default_matter_test_main() From b775fedc73381e25586c99729b5f68b8e0741f80 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 1 Jan 2024 22:09:43 +0000 Subject: [PATCH 064/143] Updated TC_EEVSE_2_2.py to support test events. Still needs to handle reading of Logged Events and verifying they are correct. --- src/python_testing/TC_EEVSE_2_2.py | 346 ++++++++++++++++++----------- 1 file changed, 220 insertions(+), 126 deletions(-) diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index bca70f873cc7bf..d7968f8e6989e5 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -33,6 +33,14 @@ async def read_evse_attribute_expect_success(self, endpoint, attribute): cluster = Clusters.Objects.EnergyEvse return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + async def check_evse_attribute(self, attribute, expected_value): + value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) + asserts.assert_equal(value, expected_value, + f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + + async def get_supported_energy_evse_attributes(self, endpoint): + return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") + async def write_user_max_charge(self, endpoint, user_max_charge): result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, @@ -74,6 +82,48 @@ def steps_TC_EEVSE_2_2(self) -> list[TestStep]: TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), + TestStep("3d", "TH reads from the DUT the SessionID attribute"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), + TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("5", "TH sends command EnableCharging with ChargingEnabledUntil=2 minutes in the future, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x3 (PluggedInCharging)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x1 (ChargingEnabled)"), + TestStep("6c", "TH reads from the DUT the ChargingEnabledUntil attribute. Verify value is the commanded value"), + TestStep("6d", "TH reads from the DUT the MinimumChargeCurrent attribute. Verify value is the commanded value (6000)"), + TestStep("6e", "TH reads from the DUT the MaximumChargeCurrent attribute. Verify value is the min(command value (60000), CircuitCapacity)"), + TestStep("7", "Wait 2 minutes. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvseStopped"), + TestStep("7a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), + TestStep("7b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("8", "TH sends command EnableCharging with ChargingEnabledUntil=NULL, minimumChargeCurrent = 6000, maximumChargeCurrent=12000"), + TestStep("8a", "TH reads from the DUT the State attribute. Verify value is 0x03 (PluggedInCharging)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 1 (ChargingEnabled)"), + TestStep("8c", "TH reads from the DUT the ChargingEnabledUntil attribute. Verify value is the commanded value (NULL)"), + TestStep("8d", "TH reads from the DUT the MinimumChargeCurrent attribute. Verify value is the commanded value (6000)"), + TestStep("8d", "TH reads from the DUT the MaximumChargeCurrent attribute. Verify value is the MIN(command value (60000), CircuitCapacity)"), + TestStep("9", "If the optional attribute is supported TH writes to the DUT UserMaximumChargeCurrent=6000"), + TestStep("9a", "After a few seconds TH reads from the DUT the MaximumChargeCurrent. Verify value is UserMaximumChargeCurrent value (6000)"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), + TestStep("10a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("11a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), + TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), + TestStep("12a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), + TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("13a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("13b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x01 (ChargingEnabled)"), + TestStep("13c", "TH reads from the DUT the SessionID attribute. Verify value is the same value noted in 5c"), + TestStep("13d", "TH reads from the DUT the SessionDuration attribute. Verify value is greater than 120 (and match the time taken for the tests from step 4 to step 13)"), + TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), + TestStep("14a", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("14b", "TH reads from the DUT the SessionID attribute. Verify value is 1 more than the value noted in 5c"), + TestStep("15", "TH sends command Disable. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvseStopped"), + TestStep("15a", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear."), + TestStep("17", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), ] return steps @@ -90,163 +140,207 @@ async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]) asserts.fail(f"Unexpected error returned - {e.status}") # TC_EEVSE_2_2 tests steps - async def steps_2_check_test_event_triggers_enabled(self): + async def check_test_event_triggers_enabled(self): full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled cluster = Clusters.Objects.GeneralDiagnostics test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") - async def steps_3_send_test_event_triggers(self): + async def send_test_event_trigger_basic(self): await self.send_test_event_triggers(eventTrigger=0x0099000000000000) + async def send_test_event_trigger_basic_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000001) + + async def send_test_event_trigger_pluggedin(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000002) + + async def send_test_event_trigger_pluggedin_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000003) + + async def send_test_event_trigger_charge_demand(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000004) + + async def send_test_event_trigger_charge_demand_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000005) + @async_test_body async def test_TC_EEVSE_2_2(self): - print_steps = True - - # Part 1 self.step("1") + # Commission DUT - already done - # Part 2 self.step("2") - await self.steps_2_check_test_event_triggers_enabled() + await self.check_test_event_triggers_enabled() - # Part 3 self.step("3") - await self.steps_3_send_test_event_triggers() + await self.send_test_event_trigger_basic() + + # After a few seconds... + time.sleep(3) + self.step("3a") - state = await self.read_evse_attribute_expect_success(endpoint=1, attribute="State") - asserts.assert_equal(state, Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn, - f"Unexpected State value - expected kNotPluggedIn (0), was {state}") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + self.step("3b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + self.step("3c") + await self.check_evse_attribute("FaultState", Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError) + self.step("3d") - self.print_step("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)") - self.print_step("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)") - self.print_step("3d", "TH reads from the DUT the SessionID attribute") + # Save Session ID - it may be NULL at this point + session_id = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionID") - # Part 4 - self.print_step("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event") - self.print_step("4", "Verify Event EEVSE.S.E00(EVConnected) sent") + self.step("4") + await self.send_test_event_trigger_pluggedin() + # TODO check PluggedIn Event - self.print_step("4a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)") + self.step("4a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) - # Part 5 - self.print_step( - "5", "TH sends command EnableCharging with ChargingEnabledUntil=2 minutes in the future, minimumChargeCurrent=6000, maximumChargeCurrent=60000") + self.step("5") + charging_duration = 5 # TODO test plan spec says 120s - reduced for now + min_charge_current = 6000 + max_charge_current = 60000 # get epoch time for ChargeUntil variable (2 minutes from now) - utc_time_2_mins = datetime.datetime.now(pytz.utc) + datetime.timedelta(minutes=2) - epoch_time = (utc_time_2_mins - datetime.datetime(2000, 1, 1, tzinfo=pytz.utc)).total_seconds() - await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=6000, max_charge=60000) - - # Part 6 - self.print_step("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event") - self.print_step("6", "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent") - - self.print_step('6a', 'TH reads from the DUT the State attribute. Verify it is 3 (PluggedinCharging)') - current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') - asserts.assert_equal(current_state, 3, f'State should be 3, but is actually {current_state}') - - self.print_step('6b', 'TH reads from the DUT the SupplyState attribute. Verify it is 1 (ChargingEnabled)') - current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') - asserts.assert_equal(current_supply_state, 1, f'SupplyState should be 1, but is actually {current_supply_state}') - - self.print_step('6c', f'TH reads from the DUT the ChargingEnabledUntil attribute. Verify it is the {epoch_time}') - charge_until_time = await self.read_evse_attribute_expect_success(endpoint=1, attribute='ChargingEnabledUntil') - asserts.assert_equal(charge_until_time, epoch_time, - f'ChargingEnabledUntil should be {epoch_time}, but is actually {charge_until_time}') - - self.print_step('6d', 'TH reads from the DUT the MinimumChargeCurrent attribute. Verify it is the commanded value (6000)') - minimum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MinimumChargeCurrent') - asserts.assert_equal(minimum_charge_value, 6000, - f'MinimumChargeValue should be 6000, but is actually {minimum_charge_value}') - - self.print_step( - '6e', 'TH reads from the DUT the MaximumChargeCurrent attribute. Verify it is the MIN(command value (60000), CircuitCapacity)') - maximum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MinimumChargeCurrent') - circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute='CircuitCapacity') - expected_max_charge = min(6000, circuit_capacity) - asserts.assert_equal(maximum_charge_value, expected_max_charge, - f'MaximumChargeValue should be {expected_max_charge}, but is actually {maximum_charge_value}') - - # Part 7 - self.print_step(7, 'Wait for 2 minutes') - time.sleep(120) - - self.print_step('7a', 'TH reads from the DUT the State attribute. Verify it is 2 (PluggedinDemand)') - current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') - asserts.assert_equal(current_state, 2, f'State should be 2, but is actually {current_state}') - - self.print_step('7b', 'TH reads from the DUT the SupplyState attribute. Verify it is 0 (Disabled)') - current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') - asserts.assert_equal(current_supply_state, 0, f'SupplyState should be 0, but is actually {current_supply_state}') - - # Part 8 - self.print_step( - 8, 'TH sends command EnableCharging with ChargingEnabledUntil=NULL, minimumChargeCurrent = 6000, maximumChargeCurrent=12000') - await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=6000, max_charge=12000) - - self.print_step('8a', 'TH reads from the DUT the State attribute. Verify it is 3 (PluggedinCharging)') - current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') - asserts.assert_equal(current_state, 3, f'State should be 3, but is actually {current_state}') - - self.print_step('8b', 'TH reads from the DUT the SupplyState attribute. Verify it is 1 (ChargingEnabled)') - current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') - asserts.assert_equal(current_supply_state, 1, f'SupplyState should be 1, but is actually {current_supply_state}') - - self.print_step('8c', f'TH reads from the DUT the ChargingEnabledUntil attribute. Verify it is the {epoch_time}') - charge_until_time = await self.read_evse_attribute_expect_success(endpoint=1, attribute='ChargingEnabledUntil') - asserts.assert_equal(charge_until_time, epoch_time, - f'ChargingEnabledUntil should be {epoch_time}, but is actually {charge_until_time}') - - self.print_step('8d', 'TH reads from the DUT the MinimumChargeCurrent attribute. Verify it is the commanded value (6000)') - minimum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MinimumChargeCurrent') - asserts.assert_equal(minimum_charge_value, 6000, - f'MinimumChargeValue should be 6000, but is actually {minimum_charge_value}') - - self.print_step( - '8e', 'TH reads from the DUT the MaximumChargeCurrent attribute. Verify it is the MIN(command value (60000), CircuitCapacity)') - maximum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MaximumChargeCurrent') - circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute='CircuitCapacity') - expected_max_charge = min(12000, circuit_capacity) - asserts.assert_equal(maximum_charge_value, expected_max_charge, - f'MaximumChargeValue should be {expected_max_charge}, but is actually {maximum_charge_value}') - - # Part 9 - # This may not work as the optional attribute may not be currently supported. - self.print_step(9, 'If the optional attribute is supported TH writes to the DUT UserMaximumChargeCurrent=6000') - self.write_user_max_charge(1, user_max_charge=6000) - - self.print_step('9a', 'After a few seconds TH reads from the DUT the MaximumChargeCurrent') - time.sleep(3) - maximum_charge_value = await self.read_evse_attribute_expect_success(endpoint=1, attribute='MaximumChargeCurrent') - circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute='CircuitCapacity') - expected_max_charge = min(maximum_charge_value, circuit_capacity) - asserts.assert_equal(maximum_charge_value, expected_max_charge, - f'MaximumChargeValue should be {expected_max_charge}, but is actually {maximum_charge_value}') + utc_time_charging_end = datetime.datetime.now(pytz.utc) + datetime.timedelta(seconds=charging_duration) + epoch_time = (utc_time_charging_end - datetime.datetime(2000, 1, 1, tzinfo=pytz.utc)).total_seconds() + await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=min_charge_current, max_charge=max_charge_current) + + self.step("6") + await self.send_test_event_trigger_charge_demand() + # TODO check EnergyTransferStarted Event + + self.step("6a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) + + self.step("6b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("6c") + await self.check_evse_attribute("ChargingEnabledUntil", epoch_time) + + self.step("6d") + await self.check_evse_attribute("MinimumChargeCurrent", min_charge_current) + + self.step("6e") + circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute="CircuitCapacity") + expected_max_charge = min(max_charge_current, circuit_capacity) + await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) + + self.step("7") + # Sleep for the charging duration plus a couple of seconds to check it has stopped + time.sleep(charging_duration + 2) + # TODO check EnergyTransferredStoped (EvseStopped) + + self.step("7a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand) + + self.step("7b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + + self.step("8") + charge_until = None + min_charge_current = 6000 + max_charge_current = 12000 + + await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + + self.step("8a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) + + self.step("8b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("8c") + await self.check_evse_attribute("ChargingEnabledUntil", charge_until) + + self.step("8d") + await self.check_evse_attribute("MinimumChargeCurrent", min_charge_current) + + self.step("8e") + circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute="CircuitCapacity") + expected_max_charge = min(max_charge_current, circuit_capacity) + await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) + + self.step("9") + # This will only work if the optional UserMaximumChargeCurrent attribute is supported + if Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent.attribute_id in self.get_supported_energy_evse_attributes(): + logging.info("UserMaximumChargeCurrent is supported...") + user_max_charge_current = 6000 + self.write_user_max_charge(1, user_max_charge_current) + + self.step("9a") + time.sleep(3) + + expected_max_charge = min(user_max_charge_current, circuit_capacity) + await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) + else: + logging.info("UserMaximumChargeCurrent is NOT supported... skipping.") + + self.step("10") + await self.send_test_event_trigger_charge_demand_clear() + # TODO Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped + + self.step("10a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) + + self.step("11") + await self.send_test_event_trigger_charge_demand() + # TODO Verify Event EEVSE.S.E03(EnergyTransferStarted) sent + + self.step("12") + await self.send_test_event_trigger_charge_demand_clear() + # TODO Verify Event EEVSE.S.E03(EnergyTransferStopped with reason EvStopped) sent + + self.step("12a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) + + self.step("13") + await self.send_test_event_trigger_pluggedin_clear() + # TODO Verify EVNotDetected sent + + self.step("13a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + + self.step("13b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("13c") + await self.check_evse_attribute("SessionID", session_id) - # Part 10 - TODO Requires Test Event Triggers + self.step("13d") + session_duration = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionDuration") + asserts.assert_greater_equal(session_duration, charging_duration, + f"Unexpected 'SessionDuration' value - expected >= {charging_duration}, was {session_duration}") - # Part 11 - TODO Requires Test Event Triggers + self.step("14") + await self.send_test_event_trigger_pluggedin() + # TODO check PluggedIn Event - # Part 12 - TODO Requires Test Event Triggers + self.step("14a") + await self.send_test_event_trigger_charge_demand() + # TODO check EnergyTransferStarted Event - # Part 13 - self.print_step(13, 'TH sends a Disable command') - await self.send_disable_command(endpoint=1) + self.step("14b") + await self.check_evse_attribute("SessionID", session_id + 1) - self.print_step('13a', 'TH reads from the DUT the State attribute. Verify it is 2 (PluggedinDemand)') - current_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='State') - asserts.assert_equal(current_state, 2, f'State should be 2, but is actually {current_state}') + self.step("15") + await self.send_disable_command() + # TODO Verify Event EEVSE.S.E03(EnergyTransferStopped with reason EvseStopped) sent - self.print_step('13b', 'TH reads from the DUT the SupplyState attribute. Verify it is 0 (Disabled)') - current_supply_state = await self.read_evse_attribute_expect_success(endpoint=1, attribute='SupplyState') - asserts.assert_equal(current_supply_state, 0, f'SupplyState should be 0, but is actually {current_supply_state}') + self.step("15a") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) - # Part 14 - TODO Requires Test Event Triggers + self.step("16") + await self.send_test_event_trigger_charge_demand_clear() - # Part 15 - TODO Requires Test Event Triggers + self.step("17") + await self.send_test_event_trigger_pluggedin_clear() + # TODO Verify EVNotDetected sent - # Part 16 - TODO Requires Test Event Triggers + self.step("18") + await self.send_test_event_trigger_basic_clear() if __name__ == "__main__": From 80756576cabb930f63c8ca6ecde97a4eb521046e Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 1 Jan 2024 22:10:57 +0000 Subject: [PATCH 065/143] Refactored Handling of TestEvents to allow clear, and better error handling. --- .../include/EnergyEvseDelegateImpl.h | 1 + .../src/EVSEManufacturerImpl.cpp | 56 ++++++++++++++++--- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index c7be153da04fd0..2be194e23640f7 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -128,6 +128,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate Status HwSetCircuitCapacity(int64_t currentmA); Status HwSetCableAssemblyLimit(int64_t currentmA); Status HwSetState(StateEnum state); + StateEnum HwGetState() { return mHwState; }; Status HwSetFault(FaultStateEnum fault); Status HwSetRFID(ByteSpan uid); Status HwSetVehicleID(const CharSpan & vehID); diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 682d1b07d77f2c..1bde91ac89dd83 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -105,34 +105,72 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ } } +struct EVSETestEventSaveData +{ + int64_t mOldCircuitCapacity; + int64_t mOldUserMaximumChargeCurrent; + StateEnum mOldHwStateBasic; /* For storing hwState before Basic Func event */ + StateEnum mOldHwStatePluggedIn; /* For storing hwState before PluggedIn event */ + StateEnum mOldHwStatePluggedInDemand; /* For storing hwState before PluggedInDemand event */ +}; + +static EVSETestEventSaveData sEVSETestEventSaveData; + +EnergyEvseDelegate * GetEvseDelegate() +{ + EVSEManufacturer * mn = GetEvseManufacturer(); + VerifyOrDieWithMsg(mn != nullptr, AppServer, "EVSEManufacturer is null"); + EnergyEvseDelegate * dg = mn->GetDelegate(); + VerifyOrDieWithMsg(dg != nullptr, AppServer, "EVSE Delegate is null"); + + return dg; +} + void SetTestEventTrigger_BasicFunctionality() { - EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); + EnergyEvseDelegate * dg = GetEvseDelegate(); - // TODO save the values so we can restore them in the clear event + sEVSETestEventSaveData.mOldCircuitCapacity = dg->GetCircuitCapacity(); + sEVSETestEventSaveData.mOldUserMaximumChargeCurrent = dg->GetUserMaximumChargeCurrent(); + sEVSETestEventSaveData.mOldHwStateBasic = dg->HwGetState(); dg->HwSetCircuitCapacity(32000); dg->SetUserMaximumChargeCurrent(32000); dg->HwSetState(StateEnum::kNotPluggedIn); } -void SetTestEventTrigger_BasicFunctionalityClear() {} +void SetTestEventTrigger_BasicFunctionalityClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + dg->HwSetCircuitCapacity(sEVSETestEventSaveData.mOldCircuitCapacity); + dg->SetUserMaximumChargeCurrent(sEVSETestEventSaveData.mOldUserMaximumChargeCurrent); + dg->HwSetState(sEVSETestEventSaveData.mOldHwStateBasic); +} void SetTestEventTrigger_EVPluggedIn() { - EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); + EnergyEvseDelegate * dg = GetEvseDelegate(); - // TODO save the values so we can restore them in the clear event + sEVSETestEventSaveData.mOldHwStatePluggedIn = dg->HwGetState(); dg->HwSetState(StateEnum::kPluggedInNoDemand); } -void SetTestEventTrigger_EVPluggedInClear() {} +void SetTestEventTrigger_EVPluggedInClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedIn); +} void SetTestEventTrigger_EVChargeDemand() { - EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); + EnergyEvseDelegate * dg = GetEvseDelegate(); - // TODO save the values so we can restore them in the clear event + sEVSETestEventSaveData.mOldHwStatePluggedInDemand = dg->HwGetState(); dg->HwSetState(StateEnum::kPluggedInDemand); } -void SetTestEventTrigger_EVChargeDemandClear() {} +void SetTestEventTrigger_EVChargeDemandClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedInDemand); +} bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) { From 8631c077ea8612a8b83a27d1d95095276eb98cf6 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 2 Jan 2024 01:07:17 +0000 Subject: [PATCH 066/143] Refactored state handling by decomposing into state machine events where similar functions are performed based on state transition. Fixed TC chargingEnabledUntil cast to int. Note gets to step 6e --- .../include/EnergyEvseDelegateImpl.h | 26 ++ .../src/EnergyEvseDelegateImpl.cpp | 370 ++++++++++++------ src/python_testing/TC_EEVSE_2_2.py | 2 +- 3 files changed, 287 insertions(+), 111 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 2be194e23640f7..2c3fcf8c58d5ac 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -31,6 +31,20 @@ namespace app { namespace Clusters { namespace EnergyEvse { +/* Local state machine Events to allow simpler handling of state transitions */ +enum EVSEStateMachineEvent +{ + EVPluggedInEvent, /* EV has been plugged in */ + EVNotDetectedEvent, /* EV has been unplugged or detected as not connected */ + EVNoDemandEvent, /* EV has stopped asking for demand */ + EVDemandEvent, /* EV has asked for demand*/ + ChargingEnabledEvent, /* Charging has been enabled */ + DischargingEnabledEvent, /* Discharging has been enabled */ + DisabledEvent, /* EVSE has been disabled */ + FaultRaised, /* Fault has been raised */ + FaultCleared, /* Fault has been cleared */ +}; + /** * Helper class to handle all of the session related info */ @@ -215,6 +229,18 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate Status NotifyApplicationStateChange(); Status GetEVSEEnergyMeterValue(ChargingDischargingType meterType, int64_t & aMeterValue); + /* Local State machine handling */ + Status HandleStateMachineEvent(EVSEStateMachineEvent event); + Status HandleEVPluggedInEvent(); + Status HandleEVNotDetectedEvent(); + Status HandleEVNoDemandEvent(); + Status HandleEVDemandEvent(); + Status HandleChargingEnabledEvent(); + Status HandleDischargingEnabledEvent(); + Status HandleDisabledEvent(); + Status HandleFaultRaised(); + Status HandleFaultCleared(); + /** * @brief Helper function to work out the charge limit based on conditions and settings */ diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 431886b83a64f2..640336e8fdb373 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -48,30 +48,6 @@ Status EnergyEvseDelegate::Disable() { ChipLogProgress(AppServer, "EnergyEvseDelegate::Disable()"); - /* Update State */ - switch (mHwState) - { - case StateEnum::kNotPluggedIn: - SetState(StateEnum::kNotPluggedIn); - break; - - case StateEnum::kPluggedInNoDemand: - SetState(StateEnum::kPluggedInNoDemand); - break; - - case StateEnum::kPluggedInDemand: - SetState(StateEnum::kPluggedInDemand); - break; - - default: - ChipLogError(AppServer, "Unexpected EVSE hardware state"); - SetState(StateEnum::kFault); - break; - } - - /* update SupplyState */ - SetSupplyState(SupplyStateEnum::kDisabled); - /* update ChargingEnabledUntil & DischargingEnabledUntil to show 0 */ SetChargingEnabledUntil(0); SetDischargingEnabledUntil(0); @@ -83,10 +59,7 @@ Status EnergyEvseDelegate::Disable() /* update MaximumDischargeCurrent to 0 */ SetMaximumDischargeCurrent(0); - NotifyApplicationStateChange(); - // TODO: Generate events - - return Status::Success; + return HandleStateMachineEvent(EVSEStateMachineEvent::DisabledEvent); } /** @@ -128,51 +101,19 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable & { /* check chargingEnabledUntil is in the future */ ChipLogError(AppServer, "Charging enabled until: %lu", static_cast(chargingEnabledUntil.Value())); - // TODO + SetChargingEnabledUntil(chargingEnabledUntil.Value()); + // TODO start a timer to disable charging later // if (checkChargingEnabled) } - /* Check current state isn't already enabled */ - - /* If charging is already enabled, check that the parameters may have - changed, these may override an existing charging command */ - switch (mHwState) - { - case StateEnum::kNotPluggedIn: - // TODO handle errors here - SetState(StateEnum::kNotPluggedIn); - break; - - case StateEnum::kPluggedInNoDemand: - // TODO handle errors here - // TODO REFACTOR per Andrei's comment in PR30857 - can we collapse this switch statement? - SetState(StateEnum::kPluggedInNoDemand); - break; - - case StateEnum::kPluggedInDemand: - /* If the EVSE is asking for demand then enable charging */ - SetState(StateEnum::kPluggedInCharging); - break; - - default: - ChipLogError(AppServer, "Unexpected EVSE hardware state"); - SetState(StateEnum::kFault); - break; - } - - /* update SupplyState to say that charging is now enabled */ - SetSupplyState(SupplyStateEnum::kChargingEnabled); - /* If it looks ok, store the min & max charging current */ mMaximumChargingCurrentLimitFromCommand = maximumChargeCurrent; SetMinimumChargeCurrent(minimumChargeCurrent); // TODO persist these to KVS - // TODO: Generate events - - NotifyApplicationStateChange(); + ComputeMaxChargeCurrentLimit(); - return this->ComputeMaxChargeCurrentLimit(); + return HandleStateMachineEvent(EVSEStateMachineEvent::ChargingEnabledEvent); } /** @@ -186,14 +127,10 @@ Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable { ChipLogProgress(AppServer, "EnergyEvseDelegate::EnableDischarging() called."); - /* update SupplyState */ - SetSupplyState(SupplyStateEnum::kDischargingEnabled); + // TODO save the maxDischarging Current + // TODO Do something with timestamp - // TODO: Generate events - - NotifyApplicationStateChange(); - - return Status::Success; + return HandleStateMachineEvent(EVSEStateMachineEvent::DischargingEnabledEvent); } /** @@ -209,10 +146,6 @@ Status EnergyEvseDelegate::StartDiagnostics() // TODO: Generate events - // TODO: Notify Application to implement Diagnostics - - NotifyApplicationStateChange(); - return Status::Success; } @@ -344,54 +277,47 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) switch (newState) { case StateEnum::kNotPluggedIn: - if (IsEvPluggedIn(mState)) + if (mHwState == StateEnum::kPluggedInNoDemand || mHwState == StateEnum::kPluggedInDemand) { - /* EV was plugged in, but no longer is */ - mSession.RecalculateSessionDuration(); - if (IsEvTransferringEnergy(mState)) - { - /* - * EV was transferring current - unusual to get to this case without - * first having the state set to kPluggedInNoDemand or kPluggedInDemand - */ - mSession.RecalculateSessionDuration(); - SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kOther); - } - - SendEVNotDetectedEvent(); - SetState(newState); + /* EVSE has been unplugged now */ + HandleStateMachineEvent(EVSEStateMachineEvent::EVNotDetectedEvent); } break; - case StateEnum::kPluggedInNoDemand: /* deliberate fall-thru */ + case StateEnum::kPluggedInNoDemand: + if (mHwState == StateEnum::kNotPluggedIn) + { + /* EV was unplugged, now is plugged in */ + mHwState = newState; + HandleStateMachineEvent(EVSEStateMachineEvent::EVPluggedInEvent); + } + else if (mHwState == StateEnum::kPluggedInDemand) + { + /* EV was plugged in and wanted demand, now doesn't want demand */ + mHwState = newState; + HandleStateMachineEvent(EVSEStateMachineEvent::EVDemandEvent); + } + break; case StateEnum::kPluggedInDemand: - if (IsEvPluggedIn(mState)) + if (mHwState == StateEnum::kNotPluggedIn) { - /* EV was already plugged in before */ - if (IsEvTransferringEnergy(mState)) - { - mSession.RecalculateSessionDuration(); - SendEnergyTransferStoppedEvent(newState == StateEnum::kPluggedInNoDemand - ? EnergyTransferStoppedReasonEnum::kEVStopped - : EnergyTransferStoppedReasonEnum::kEVSEStopped); - } - SetState(newState); + /* EV was unplugged, now is plugged in and wants demand */ + mHwState = newState; + HandleStateMachineEvent(EVSEStateMachineEvent::EVPluggedInEvent); + HandleStateMachineEvent(EVSEStateMachineEvent::EVDemandEvent); } - else + else if (mHwState == StateEnum::kPluggedInNoDemand) { - /* EV was not plugged in - start a new session */ - // TODO get energy meter readings - mSession.StartSession(0, 0); - SendEVConnectedEvent(); - - /* If*/ - - SetState(newState); + /* EV was plugged in and didn't want demand, now does want demand */ + mHwState = newState; + HandleStateMachineEvent(EVSEStateMachineEvent::EVDemandEvent); } break; default: /* All other states should be managed by the Delegate */ + ChipLogError(AppServer, "HwSetState received invalid enum from caller"); + return Status::Failure; break; } @@ -493,6 +419,228 @@ Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue) * Functions below are private helper functions internal to the delegate */ +/** + * @brief Main EVSE state machine + * + * This routine handles state transition events to determine behaviour + * + * + */ +Status EnergyEvseDelegate::HandleStateMachineEvent(EVSEStateMachineEvent event) +{ + switch (event) + { + case EVSEStateMachineEvent::EVPluggedInEvent: + ChipLogDetail(AppServer, "EVSE: EV PluggedIn event"); + return HandleEVPluggedInEvent(); + break; + case EVSEStateMachineEvent::EVNotDetectedEvent: + ChipLogDetail(AppServer, "EVSE: EV NotDetected event"); + return HandleEVNotDetectedEvent(); + break; + case EVSEStateMachineEvent::EVNoDemandEvent: + ChipLogDetail(AppServer, "EVSE: EV NoDemand event"); + return HandleEVNoDemandEvent(); + break; + case EVSEStateMachineEvent::EVDemandEvent: + ChipLogDetail(AppServer, "EVSE: EV Demand event"); + return HandleEVDemandEvent(); + break; + case EVSEStateMachineEvent::ChargingEnabledEvent: + ChipLogDetail(AppServer, "EVSE: ChargingEnabled event"); + return HandleChargingEnabledEvent(); + break; + case EVSEStateMachineEvent::DischargingEnabledEvent: + ChipLogDetail(AppServer, "EVSE: DischargingEnabled event"); + return HandleDischargingEnabledEvent(); + break; + case EVSEStateMachineEvent::DisabledEvent: + ChipLogDetail(AppServer, "EVSE: Disabled event"); + return HandleDisabledEvent(); + break; + case EVSEStateMachineEvent::FaultRaised: + ChipLogDetail(AppServer, "EVSE: FaultRaised event"); + return HandleFaultRaised(); + break; + case EVSEStateMachineEvent::FaultCleared: + ChipLogDetail(AppServer, "EVSE: FaultCleared event"); + return HandleFaultCleared(); + break; + default: + return Status::Failure; + } + return Status::Success; +} + +Status EnergyEvseDelegate::HandleEVPluggedInEvent() +{ + /* check if we are already plugged in or not */ + if (mState == StateEnum::kNotPluggedIn) + { + /* EV was not plugged in - start a new session */ + // TODO get energy meter readings + mSession.StartSession(0, 0); + SendEVConnectedEvent(); + + /* Set the state to either PluggedInNoDemand or PluggedInDemand as indicated by mHwState */ + SetState(mHwState); + } + // else we are already plugged in - ignore + return Status::Success; +} + +Status EnergyEvseDelegate::HandleEVNotDetectedEvent() +{ + if (mState == StateEnum::kPluggedInCharging || mState == StateEnum::kPluggedInDischarging) + { + /* + * EV was transferring current - unusual to get to this case without + * first having the state set to kPluggedInNoDemand or kPluggedInDemand + */ + SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kOther); + } + + SendEVNotDetectedEvent(); + SetState(StateEnum::kNotPluggedIn); + return Status::Success; +} + +Status EnergyEvseDelegate::HandleEVNoDemandEvent() +{ + if (mState == StateEnum::kPluggedInCharging || mState == StateEnum::kPluggedInDischarging) + { + /* + * EV was transferring current - EV decided to stop + */ + mSession.RecalculateSessionDuration(); + SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kEVStopped); + } + /* We must still be plugged in to get here - so no need to check if we are plugged in! */ + SetState(StateEnum::kPluggedInNoDemand); + return Status::Success; +} +Status EnergyEvseDelegate::HandleEVDemandEvent() +{ + /* Check to see if the supply is enabled for charging / discharging*/ + switch (mSupplyState) + { + case SupplyStateEnum::kChargingEnabled: + SetState(StateEnum::kPluggedInCharging); + SendEnergyTransferStartedEvent(); + break; + case SupplyStateEnum::kDischargingEnabled: + SetState(StateEnum::kPluggedInDischarging); + SendEnergyTransferStartedEvent(); + break; + case SupplyStateEnum::kDisabled: + case SupplyStateEnum::kDisabledError: + case SupplyStateEnum::kDisabledDiagnostics: + /* We must be plugged in, and the event is asking for demand + * but we can't charge or discharge now - leave it as kPluggedInDemand */ + SetState(StateEnum::kPluggedInDemand); + break; + default: + break; + } + return Status::Success; +} + +Status EnergyEvseDelegate::HandleChargingEnabledEvent() +{ + /* Check there is no Fault or Diagnostics condition */ + // TODO -! + + /* update SupplyState to say that charging is now enabled */ + SetSupplyState(SupplyStateEnum::kChargingEnabled); + + switch (mState) + { + case StateEnum::kNotPluggedIn: + case StateEnum::kPluggedInNoDemand: + break; + case StateEnum::kPluggedInDemand: + SetState(StateEnum::kPluggedInCharging); + SendEnergyTransferStartedEvent(); + break; + case StateEnum::kPluggedInCharging: + break; + case StateEnum::kPluggedInDischarging: + /* Switched from discharging to charging */ + SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kEVSEStopped); + + SetState(StateEnum::kPluggedInCharging); + SendEnergyTransferStartedEvent(); + break; + default: + break; + } + return Status::Success; +} +Status EnergyEvseDelegate::HandleDischargingEnabledEvent() +{ + /* Check there is no Fault or Diagnostics condition */ + // TODO -! + + /* update SupplyState to say that charging is now enabled */ + SetSupplyState(SupplyStateEnum::kDischargingEnabled); + + switch (mState) + { + case StateEnum::kNotPluggedIn: + case StateEnum::kPluggedInNoDemand: + break; + case StateEnum::kPluggedInDemand: + SetState(StateEnum::kPluggedInDischarging); + SendEnergyTransferStartedEvent(); + break; + case StateEnum::kPluggedInCharging: + /* Switched from charging to discharging */ + SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kEVSEStopped); + + SetState(StateEnum::kPluggedInDischarging); + SendEnergyTransferStartedEvent(); + break; + case StateEnum::kPluggedInDischarging: + default: + break; + } + return Status::Success; +} +Status EnergyEvseDelegate::HandleDisabledEvent() +{ + /* Check there is no Fault or Diagnostics condition */ + // TODO -! + + /* update SupplyState to say that charging is now enabled */ + SetSupplyState(SupplyStateEnum::kDisabled); + + switch (mState) + { + case StateEnum::kNotPluggedIn: + case StateEnum::kPluggedInNoDemand: + case StateEnum::kPluggedInDemand: + break; + case StateEnum::kPluggedInCharging: + case StateEnum::kPluggedInDischarging: + SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kEVSEStopped); + SetState(mHwState); + break; + default: + break; + } + + return Status::Success; +} + +Status EnergyEvseDelegate::HandleFaultRaised() +{ + return Status::Success; +} +Status EnergyEvseDelegate::HandleFaultCleared() +{ + return Status::Success; +} + /** * @brief Called to compute the safe charging current limit * @@ -729,6 +877,7 @@ CHIP_ERROR EnergyEvseDelegate::SetState(StateEnum newValue) { ChipLogDetail(AppServer, "State updated to %d", static_cast(mState)); MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, State::Id); + NotifyApplicationStateChange(); } return CHIP_NO_ERROR; @@ -754,6 +903,7 @@ CHIP_ERROR EnergyEvseDelegate::SetSupplyState(SupplyStateEnum newValue) { ChipLogDetail(AppServer, "SupplyState updated to %d", static_cast(mSupplyState)); MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SupplyState::Id); + NotifyApplicationStateChange(); } return CHIP_NO_ERROR; } diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index d7968f8e6989e5..72eb26ad9b1372 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -204,7 +204,7 @@ async def test_TC_EEVSE_2_2(self): max_charge_current = 60000 # get epoch time for ChargeUntil variable (2 minutes from now) utc_time_charging_end = datetime.datetime.now(pytz.utc) + datetime.timedelta(seconds=charging_duration) - epoch_time = (utc_time_charging_end - datetime.datetime(2000, 1, 1, tzinfo=pytz.utc)).total_seconds() + epoch_time = int((utc_time_charging_end - datetime.datetime(2000, 1, 1, tzinfo=pytz.utc)).total_seconds()) await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=min_charge_current, max_charge=max_charge_current) self.step("6") From a5774dedbbeac63d4b8bb4295ff15a500281b37d Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 2 Jan 2024 21:05:31 +0000 Subject: [PATCH 067/143] Fixed step 6e caused by not setting the cable limit / maxHardwareCurrentLimit in test events --- .../include/EnergyEvseDelegateImpl.h | 2 ++ .../src/EVSEManufacturerImpl.cpp | 12 +++++++++++- .../src/EnergyEvseDelegateImpl.cpp | 12 +++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 2c3fcf8c58d5ac..697e9ed6811ee9 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -139,8 +139,10 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate // ----------------------------------------------------------------- // Internal API to allow an EVSE to change its internal state etc Status HwSetMaxHardwareCurrentLimit(int64_t currentmA); + int64_t HwGetMaxHardwareCurrentLimit() { return mMaxHardwareCurrentLimit; } Status HwSetCircuitCapacity(int64_t currentmA); Status HwSetCableAssemblyLimit(int64_t currentmA); + int64_t HwGetCableAssemblyLimit() { return mCableAssemblyCurrentLimit; } Status HwSetState(StateEnum state); StateEnum HwGetState() { return mHwState; }; Status HwSetFault(FaultStateEnum fault); diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 1bde91ac89dd83..8d4279601bd92a 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -107,8 +107,10 @@ void EVSEManufacturer::ApplicationCallbackHandler(const EVSECbInfo * cb, intptr_ struct EVSETestEventSaveData { + int64_t mOldMaxHardwareCurrentLimit; int64_t mOldCircuitCapacity; int64_t mOldUserMaximumChargeCurrent; + int64_t mOldCableAssemblyLimit; StateEnum mOldHwStateBasic; /* For storing hwState before Basic Func event */ StateEnum mOldHwStatePluggedIn; /* For storing hwState before PluggedIn event */ StateEnum mOldHwStatePluggedInDemand; /* For storing hwState before PluggedInDemand event */ @@ -130,9 +132,12 @@ void SetTestEventTrigger_BasicFunctionality() { EnergyEvseDelegate * dg = GetEvseDelegate(); + sEVSETestEventSaveData.mOldMaxHardwareCurrentLimit = dg->HwGetMaxHardwareCurrentLimit(); sEVSETestEventSaveData.mOldCircuitCapacity = dg->GetCircuitCapacity(); sEVSETestEventSaveData.mOldUserMaximumChargeCurrent = dg->GetUserMaximumChargeCurrent(); sEVSETestEventSaveData.mOldHwStateBasic = dg->HwGetState(); + + dg->HwSetMaxHardwareCurrentLimit(32000); dg->HwSetCircuitCapacity(32000); dg->SetUserMaximumChargeCurrent(32000); dg->HwSetState(StateEnum::kNotPluggedIn); @@ -141,6 +146,7 @@ void SetTestEventTrigger_BasicFunctionalityClear() { EnergyEvseDelegate * dg = GetEvseDelegate(); + dg->HwSetMaxHardwareCurrentLimit(sEVSETestEventSaveData.mOldMaxHardwareCurrentLimit); dg->HwSetCircuitCapacity(sEVSETestEventSaveData.mOldCircuitCapacity); dg->SetUserMaximumChargeCurrent(sEVSETestEventSaveData.mOldUserMaximumChargeCurrent); dg->HwSetState(sEVSETestEventSaveData.mOldHwStateBasic); @@ -149,12 +155,16 @@ void SetTestEventTrigger_EVPluggedIn() { EnergyEvseDelegate * dg = GetEvseDelegate(); - sEVSETestEventSaveData.mOldHwStatePluggedIn = dg->HwGetState(); + sEVSETestEventSaveData.mOldCableAssemblyLimit = dg->HwGetCableAssemblyLimit(); + sEVSETestEventSaveData.mOldHwStatePluggedIn = dg->HwGetState(); + + dg->HwSetCableAssemblyLimit(63000); dg->HwSetState(StateEnum::kPluggedInNoDemand); } void SetTestEventTrigger_EVPluggedInClear() { EnergyEvseDelegate * dg = GetEvseDelegate(); + dg->HwSetCableAssemblyLimit(sEVSETestEventSaveData.mOldCableAssemblyLimit); dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedIn); } diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 640336e8fdb373..c0c585ed0c0d2a 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -192,7 +192,7 @@ Status EnergyEvseDelegate::HwSetMaxHardwareCurrentLimit(int64_t currentmA) /* there is no attribute to store this so store in private variable */ mMaxHardwareCurrentLimit = currentmA; - return this->ComputeMaxChargeCurrentLimit(); + return ComputeMaxChargeCurrentLimit(); } /** @@ -214,7 +214,7 @@ Status EnergyEvseDelegate::HwSetCircuitCapacity(int64_t currentmA) mCircuitCapacity = currentmA; MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, CircuitCapacity::Id); - return this->ComputeMaxChargeCurrentLimit(); + return ComputeMaxChargeCurrentLimit(); } /** @@ -239,7 +239,7 @@ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA) /* there is no attribute to store this so store in private variable */ mCableAssemblyCurrentLimit = currentmA; - return this->ComputeMaxChargeCurrentLimit(); + return ComputeMaxChargeCurrentLimit(); } bool IsEvPluggedIn(StateEnum state) @@ -525,10 +525,12 @@ Status EnergyEvseDelegate::HandleEVDemandEvent() switch (mSupplyState) { case SupplyStateEnum::kChargingEnabled: + ComputeMaxChargeCurrentLimit(); SetState(StateEnum::kPluggedInCharging); SendEnergyTransferStartedEvent(); break; case SupplyStateEnum::kDischargingEnabled: + // TODO ComputeMaxDischargeCurrentLimit() - Needs to be implemented SetState(StateEnum::kPluggedInDischarging); SendEnergyTransferStartedEvent(); break; @@ -559,6 +561,7 @@ Status EnergyEvseDelegate::HandleChargingEnabledEvent() case StateEnum::kPluggedInNoDemand: break; case StateEnum::kPluggedInDemand: + ComputeMaxChargeCurrentLimit(); SetState(StateEnum::kPluggedInCharging); SendEnergyTransferStartedEvent(); break; @@ -568,6 +571,7 @@ Status EnergyEvseDelegate::HandleChargingEnabledEvent() /* Switched from discharging to charging */ SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kEVSEStopped); + ComputeMaxChargeCurrentLimit(); SetState(StateEnum::kPluggedInCharging); SendEnergyTransferStartedEvent(); break; @@ -590,6 +594,7 @@ Status EnergyEvseDelegate::HandleDischargingEnabledEvent() case StateEnum::kPluggedInNoDemand: break; case StateEnum::kPluggedInDemand: + // TODO call ComputeMaxDischargeCurrentLimit() SetState(StateEnum::kPluggedInDischarging); SendEnergyTransferStartedEvent(); break; @@ -597,6 +602,7 @@ Status EnergyEvseDelegate::HandleDischargingEnabledEvent() /* Switched from charging to discharging */ SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum::kEVSEStopped); + // TODO call ComputeMaxDischargeCurrentLimit() SetState(StateEnum::kPluggedInDischarging); SendEnergyTransferStartedEvent(); break; From 3f365af6ad88ab9beaa7b4a1adb2c59f35065c7f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 4 Jan 2024 22:01:59 +0000 Subject: [PATCH 068/143] Added comment to clarify purpose and definition of test eventtrigger field values. --- .../EnergyEvseTestEventTriggerDelegate.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h index 489ca7974eefcb..7f199b21cdc255 100644 --- a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h +++ b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h @@ -22,6 +22,13 @@ namespace chip { +/* + * These Test EventTrigger values are specified in the TC_EEVSE test plan + * and are defined conditions used in test events. + * + * They are sent along with the enableKey (manufacturer defined secret) + * in the General Diagnostic cluster TestEventTrigger command + */ enum class EnergyEvseTrigger : uint64_t { // Scenarios @@ -33,7 +40,6 @@ enum class EnergyEvseTrigger : uint64_t kEVPluggedInClear = 0x0099000000000003, // EV Plugged-in Test Event Clear | Simulate unplugging the EV kEVChargeDemand = 0x0099000000000004, // EV Charge Demand Test Event | Simulate the EV presenting charge demand to the EVSE kEVChargeDemandClear = 0x0099000000000005, // EV Charge Demand Test Event Clear | Simulate the EV becoming fully charged - }; class EnergyEvseTestEventTriggerDelegate : public TestEventTriggerDelegate From 2f49014998adf50406f452fcb8b633e62386521f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 5 Jan 2024 17:27:17 +0000 Subject: [PATCH 069/143] Fixed several bugs in test script --- src/python_testing/TC_EEVSE_2_2.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index 72eb26ad9b1372..5f8714bf65a77a 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -19,6 +19,7 @@ import time import chip.clusters as Clusters +from chip.clusters.Types import NullValue import pytz from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, TestStep @@ -51,11 +52,11 @@ async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( - chargingEnabledUntil=charge_until, - minimumChargeCurrent=6000, - maximumChargeCurrent=60000), - endpoint=1, - timedRequestTimeoutMs=timedRequestTimeoutMs) + chargingEnabledUntil=charge_until, + minimumChargeCurrent=min_charge, + maximumChargeCurrent=max_charge), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") @@ -102,11 +103,11 @@ def steps_TC_EEVSE_2_2(self) -> list[TestStep]: TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 1 (ChargingEnabled)"), TestStep("8c", "TH reads from the DUT the ChargingEnabledUntil attribute. Verify value is the commanded value (NULL)"), TestStep("8d", "TH reads from the DUT the MinimumChargeCurrent attribute. Verify value is the commanded value (6000)"), - TestStep("8d", "TH reads from the DUT the MaximumChargeCurrent attribute. Verify value is the MIN(command value (60000), CircuitCapacity)"), + TestStep("8e", "TH reads from the DUT the MaximumChargeCurrent attribute. Verify value is the MIN(command value (60000), CircuitCapacity)"), TestStep("9", "If the optional attribute is supported TH writes to the DUT UserMaximumChargeCurrent=6000"), TestStep("9a", "After a few seconds TH reads from the DUT the MaximumChargeCurrent. Verify value is UserMaximumChargeCurrent value (6000)"), TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), - TestStep("10a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), + TestStep("10a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), TestStep("11a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), @@ -234,16 +235,15 @@ async def test_TC_EEVSE_2_2(self): # TODO check EnergyTransferredStoped (EvseStopped) self.step("7a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand) +# await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand) self.step("7b") - await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) +# await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) self.step("8") - charge_until = None + charge_until = NullValue min_charge_current = 6000 max_charge_current = 12000 - await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) self.step("8a") @@ -265,10 +265,11 @@ async def test_TC_EEVSE_2_2(self): self.step("9") # This will only work if the optional UserMaximumChargeCurrent attribute is supported - if Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent.attribute_id in self.get_supported_energy_evse_attributes(): + supported_attributes = await self.get_supported_energy_evse_attributes(endpoint=1) + if Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent.attribute_id in supported_attributes: logging.info("UserMaximumChargeCurrent is supported...") user_max_charge_current = 6000 - self.write_user_max_charge(1, user_max_charge_current) + await self.write_user_max_charge(1, user_max_charge_current) self.step("9a") time.sleep(3) From f2ce4cfa4baff48781de4d9b5683a0d691afc574 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 5 Jan 2024 17:38:52 +0000 Subject: [PATCH 070/143] Made SetChargingEnabledUntil take a nullable type. --- .../include/EnergyEvseDelegateImpl.h | 4 +- .../src/EnergyEvseDelegateImpl.cpp | 46 +++++++++++++------ 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 697e9ed6811ee9..34ccddfff83e01 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -166,10 +166,10 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate CHIP_ERROR SetFaultState(FaultStateEnum); DataModel::Nullable GetChargingEnabledUntil() override; - CHIP_ERROR SetChargingEnabledUntil(uint32_t); + CHIP_ERROR SetChargingEnabledUntil(DataModel::Nullable); DataModel::Nullable GetDischargingEnabledUntil() override; - CHIP_ERROR SetDischargingEnabledUntil(uint32_t); + CHIP_ERROR SetDischargingEnabledUntil(DataModel::Nullable); int64_t GetCircuitCapacity() override; CHIP_ERROR SetCircuitCapacity(int64_t); diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index c0c585ed0c0d2a..8e1bf0de904300 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -48,9 +48,10 @@ Status EnergyEvseDelegate::Disable() { ChipLogProgress(AppServer, "EnergyEvseDelegate::Disable()"); + DataModel::Nullable disableTime(0); /* update ChargingEnabledUntil & DischargingEnabledUntil to show 0 */ - SetChargingEnabledUntil(0); - SetDischargingEnabledUntil(0); + SetChargingEnabledUntil(disableTime); + SetDischargingEnabledUntil(disableTime); /* update MinimumChargeCurrent & MaximumChargeCurrent to 0 */ SetMinimumChargeCurrent(0); @@ -96,12 +97,13 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable & { /* Charging enabled indefinitely */ ChipLogError(AppServer, "Charging enabled indefinitely"); + SetChargingEnabledUntil(chargingEnabledUntil); } else { /* check chargingEnabledUntil is in the future */ ChipLogError(AppServer, "Charging enabled until: %lu", static_cast(chargingEnabledUntil.Value())); - SetChargingEnabledUntil(chargingEnabledUntil.Value()); + SetChargingEnabledUntil(chargingEnabledUntil); // TODO start a timer to disable charging later // if (checkChargingEnabled) } @@ -944,17 +946,25 @@ DataModel::Nullable EnergyEvseDelegate::GetChargingEnabledUntil() return mChargingEnabledUntil; } -CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(uint32_t newValue) +CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(DataModel::Nullable newValue) { DataModel::Nullable oldValue = mChargingEnabledUntil; - mChargingEnabledUntil = MakeNullable(newValue); - if ((oldValue.IsNull()) || (oldValue.Value() != newValue)) + mChargingEnabledUntil = newValue; + if (oldValue != newValue) { - ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %lu", - static_cast(mChargingEnabledUntil.Value())); + if (newValue.IsNull()) + { + ChipLogDetail(AppServer, "ChargingEnabledUntil updated to Null"); + } + else + { + ChipLogDetail(AppServer, "ChargingEnabledUntil updated to %lu", + static_cast(mChargingEnabledUntil.Value())); + } MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id); } + return CHIP_NO_ERROR; } @@ -964,17 +974,25 @@ DataModel::Nullable EnergyEvseDelegate::GetDischargingEnabledUntil() return mDischargingEnabledUntil; } -CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(uint32_t newValue) +CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(DataModel::Nullable newValue) { DataModel::Nullable oldValue = mDischargingEnabledUntil; - mDischargingEnabledUntil = MakeNullable(newValue); - if ((oldValue.IsNull()) || (oldValue.Value() != newValue)) + mDischargingEnabledUntil = newValue; + if (oldValue != newValue) { - ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %lu", - static_cast(mDischargingEnabledUntil.Value())); + if (newValue.IsNull()) + { + ChipLogDetail(AppServer, "DischargingEnabledUntil updated to Null"); + } + else + { + ChipLogDetail(AppServer, "DischargingEnabledUntil updated to %lu", + static_cast(mDischargingEnabledUntil.Value())); + } MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id); } + return CHIP_NO_ERROR; } @@ -1092,6 +1110,8 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue) if (oldValue != newValue) { ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %ld", static_cast(mUserMaximumChargeCurrent)); + + ComputeMaxChargeCurrentLimit(); MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id); } From b16e1ff57cb2d0c3d02244f1aafb74b068fe9ece Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 7 Jan 2024 18:53:35 +0000 Subject: [PATCH 071/143] Removed Reference to step 5c, and moved reading of SessionID to step 4b. More TC_EEVSE_2_2 bug fixes. Added event checking. Still fails at step 14. Does not have enable timeout timer implemented --- .../src/EnergyEvseDelegateImpl.cpp | 2 +- src/python_testing/TC_EEVSE_2_2.py | 148 +++++++++++++++--- 2 files changed, 125 insertions(+), 25 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 8e1bf0de904300..f1cd57611aaa10 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -297,7 +297,7 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) { /* EV was plugged in and wanted demand, now doesn't want demand */ mHwState = newState; - HandleStateMachineEvent(EVSEStateMachineEvent::EVDemandEvent); + HandleStateMachineEvent(EVSEStateMachineEvent::EVNoDemandEvent); } break; case StateEnum::kPluggedInDemand: diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index 5f8714bf65a77a..f8e9f7759b0ea3 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -14,13 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -import datetime + import logging +import queue import time +from datetime import datetime, timedelta, timezone import chip.clusters as Clusters +from chip.clusters import ClusterObjects as ClusterObjects +from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction from chip.clusters.Types import NullValue -import pytz + from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, TestStep from mobly import asserts @@ -28,6 +32,35 @@ logger = logging.getLogger(__name__) +class EventChangeCallback: + def __init__(self, expected_cluster: ClusterObjects): + self._q = queue.Queue() + self._expected_cluster = expected_cluster + + async def start(self, dev_ctrl, nodeid): + self._subscription = await dev_ctrl.ReadEvent(nodeid, + events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), + fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + self._subscription.SetEventUpdateCallback(self.__call__) + + def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): + logging.info(f"EVENT RECV'D ---------------------------\n\n\n!!!\n{res}") + if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: + logging.info( + f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') + self._q.put(res) + + def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): + try: + res = self._q.get(block=True, timeout=10) + except queue.Empty: + asserts.fail("Failed to receive a report for the event {}".format(expected_event)) + + asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") + asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") + return res.Data + + class TC_EEVSE_2_2(MatterBaseTest): async def read_evse_attribute_expect_success(self, endpoint, attribute): full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) @@ -85,9 +118,9 @@ def steps_TC_EEVSE_2_2(self) -> list[TestStep]: TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), - TestStep("3d", "TH reads from the DUT the SessionID attribute"), TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("4b", "TH reads from the DUT the SessionID attribute. Value is noted for later"), TestStep("5", "TH sends command EnableCharging with ChargingEnabledUntil=2 minutes in the future, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x3 (PluggedInCharging)"), @@ -109,17 +142,17 @@ def steps_TC_EEVSE_2_2(self) -> list[TestStep]: TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), TestStep("10a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), - TestStep("11a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), + TestStep("11a", "TH reads from the DUT the State attribute. Verify value is 0x03 (PluggedInCharging)"), TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped"), - TestStep("12a", "TH reads from the DUT the State attribute. Verify value is 0x02 (PluggedInDemand)"), + TestStep("12a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"), TestStep("13a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), TestStep("13b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x01 (ChargingEnabled)"), - TestStep("13c", "TH reads from the DUT the SessionID attribute. Verify value is the same value noted in 5c"), + TestStep("13c", "TH reads from the DUT the SessionID attribute. Verify value is the same value noted in 4b"), TestStep("13d", "TH reads from the DUT the SessionDuration attribute. Verify value is greater than 120 (and match the time taken for the tests from step 4 to step 13)"), TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), TestStep("14a", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), - TestStep("14b", "TH reads from the DUT the SessionID attribute. Verify value is 1 more than the value noted in 5c"), + TestStep("14b", "TH reads from the DUT the SessionID attribute. Verify value is 1 more than the value noted in 4b"), TestStep("15", "TH sends command Disable. Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvseStopped"), TestStep("15a", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), TestStep("16", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear."), @@ -165,11 +198,45 @@ async def send_test_event_trigger_charge_demand(self): async def send_test_event_trigger_charge_demand_clear(self): await self.send_test_event_triggers(eventTrigger=0x0099000000000005) + def validate_energy_transfer_started_event(self, event_data, session_id, expected_state, expected_max_charge): + asserts.assert_equal(session_id, event_data.sessionID, + f"EnergyTransferStarted event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EnergyTransferStarted event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(expected_max_charge, event_data.maximumCurrent, + f"EnergyTransferStarted event maximumCurrent was {event_data.maximumCurrent}, expected {expected_max_charge}") + + def validate_energy_transfer_stopped_event(self, event_data, session_id, expected_state, expected_reason): + asserts.assert_equal(session_id, event_data.sessionID, + f"EnergyTransferStopped event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EnergyTransferStopped event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(expected_reason, event_data.reason, + f"EnergyTransferStopped event reason was {event_data.reason}, expected {expected_reason}") + + def validate_ev_connected_event(self, event_data, session_id): + asserts.assert_equal(session_id, event_data.sessionID, + f"EvConnected event session ID was {event_data.sessionID}, expected {session_id}") + + def validate_ev_not_detected_event(self, event_data, session_id, expected_state, expected_duration, expected_charged): + asserts.assert_equal(session_id, event_data.sessionID, + f"EvNotDetected event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EvNotDetected event event State was {event_data.state} expected {expected_state}") + asserts.assert_greater_equal(event_data.sessionDuration, expected_duration, + f"EvNotDetected event sessionDuration was {event_data.sessionDuration}, expected >= {expected_duration}") + asserts.assert_greater_equal(event_data.sessionEnergyCharged, expected_charged, + f"EvNotDetected event sessionEnergyCharged was {event_data.sessionEnergyCharged}, expected >= {expected_charged}") + @async_test_body async def test_TC_EEVSE_2_2(self): self.step("1") # Commission DUT - already done + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.EnergyEvse) + await events_callback.start(self.default_controller, self.dut_node_id) + self.step("2") await self.check_test_event_triggers_enabled() @@ -188,32 +255,36 @@ async def test_TC_EEVSE_2_2(self): self.step("3c") await self.check_evse_attribute("FaultState", Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError) - self.step("3d") - # Save Session ID - it may be NULL at this point - session_id = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionID") - self.step("4") await self.send_test_event_trigger_pluggedin() - # TODO check PluggedIn Event + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EVConnected) self.step("4a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) + self.step("4b") + # Save Session ID for later and check it against the value in the event + session_id = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionID") + self.validate_ev_connected_event(event_data, session_id) + self.step("5") charging_duration = 5 # TODO test plan spec says 120s - reduced for now min_charge_current = 6000 max_charge_current = 60000 + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging # get epoch time for ChargeUntil variable (2 minutes from now) - utc_time_charging_end = datetime.datetime.now(pytz.utc) + datetime.timedelta(seconds=charging_duration) - epoch_time = int((utc_time_charging_end - datetime.datetime(2000, 1, 1, tzinfo=pytz.utc)).total_seconds()) + utc_time_charging_end = datetime.now(tz=timezone.utc) + timedelta(seconds=charging_duration) + + # Matter epoch is 0 hours, 0 minutes, 0 seconds on Jan 1, 2000 UTC + epoch_time = int((utc_time_charging_end - datetime(2000, 1, 1, 0, 0, 0, 0, timezone.utc)).total_seconds()) await self.send_enable_charge_command(endpoint=1, charge_until=epoch_time, min_charge=min_charge_current, max_charge=max_charge_current) self.step("6") await self.send_test_event_trigger_charge_demand() - # TODO check EnergyTransferStarted Event + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) self.step("6a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) + await self.check_evse_attribute("State", expected_state) self.step("6b") await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) @@ -229,10 +300,15 @@ async def test_TC_EEVSE_2_2(self): expected_max_charge = min(max_charge_current, circuit_capacity) await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) + self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + self.step("7") # Sleep for the charging duration plus a couple of seconds to check it has stopped time.sleep(charging_duration + 2) # TODO check EnergyTransferredStoped (EvseStopped) + # event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) + # expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVSEStopped + # self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) self.step("7a") # await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand) @@ -244,7 +320,9 @@ async def test_TC_EEVSE_2_2(self): charge_until = NullValue min_charge_current = 6000 max_charge_current = 12000 + # TODO reinstate this check await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + # event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) self.step("8a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) @@ -263,6 +341,10 @@ async def test_TC_EEVSE_2_2(self): expected_max_charge = min(max_charge_current, circuit_capacity) await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) + # from step 8 above - validate event + # TODO reinstate this check + # self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + self.step("9") # This will only work if the optional UserMaximumChargeCurrent attribute is supported supported_attributes = await self.get_supported_energy_evse_attributes(endpoint=1) @@ -281,25 +363,37 @@ async def test_TC_EEVSE_2_2(self): self.step("10") await self.send_test_event_trigger_charge_demand_clear() - # TODO Verify Event EEVSE.S.E03(EnergyTransferStopped) sent with reason EvStopped + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) + expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVStopped + self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) self.step("10a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) self.step("11") await self.send_test_event_trigger_charge_demand() - # TODO Verify Event EEVSE.S.E03(EnergyTransferStarted) sent + # Check we get EnergyTransferStarted again + await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) + self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + + self.step("11a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) self.step("12") await self.send_test_event_trigger_charge_demand_clear() - # TODO Verify Event EEVSE.S.E03(EnergyTransferStopped with reason EvStopped) sent + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) + expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVStopped + self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) self.step("12a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) self.step("13") await self.send_test_event_trigger_pluggedin_clear() - # TODO Verify EVNotDetected sent + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EVNotDetected) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand + self.validate_ev_not_detected_event(event_data, session_id, expected_state, expected_duration=0, expected_charged=0) self.step("13a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) @@ -317,18 +411,22 @@ async def test_TC_EEVSE_2_2(self): self.step("14") await self.send_test_event_trigger_pluggedin() - # TODO check PluggedIn Event + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EVConnected) + self.validate_ev_connected_event(event_data, session_id + 1) self.step("14a") await self.send_test_event_trigger_charge_demand() - # TODO check EnergyTransferStarted Event + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) + self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) self.step("14b") await self.check_evse_attribute("SessionID", session_id + 1) self.step("15") await self.send_disable_command() - # TODO Verify Event EEVSE.S.E03(EnergyTransferStopped with reason EvseStopped) sent + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) + expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVSEStopped + self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) self.step("15a") await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) @@ -338,7 +436,9 @@ async def test_TC_EEVSE_2_2(self): self.step("17") await self.send_test_event_trigger_pluggedin_clear() - # TODO Verify EVNotDetected sent + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EVNotDetected) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand + self.validate_ev_not_detected_event(event_data, session_id, expected_state, expected_duration=0, expected_charged=0) self.step("18") await self.send_test_event_trigger_basic_clear() From 469f3139c3a1486dd223e761bb04a193d9bd130f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 7 Jan 2024 22:36:16 +0000 Subject: [PATCH 072/143] Fixed issue with not detecting 2nd plug in event, and session ID not incrementing. Now test case passes all the way. --- .../src/EnergyEvseDelegateImpl.cpp | 4 +++- src/python_testing/TC_EEVSE_2_2.py | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index f1cd57611aaa10..c640a27ea0e07a 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -282,6 +282,7 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) if (mHwState == StateEnum::kPluggedInNoDemand || mHwState == StateEnum::kPluggedInDemand) { /* EVSE has been unplugged now */ + mHwState = newState; HandleStateMachineEvent(EVSEStateMachineEvent::EVNotDetectedEvent); } break; @@ -1276,7 +1277,8 @@ void EvseSession::StartSession(int64_t chargingMeterValue, int64_t dischargingMe } else { - mSessionID = MakeNullable(mSessionID.Value()++); + uint32_t sessionID = mSessionID.Value() + 1; + mSessionID = MakeNullable(sessionID); } /* Reset other session values */ diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index f8e9f7759b0ea3..9fce5e1b68544b 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -44,7 +44,6 @@ async def start(self, dev_ctrl, nodeid): self._subscription.SetEventUpdateCallback(self.__call__) def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): - logging.info(f"EVENT RECV'D ---------------------------\n\n\n!!!\n{res}") if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: logging.info( f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') @@ -81,7 +80,7 @@ async def write_user_max_charge(self, endpoint, user_max_charge): Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") - async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 60000, + async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( @@ -94,9 +93,11 @@ async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_disable_command(self, endpoint: int = 0, expected_status: Status = Status.Success): + async def send_disable_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), endpoint=1) + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") @@ -411,19 +412,25 @@ async def test_TC_EEVSE_2_2(self): self.step("14") await self.send_test_event_trigger_pluggedin() + # New plug in means session ID should increase by 1 + session_id = session_id + 1 + + # Check we get a new EVConnected event with updated session ID event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EVConnected) - self.validate_ev_connected_event(event_data, session_id + 1) + self.validate_ev_connected_event(event_data, session_id) self.step("14a") await self.send_test_event_trigger_charge_demand() + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging # This is the value at the event time event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) self.step("14b") - await self.check_evse_attribute("SessionID", session_id + 1) + await self.check_evse_attribute("SessionID", session_id) self.step("15") await self.send_disable_command() + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging # This is the value prior to stopping event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVSEStopped self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) From ec0a8762e464fcf4b6e93ab27a9e460a4bb10982 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sun, 7 Jan 2024 23:05:30 +0000 Subject: [PATCH 073/143] Restyled by isort --- src/python_testing/TC_EEVSE_2_2.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index 9fce5e1b68544b..faac9004e6909b 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -24,9 +24,8 @@ from chip.clusters import ClusterObjects as ClusterObjects from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction from chip.clusters.Types import NullValue - from chip.interaction_model import InteractionModelError, Status -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, TestStep +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts logger = logging.getLogger(__name__) From e008095e4f57635684e23cfdb895403bdceb52d4 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 8 Jan 2024 17:12:47 +0000 Subject: [PATCH 074/143] Made some attributes persisted per spec. --- .../include/EnergyEvseDelegateImpl.h | 2 +- .../include/EnergyEvseManager.h | 2 + .../src/EnergyEvseDelegateImpl.cpp | 46 ++++++++-- .../src/EnergyEvseManager.cpp | 89 ++++++++++++++++++- .../energy-evse-server/energy-evse-server.cpp | 3 +- .../energy-evse-server/energy-evse-server.h | 7 +- 6 files changed, 137 insertions(+), 12 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 34ccddfff83e01..6cd6dd37f8df34 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -198,7 +198,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate DataModel::Nullable GetNextChargeTargetSoC() override; DataModel::Nullable GetApproximateEVEfficiency() override; - CHIP_ERROR SetApproximateEVEfficiency(uint16_t) override; + CHIP_ERROR SetApproximateEVEfficiency(DataModel::Nullable) override; /* SOC attributes */ DataModel::Nullable GetStateOfCharge() override; diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h index 9875c397990ef2..a6a64f35ee9767 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h @@ -46,6 +46,8 @@ class EnergyEvseManager : public Instance CHIP_ERROR Init(); void Shutdown(); + CHIP_ERROR LoadPersistentAttributes(); + EnergyEvseDelegate * GetDelegate() { return mDelegate; }; private: diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index c640a27ea0e07a..d122de7921dac3 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -20,6 +20,7 @@ #include #include #include +#include using namespace chip; using namespace chip::app; @@ -122,7 +123,7 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable & * @brief Called when EVSE cluster receives EnableDischarging command * * @param dischargingEnabledUntil (can be null to indefinite discharging) - * @param maximumChargeCurrent (in mA) + * @param maximumDischargeCurrent (in mA) */ Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable & dischargingEnabledUntil, const int64_t & maximumDischargeCurrent) @@ -963,6 +964,11 @@ CHIP_ERROR EnergyEvseDelegate::SetChargingEnabledUntil(DataModel::Nullable(mChargingEnabledUntil.Value())); } + + // Write new value to persistent storage. + ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id); + GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mChargingEnabledUntil); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ChargingEnabledUntil::Id); } @@ -991,6 +997,10 @@ CHIP_ERROR EnergyEvseDelegate::SetDischargingEnabledUntil(DataModel::Nullable(mDischargingEnabledUntil.Value())); } + // Write new value to persistent storage. + ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id); + GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mDischargingEnabledUntil); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, DischargingEnabledUntil::Id); } @@ -1113,6 +1123,11 @@ CHIP_ERROR EnergyEvseDelegate::SetUserMaximumChargeCurrent(int64_t newValue) ChipLogDetail(AppServer, "UserMaximumChargeCurrent updated to %ld", static_cast(mUserMaximumChargeCurrent)); ComputeMaxChargeCurrentLimit(); + + // Write new value to persistent storage. + ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id); + GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mUserMaximumChargeCurrent); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, UserMaximumChargeCurrent::Id); } @@ -1138,6 +1153,11 @@ CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue) { ChipLogDetail(AppServer, "RandomizationDelayWindow updated to %lu", static_cast(mRandomizationDelayWindow)); + + // Write new value to persistent storage. + ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, EnergyEvse::Id, RandomizationDelayWindow::Id); + GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mRandomizationDelayWindow); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, RandomizationDelayWindow::Id); } return CHIP_NO_ERROR; @@ -1175,14 +1195,25 @@ DataModel::Nullable EnergyEvseDelegate::GetApproximateEVEfficiency() return mApproximateEVEfficiency; } -CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(uint16_t newValue) +CHIP_ERROR EnergyEvseDelegate::SetApproximateEVEfficiency(DataModel::Nullable newValue) { DataModel::Nullable oldValue = mApproximateEVEfficiency; - mApproximateEVEfficiency = MakeNullable(newValue); - if ((oldValue.IsNull()) || (oldValue.Value() != newValue)) + mApproximateEVEfficiency = newValue; + if ((oldValue != newValue)) { - ChipLogDetail(AppServer, "ApproximateEVEfficiency updated to %d", mApproximateEVEfficiency.Value()); + if (newValue.IsNull()) + { + ChipLogDetail(AppServer, "ApproximateEVEfficiency updated to Null"); + } + else + { + ChipLogDetail(AppServer, "ApproximateEVEfficiency updated to %d", mApproximateEVEfficiency.Value()); + } + // Write new value to persistent storage. + ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, EnergyEvse::Id, ApproximateEVEfficiency::Id); + GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mApproximateEVEfficiency); + MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, ApproximateEVEfficiency::Id); } @@ -1291,7 +1322,10 @@ void EvseSession::StartSession(int64_t chargingMeterValue, int64_t dischargingMe MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionEnergyCharged::Id); MatterReportingAttributeChangeCallback(mEndpointId, EnergyEvse::Id, SessionEnergyDischarged::Id); - // TODO persist mSessionID + // Write values to persistent storage. + ConcreteAttributePath path = ConcreteAttributePath(mEndpointId, EnergyEvse::Id, SessionID::Id); + GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mSessionID); + // TODO persist mStartTime // TODO persist mSessionEnergyChargedAtStart // TODO persist mSessionEnergyDischargedAtStart diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp index 0d84d8856212e0..389a830e8da759 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp @@ -17,14 +17,101 @@ */ #include +#include using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; +CHIP_ERROR EnergyEvseManager::LoadPersistentAttributes() +{ + + SafeAttributePersistenceProvider * aProvider = GetSafeAttributePersistenceProvider(); + EndpointId aEndpointId = mDelegate->GetEndpointId(); + CHIP_ERROR err; + + // Restore ChargingEnabledUntil value + DataModel::Nullable tempChargingEnabledUntil; + err = aProvider->ReadScalarValue(ConcreteAttributePath(aEndpointId, EnergyEvse::Id, Attributes::ChargingEnabledUntil::Id), + tempChargingEnabledUntil); + if (err == CHIP_NO_ERROR) + { + ChipLogDetail(AppServer, "EVSE: successfully loaded ChargingEnabledUntil from NVM"); + mDelegate->SetChargingEnabledUntil(tempChargingEnabledUntil); + } + else + { + ChipLogError(AppServer, "EVSE: Unable to restore persisted ChargingEnabledUntil value"); + } + + // Restore DischargingEnabledUntil value + DataModel::Nullable tempDischargingEnabledUntil; + err = aProvider->ReadScalarValue(ConcreteAttributePath(aEndpointId, EnergyEvse::Id, Attributes::DischargingEnabledUntil::Id), + tempDischargingEnabledUntil); + if (err == CHIP_NO_ERROR) + { + ChipLogDetail(AppServer, "EVSE: successfully loaded DischargingEnabledUntil from NVM"); + mDelegate->SetDischargingEnabledUntil(tempDischargingEnabledUntil); + } + else + { + ChipLogError(AppServer, "EVSE: Unable to restore persisted DischargingEnabledUntil value"); + } + + // Restore UserMaximumChargeCurrent value + uint64_t tempUserMaximumChargeCurrent; + err = aProvider->ReadScalarValue(ConcreteAttributePath(aEndpointId, EnergyEvse::Id, Attributes::UserMaximumChargeCurrent::Id), + tempUserMaximumChargeCurrent); + if (err == CHIP_NO_ERROR) + { + ChipLogDetail(AppServer, "EVSE: successfully loaded UserMaximumChargeCurrent from NVM"); + mDelegate->SetUserMaximumChargeCurrent(tempUserMaximumChargeCurrent); + } + else + { + ChipLogError(AppServer, "EVSE: Unable to restore persisted UserMaximumChargeCurrent value"); + } + + // Restore RandomizationDelayWindow value + uint32_t tempRandomizationDelayWindow; + err = aProvider->ReadScalarValue(ConcreteAttributePath(aEndpointId, EnergyEvse::Id, Attributes::RandomizationDelayWindow::Id), + tempRandomizationDelayWindow); + if (err == CHIP_NO_ERROR) + { + ChipLogDetail(AppServer, "EVSE: successfully loaded RandomizationDelayWindow from NVM"); + mDelegate->SetRandomizationDelayWindow(tempRandomizationDelayWindow); + } + else + { + ChipLogError(AppServer, "EVSE: Unable to restore persisted RandomizationDelayWindow value"); + } + + // Restore ApproximateEVEfficiency value + DataModel::Nullable tempApproxEVEfficiency; + err = aProvider->ReadScalarValue(ConcreteAttributePath(aEndpointId, EnergyEvse::Id, Attributes::ApproximateEVEfficiency::Id), + tempApproxEVEfficiency); + if (err == CHIP_NO_ERROR) + { + ChipLogDetail(AppServer, "EVSE: successfully loaded ApproximateEVEfficiency from NVM"); + mDelegate->SetApproximateEVEfficiency(tempApproxEVEfficiency); + } + else + { + ChipLogError(AppServer, "EVSE: Unable to restore persisted ApproximateEVEfficiency value"); + } + + return CHIP_NO_ERROR; // It is ok to have no value loaded here +} + CHIP_ERROR EnergyEvseManager::Init() { - return Instance::Init(); + CHIP_ERROR err = Instance::Init(); + if (err != CHIP_NO_ERROR) + { + return err; + } + + return LoadPersistentAttributes(); } void EnergyEvseManager::Shutdown() diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp index 60f9e24be0f962..bc07ba07eef55a 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp +++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp @@ -23,6 +23,7 @@ using namespace chip; using namespace chip::app; +using namespace chip::app::DataModel; using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; using namespace chip::app::Clusters::EnergyEvse::Attributes; @@ -166,7 +167,7 @@ CHIP_ERROR Instance::Write(const ConcreteDataAttributePath & aPath, AttributeVal } uint16_t newValue; ReturnErrorOnFailure(aDecoder.Decode(newValue)); - ReturnErrorOnFailure(mDelegate.SetApproximateEVEfficiency(newValue)); + ReturnErrorOnFailure(mDelegate.SetApproximateEVEfficiency(MakeNullable(newValue))); return CHIP_NO_ERROR; } diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h index 5df2f0149eb1ed..a194551607c6f4 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.h +++ b/src/app/clusters/energy-evse-server/energy-evse-server.h @@ -48,6 +48,7 @@ class Delegate virtual ~Delegate() = default; void SetEndpointId(EndpointId aEndpoint) { mEndpointId = aEndpoint; } + EndpointId GetEndpointId() { return mEndpointId; } /** * @brief Delegate should implement a handler to disable the EVSE. @@ -116,9 +117,9 @@ class Delegate // ------------------------------------------------------------------ // Set attribute methods - virtual CHIP_ERROR SetUserMaximumChargeCurrent(int64_t aNewValue) = 0; - virtual CHIP_ERROR SetRandomizationDelayWindow(uint32_t aNewValue) = 0; - virtual CHIP_ERROR SetApproximateEVEfficiency(uint16_t aNewValue) = 0; + virtual CHIP_ERROR SetUserMaximumChargeCurrent(int64_t aNewValue) = 0; + virtual CHIP_ERROR SetRandomizationDelayWindow(uint32_t aNewValue) = 0; + virtual CHIP_ERROR SetApproximateEVEfficiency(DataModel::Nullable aNewValue) = 0; protected: EndpointId mEndpointId = 0; From 165af4cc0693bcf8245d60aa6ed10b5278a5e73e Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 8 Jan 2024 18:26:14 +0000 Subject: [PATCH 075/143] Added attributes to zcl.json to mark them as implemented in attributeAccessInterfaceAttributes --- .../zcl/zcl-with-test-extensions.json | 37 ++++++++++++++++++- src/app/zap-templates/zcl/zcl.json | 37 ++++++++++++++++++- 2 files changed, 72 insertions(+), 2 deletions(-) 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 634f66606f6a60..c6d13646750a36 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -178,7 +178,42 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Descriptor": ["ClusterRevision"], - "Device Energy Management": ["Forecast"], + "Device Energy Management": [ + "ESAType", + "ESACanGenerate", + "ESAState", + "AbsMinPower", + "AbsMaxPower", + "PowerAdjustmentCapability", + "Forecast", + "FeatureMap" + ], + "Energy EVSE": [ + "State", + "SupplyState", + "FaultState", + "ChargingEnabledUntil", + "DischargingEnabledUntil", + "CircuitCapacity", + "MinimumChargeCurrent", + "MaximumChargeCurrent", + "MaximumDischargeCurrent", + "UserMaximumChargeCurrent", + "RandomizationDelayWindow", + "NextChargeStartTime", + "NextChargeTargetTime", + "NextChargeRequiredEnergy", + "NextChargeTargetSoC", + "ApproximateEVEfficiency", + "StateOfCharge", + "BatteryCapacity", + "VehicleID", + "SessionID", + "SessionDuration", + "SessionEnergyCharged", + "SessionEnergyDischarged", + "FeatureMap" + ], "Ethernet Network Diagnostics": [ "PHYRate", "FullDuplex", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index a0556e6da7ebb2..99f3b0cfa2dfcf 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -176,7 +176,42 @@ ], "Bridged Device Basic Information": ["ProductAppearance"], "Descriptor": ["ClusterRevision"], - "Device Energy Management": ["Forecast"], + "Device Energy Management": [ + "ESAType", + "ESACanGenerate", + "ESAState", + "AbsMinPower", + "AbsMaxPower", + "PowerAdjustmentCapability", + "Forecast", + "FeatureMap" + ], + "Energy EVSE": [ + "State", + "SupplyState", + "FaultState", + "ChargingEnabledUntil", + "DischargingEnabledUntil", + "CircuitCapacity", + "MinimumChargeCurrent", + "MaximumChargeCurrent", + "MaximumDischargeCurrent", + "UserMaximumChargeCurrent", + "RandomizationDelayWindow", + "NextChargeStartTime", + "NextChargeTargetTime", + "NextChargeRequiredEnergy", + "NextChargeTargetSoC", + "ApproximateEVEfficiency", + "StateOfCharge", + "BatteryCapacity", + "VehicleID", + "SessionID", + "SessionDuration", + "SessionEnergyCharged", + "SessionEnergyDischarged", + "FeatureMap" + ], "Ethernet Network Diagnostics": [ "PHYRate", "FullDuplex", From d7b6b08e01720ab7779c55095ead57ae3cab961b Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 8 Jan 2024 18:50:14 +0000 Subject: [PATCH 076/143] Ran regen_all.py after changing zcl.json --- .../all-clusters-app.matter | 40 +- .../energy-management-app.matter | 42 +- .../zap-generated/CHIPInvokeCallbacks.cpp | 64 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 879 ++++++----- .../zap-generated/attributes/Accessors.cpp | 1285 +---------------- .../zap-generated/attributes/Accessors.h | 181 --- 6 files changed, 525 insertions(+), 1966 deletions(-) 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 a01335ad28aa89..c91760fb018d10 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 @@ -3741,7 +3741,7 @@ provisional cluster ElectricalEnergyMeasurement = 145 { /** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */ provisional cluster DeviceEnergyManagement = 152 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum CauseEnum : enum8 { kNormalCompletion = 0; @@ -7559,18 +7559,18 @@ endpoint 1 { emits event PowerAdjustEnd; emits event Paused; emits event Resumed; - callback attribute ESAType default = 0; - callback attribute ESACanGenerate default = 0; - callback attribute ESAState default = 0; - callback attribute absMinPower default = 0; - callback attribute absMaxPower default = 0; + callback attribute ESAType; + callback attribute ESACanGenerate; + callback attribute ESAState; + callback attribute absMinPower; + callback attribute absMaxPower; callback attribute powerAdjustmentCapability; callback attribute forecast; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - callback attribute featureMap default = 0; + callback attribute featureMap; ram attribute clusterRevision default = 2; handle command PowerAdjustRequest; @@ -7583,24 +7583,24 @@ endpoint 1 { } server cluster EnergyEvse { - callback attribute state default = 0; - callback attribute supplyState default = 0; - callback attribute faultState default = 0; - callback attribute chargingEnabledUntil default = 0; - callback attribute dischargingEnabledUntil default = 0; - callback attribute circuitCapacity default = 0; - callback attribute minimumChargeCurrent default = 6000; - callback attribute maximumChargeCurrent default = 0; - callback attribute maximumDischargeCurrent default = 0; - callback attribute userMaximumChargeCurrent default = 0; - callback attribute randomizationDelayWindow default = 600; + callback attribute state; + callback attribute supplyState; + callback attribute faultState; + callback attribute chargingEnabledUntil; + callback attribute dischargingEnabledUntil; + callback attribute circuitCapacity; + callback attribute minimumChargeCurrent; + callback attribute maximumChargeCurrent; + callback attribute maximumDischargeCurrent; + callback attribute userMaximumChargeCurrent; + callback attribute randomizationDelayWindow; callback attribute numberOfWeeklyTargets default = 0; callback attribute numberOfDailyTargets default = 1; callback attribute nextChargeStartTime; callback attribute nextChargeTargetTime; callback attribute nextChargeRequiredEnergy; callback attribute nextChargeTargetSoC; - callback attribute approximateEVEfficiency default = 0xFFFF; + callback attribute approximateEVEfficiency; callback attribute stateOfCharge; callback attribute batteryCapacity; callback attribute vehicleID; @@ -7612,7 +7612,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - callback attribute featureMap default = 0; + callback attribute featureMap; ram attribute clusterRevision default = 2; handle command GetTargetsResponse; 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 4063980ea9bda9..753c428234a038 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 @@ -902,7 +902,7 @@ cluster GroupKeyManagement = 63 { /** This cluster allows a client to manage the power draw of a device. An example of such a client could be an Energy Management System (EMS) which controls an Energy Smart Appliance (ESA). */ provisional cluster DeviceEnergyManagement = 152 { - revision 1; // NOTE: Default/not specifically set + revision 2; enum CauseEnum : enum8 { kNormalCompletion = 0; @@ -1474,18 +1474,18 @@ endpoint 1 { emits event PowerAdjustEnd; emits event Paused; emits event Resumed; - callback attribute ESAType default = 0; - callback attribute ESACanGenerate default = 0; - callback attribute ESAState default = 0; - callback attribute absMinPower default = 0; - callback attribute absMaxPower default = 0; + callback attribute ESAType; + callback attribute ESACanGenerate; + callback attribute ESAState; + callback attribute absMinPower; + callback attribute absMaxPower; callback attribute powerAdjustmentCapability; callback attribute forecast; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - callback attribute featureMap default = 0; + callback attribute featureMap; ram attribute clusterRevision default = 2; handle command PowerAdjustRequest; @@ -1507,33 +1507,33 @@ endpoint 1 { callback attribute state; callback attribute supplyState; callback attribute faultState; - callback attribute chargingEnabledUntil default = 0; - callback attribute dischargingEnabledUntil default = 0; - callback attribute circuitCapacity default = 0; - callback attribute minimumChargeCurrent default = 6000; - callback attribute maximumChargeCurrent default = 0; - callback attribute maximumDischargeCurrent default = 0; - callback attribute userMaximumChargeCurrent default = 0; - callback attribute randomizationDelayWindow default = 600; + callback attribute chargingEnabledUntil; + callback attribute dischargingEnabledUntil; + callback attribute circuitCapacity; + callback attribute minimumChargeCurrent; + callback attribute maximumChargeCurrent; + callback attribute maximumDischargeCurrent; + callback attribute userMaximumChargeCurrent; + callback attribute randomizationDelayWindow; callback attribute numberOfWeeklyTargets default = 0; callback attribute numberOfDailyTargets default = 1; callback attribute nextChargeStartTime; callback attribute nextChargeTargetTime; callback attribute nextChargeRequiredEnergy; callback attribute nextChargeTargetSoC; - callback attribute approximateEVEfficiency default = 0xFFFF; + callback attribute approximateEVEfficiency; callback attribute stateOfCharge; callback attribute batteryCapacity; callback attribute vehicleID; - callback attribute sessionID default = 0; - callback attribute sessionDuration default = 0; - callback attribute sessionEnergyCharged default = 0; - callback attribute sessionEnergyDischarged default = 0; + callback attribute sessionID; + callback attribute sessionDuration; + callback attribute sessionEnergyCharged; + callback attribute sessionEnergyDischarged; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - callback attribute featureMap default = 1; + callback attribute featureMap; ram attribute clusterRevision default = 2; handle command GetTargetsResponse; diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 8c3deacae5abaf..3c2c132eec3246 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -1545,7 +1545,7 @@ void CHIPGeneralCommissioningClusterArmFailSafeResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, ErrorCode, DebugText); } CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback:: - CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(jobject javaCallback) : +CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -1562,8 +1562,8 @@ CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback:: } } -CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback:: - ~CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback() +CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback::~ +CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -1612,7 +1612,7 @@ void CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback::Callbac env->CallVoidMethod(javaCallbackRef, javaMethod, ErrorCode, DebugText); } CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback:: - CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback(jobject javaCallback) : +CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -1629,8 +1629,8 @@ CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback:: } } -CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback:: - ~CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback() +CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback::~ +CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -2514,7 +2514,7 @@ void CHIPOperationalCredentialsClusterAttestationResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, AttestationElements, AttestationSignature); } CHIPOperationalCredentialsClusterCertificateChainResponseCallback:: - CHIPOperationalCredentialsClusterCertificateChainResponseCallback(jobject javaCallback) : +CHIPOperationalCredentialsClusterCertificateChainResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -2531,8 +2531,8 @@ CHIPOperationalCredentialsClusterCertificateChainResponseCallback:: } } -CHIPOperationalCredentialsClusterCertificateChainResponseCallback:: - ~CHIPOperationalCredentialsClusterCertificateChainResponseCallback() +CHIPOperationalCredentialsClusterCertificateChainResponseCallback::~ +CHIPOperationalCredentialsClusterCertificateChainResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -2910,7 +2910,7 @@ void CHIPGroupKeyManagementClusterKeySetReadResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, GroupKeySet); } CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback:: - CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(jobject javaCallback) : +CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -2927,8 +2927,8 @@ CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback:: } } -CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback:: - ~CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback() +CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback::~ +CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -3106,7 +3106,7 @@ void CHIPIcdManagementClusterStayActiveResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, PromisedActiveDuration); } CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback:: - CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback(jobject javaCallback) : +CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -3123,8 +3123,8 @@ CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback:: } } -CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback:: - ~CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback() +CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback::~ +CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -3367,7 +3367,7 @@ void CHIPLaundryWasherModeClusterChangeToModeResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, Status, StatusText); } CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback(jobject javaCallback) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -3384,8 +3384,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCa } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -3796,8 +3796,8 @@ CHIPRvcOperationalStateClusterOperationalCommandResponseCallback::CHIPRvcOperati } } -CHIPRvcOperationalStateClusterOperationalCommandResponseCallback:: - ~CHIPRvcOperationalStateClusterOperationalCommandResponseCallback() +CHIPRvcOperationalStateClusterOperationalCommandResponseCallback::~ +CHIPRvcOperationalStateClusterOperationalCommandResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6331,7 +6331,7 @@ void CHIPContentAppObserverClusterContentAppMessageResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, Status, Data, EncodingHint); } CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback:: - CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback(jobject javaCallback) : +CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -6348,8 +6348,8 @@ CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback:: } } -CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback:: - ~CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback() +CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback::~ +CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6426,7 +6426,7 @@ void CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback::Call env->CallVoidMethod(javaCallbackRef, javaMethod, profileCount, profileIntervalPeriod, maxNumberOfIntervals, listOfAttributes); } CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback:: - CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback(jobject javaCallback) : +CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -6443,8 +6443,8 @@ CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback:: } } -CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback:: - ~CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback() +CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback::~ +CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -7372,7 +7372,7 @@ void CHIPUnitTestingClusterTestNullableOptionalResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, wasPresent, wasNull, value, originalValue); } CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback:: - CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback(jobject javaCallback) : +CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -7389,8 +7389,8 @@ CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback:: } } -CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback:: - ~CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback() +CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback::~ +CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -8267,7 +8267,7 @@ void CHIPUnitTestingClusterTestEmitTestEventResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, value); } CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback:: - CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback(jobject javaCallback) : +CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -8284,8 +8284,8 @@ CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback:: } } -CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback:: - ~CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback() +CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback::~ +CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 9b9c6dbf5b84a8..5a72bbb8f90669 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -1416,7 +1416,7 @@ void CHIPOnOffAttributeListAttributeCallback::CallbackFn(void * context, } CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback:: - CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -1434,8 +1434,8 @@ CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback:: } } -CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback:: - ~CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback() +CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback::~ +CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -1507,8 +1507,8 @@ CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback::CHIPOnOffSwitc } } -CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback:: - ~CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback() +CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback::~ +CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5528,7 +5528,7 @@ void CHIPBasicInformationAttributeListAttributeCallback::CallbackFn( } CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback:: - CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5546,8 +5546,8 @@ CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback:: } } -CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback:: - ~CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback::~ +CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5601,7 +5601,7 @@ void CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback::Callbac } CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback:: - CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5619,8 +5619,8 @@ CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback:: } } -CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback:: - ~CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback::~ +CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5818,7 +5818,7 @@ void CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback::CallbackFn( } CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback:: - CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5836,8 +5836,8 @@ CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback:: } } -CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback:: - ~CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback() +CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback::~ +CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5929,7 +5929,7 @@ void CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback::Callbac } CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback:: - CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5947,8 +5947,8 @@ CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback:: } } -CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback:: - ~CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback() +CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback::~ +CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5998,7 +5998,7 @@ void CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback::Callbac } CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback:: - CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6016,8 +6016,8 @@ CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback:: } } -CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback:: - ~CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback::~ +CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6071,7 +6071,7 @@ void CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback::Callba } CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback:: - CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6089,8 +6089,8 @@ CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback:: } } -CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback:: - ~CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback::~ +CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6356,7 +6356,7 @@ void CHIPLocalizationConfigurationSupportedLocalesAttributeCallback::CallbackFn( } CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback:: - CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6374,8 +6374,8 @@ CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback:: } } -CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback:: - ~CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback() +CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback::~ +CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6429,7 +6429,7 @@ void CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback::Callbac } CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback:: - CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6447,8 +6447,8 @@ CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback:: } } -CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback:: - ~CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback() +CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback::~ +CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6646,7 +6646,7 @@ void CHIPLocalizationConfigurationAttributeListAttributeCallback::CallbackFn( } CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback:: - CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6664,8 +6664,8 @@ CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback:: } } -CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback:: - ~CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback() +CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback::~ +CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -7365,7 +7365,7 @@ void CHIPPowerSourceConfigurationSourcesAttributeCallback::CallbackFn( } CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback:: - CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -7383,8 +7383,8 @@ CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback:: } } -CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback:: - ~CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback() +CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback::~ +CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -7456,8 +7456,8 @@ CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback::CHIPPowerSourc } } -CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback:: - ~CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback() +CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback::~ +CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -12543,7 +12543,7 @@ void CHIPThreadNetworkDiagnosticsChannelPage0MaskAttributeCallback::CallbackFn( } CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback:: - CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -12561,8 +12561,8 @@ CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback:: } } -CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback:: - ~CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback() +CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback::~ +CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -12617,7 +12617,7 @@ void CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback::Callb } CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback:: - CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -12635,8 +12635,8 @@ CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback:: } } -CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback:: - ~CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback() +CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback::~ +CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -12708,8 +12708,8 @@ CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback::CHIPThreadNetw } } -CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback:: - ~CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback() +CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback::~ +CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -13380,7 +13380,7 @@ void CHIPWiFiNetworkDiagnosticsBeaconRxCountAttributeCallback::CallbackFn(void * } CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback:: - CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -13398,8 +13398,8 @@ CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback:: } } -CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback:: - ~CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback() +CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback::~ +CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -13449,7 +13449,7 @@ void CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback::Callback } CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback:: - CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -13467,8 +13467,8 @@ CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback:: } } -CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback:: - ~CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback() +CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback::~ +CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -14282,7 +14282,7 @@ void CHIPEthernetNetworkDiagnosticsCarrierDetectAttributeCallback::CallbackFn(vo } CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback:: - CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -14300,8 +14300,8 @@ CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback:: } } -CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback:: - ~CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback() +CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback::~ +CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -14355,7 +14355,7 @@ void CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback::Callba } CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback:: - CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -14373,8 +14373,8 @@ CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback:: } } -CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback:: - ~CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback() +CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback::~ +CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -15284,7 +15284,7 @@ void CHIPTimeSynchronizationAttributeListAttributeCallback::CallbackFn( } CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback:: - CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -15302,8 +15302,8 @@ CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback:: } } -CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback:: - ~CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback() +CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback::~ +CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -15357,7 +15357,7 @@ void CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback::Cal } CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback:: - CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -15375,8 +15375,8 @@ CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback:: } } -CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback:: - ~CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback() +CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback::~ +CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -15992,7 +15992,7 @@ void CHIPAdministratorCommissioningAdminVendorIdAttributeCallback::CallbackFn( } CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback:: - CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -16010,8 +16010,8 @@ CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback:: } } -CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback:: - ~CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback() +CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback::~ +CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -16065,7 +16065,7 @@ void CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback::Callba } CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback:: - CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -16083,8 +16083,8 @@ CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback:: } } -CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback:: - ~CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback() +CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback::~ +CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -16517,7 +16517,7 @@ void CHIPOperationalCredentialsFabricsAttributeCallback::CallbackFn( } CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback:: - CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -16535,8 +16535,8 @@ CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback:: } } -CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback:: - ~CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback() +CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback::~ +CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -20166,7 +20166,7 @@ void CHIPOvenCavityOperationalStateCountdownTimeAttributeCallback::CallbackFn( } CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback:: - CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -20184,8 +20184,8 @@ CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback:: } } -CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback:: - ~CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback() +CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback::~ +CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -20276,7 +20276,7 @@ void CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback::Callba } CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback:: - CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -20294,8 +20294,8 @@ CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback:: } } -CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback:: - ~CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback() +CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback::~ +CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -20349,7 +20349,7 @@ void CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback::Callba } CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback:: - CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -20367,8 +20367,8 @@ CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback:: } } -CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback:: - ~CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback() +CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback::~ +CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -22731,7 +22731,7 @@ void CHIPLaundryWasherModeAttributeListAttributeCallback::CallbackFn( } CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -22750,8 +22750,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallba } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -22890,7 +22890,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeC } CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -22909,8 +22909,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback: } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -22961,7 +22961,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCall } CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -22980,8 +22980,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback:: } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23032,7 +23032,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback: } CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -23051,8 +23051,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttribute } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23109,7 +23109,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttr } CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -23128,8 +23128,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeC } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23186,7 +23186,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttri } CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -23205,8 +23205,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback:: } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23261,7 +23261,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallba } CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback:: - CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -23280,8 +23280,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallbac } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback:: - ~CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback::~ +CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -24820,7 +24820,7 @@ void CHIPRvcCleanModeAttributeListAttributeCallback::CallbackFn(void * context, } CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback:: - CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -24838,8 +24838,8 @@ CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback:: } } -CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback:: - ~CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback() +CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback::~ +CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29261,7 +29261,7 @@ void CHIPHepaFilterMonitoringAttributeListAttributeCallback::CallbackFn( } CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback:: - CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29279,8 +29279,8 @@ CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback:: } } -CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback:: - ~CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback() +CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback::~ +CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29330,7 +29330,7 @@ void CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback::Callba } CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback:: - CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -29349,8 +29349,8 @@ CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback:: } } -CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback:: - ~CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback::~ +CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29433,7 +29433,7 @@ void CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback: } CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback:: - CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29451,8 +29451,8 @@ CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback:: } } -CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback:: - ~CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback::~ +CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29506,7 +29506,7 @@ void CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback::C } CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback:: - CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29524,8 +29524,8 @@ CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback:: } } -CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback:: - ~CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback::~ +CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29651,7 +29651,7 @@ void CHIPActivatedCarbonFilterMonitoringEventListAttributeCallback::CallbackFn( } CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback:: - CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29669,8 +29669,8 @@ CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback:: } } -CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback:: - ~CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback::~ +CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29724,7 +29724,7 @@ void CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback::Callback } CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback:: - CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29742,8 +29742,8 @@ CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback:: } } -CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback:: - ~CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback() +CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback::~ +CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29797,7 +29797,7 @@ void CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback::Callbac } CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback:: - CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29815,8 +29815,8 @@ CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback:: } } -CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback:: - ~CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback() +CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback::~ +CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30082,7 +30082,7 @@ void CHIPValveConfigurationAndControlOpenDurationAttributeCallback::CallbackFn( } CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback:: - CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30100,8 +30100,8 @@ CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback:: } } -CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback:: - ~CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback() +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback::~ +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30219,7 +30219,7 @@ void CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CallbackFn( } CHIPValveConfigurationAndControlRemainingDurationAttributeCallback:: - CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30237,8 +30237,8 @@ CHIPValveConfigurationAndControlRemainingDurationAttributeCallback:: } } -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback:: - ~CHIPValveConfigurationAndControlRemainingDurationAttributeCallback() +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::~ +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30560,7 +30560,7 @@ void CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CallbackFn( } CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback:: - CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30578,8 +30578,8 @@ CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback:: } } -CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback:: - ~CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback() +CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback::~ +CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30633,7 +30633,7 @@ void CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback::Call } CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback:: - CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30651,8 +30651,8 @@ CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback:: } } -CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback:: - ~CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback() +CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback::~ +CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30850,7 +30850,7 @@ void CHIPValveConfigurationAndControlAttributeListAttributeCallback::CallbackFn( } CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback:: - CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30868,8 +30868,8 @@ CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback() +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback::~ +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30923,7 +30923,7 @@ void CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback::Callb } CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback:: - CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30941,8 +30941,8 @@ CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback() +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback::~ +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -31140,7 +31140,7 @@ void CHIPElectricalEnergyMeasurementAttributeListAttributeCallback::CallbackFn( } CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback:: - CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -31158,8 +31158,8 @@ CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback:: } } -CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback:: - ~CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback() +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback::~ +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -32375,7 +32375,7 @@ void CHIPDemandResponseLoadControlActiveEventsAttributeCallback::CallbackFn( } CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback:: - CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -32393,8 +32393,8 @@ CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback:: } } -CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback:: - ~CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback() +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback::~ +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -32448,7 +32448,7 @@ void CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback::Callbac } CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback:: - CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -32466,8 +32466,8 @@ CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback:: } } -CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback:: - ~CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback() +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback::~ +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -32665,7 +32665,7 @@ void CHIPDemandResponseLoadControlAttributeListAttributeCallback::CallbackFn( } CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback:: - CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -32683,8 +32683,8 @@ CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback:: } } -CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback:: - ~CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback() +CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback::~ +CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35493,8 +35493,8 @@ CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback::CHIPWindowCove } } -CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback:: - ~CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback() +CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback::~ +CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35562,8 +35562,8 @@ CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback::CHIPWindowCove } } -CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback:: - ~CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback() +CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback::~ +CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35613,7 +35613,7 @@ void CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback::CallbackF } CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback:: - CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35631,8 +35631,8 @@ CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback:: } } -CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback:: - ~CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback() +CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback::~ +CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35682,7 +35682,7 @@ void CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback::Callbac } CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback:: - CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35700,8 +35700,8 @@ CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback:: } } -CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback:: - ~CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback() +CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback::~ +CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35751,7 +35751,7 @@ void CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback::Callbac } CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback:: - CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35769,8 +35769,8 @@ CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback:: } } -CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback:: - ~CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback() +CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback::~ +CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35820,7 +35820,7 @@ void CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback::Callba } CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback:: - CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35838,8 +35838,8 @@ CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback:: } } -CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback:: - ~CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback() +CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback::~ +CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -36681,8 +36681,8 @@ CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback::CHIPPumpConfig } } -CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback:: - ~CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback() +CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback::~ +CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -36750,8 +36750,8 @@ CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback::CHIPPumpConfig } } -CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback:: - ~CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback() +CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback::~ +CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37481,7 +37481,7 @@ void CHIPPumpConfigurationAndControlSpeedAttributeCallback::CallbackFn(void * co } CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback:: - CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37499,8 +37499,8 @@ CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback:: } } -CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback:: - ~CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback() +CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback::~ +CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37618,7 +37618,7 @@ void CHIPPumpConfigurationAndControlPowerAttributeCallback::CallbackFn(void * co } CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback:: - CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37636,8 +37636,8 @@ CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback:: } } -CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback:: - ~CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback() +CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback::~ +CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37687,7 +37687,7 @@ void CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback::Cal } CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback:: - CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37705,8 +37705,8 @@ CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback:: } } -CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback:: - ~CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback() +CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback::~ +CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37760,7 +37760,7 @@ void CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback::Callb } CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback:: - CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37778,8 +37778,8 @@ CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback:: } } -CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback:: - ~CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback() +CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback::~ +CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39410,7 +39410,7 @@ void CHIPFanControlAttributeListAttributeCallback::CallbackFn(void * context, } CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback:: - CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -39429,8 +39429,8 @@ CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback:: } } -CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback:: - ~CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback::~ +CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39485,7 +39485,7 @@ void CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallba } CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback:: - CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -39504,8 +39504,8 @@ CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback:: } } -CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback:: - ~CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback::~ +CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39560,7 +39560,7 @@ void CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallbac } CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback:: - CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -39578,8 +39578,8 @@ CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback:: } } -CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback:: - ~CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback::~ +CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39633,7 +39633,7 @@ void CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback::Callbac } CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback:: - CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -39651,8 +39651,8 @@ CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback:: } } -CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback:: - ~CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback::~ +CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -40818,8 +40818,8 @@ CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback::CHIPBallastCon } } -CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback:: - ~CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback() +CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback::~ +CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43680,8 +43680,8 @@ CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback::CHIPRelativeHu } } -CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback() +CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback::~ +CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43749,8 +43749,8 @@ CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback::CHIPRelativeHu } } -CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback() +CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43800,7 +43800,7 @@ void CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback::CallbackF } CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback:: - CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -43818,8 +43818,8 @@ CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback() +CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback::~ +CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43873,7 +43873,7 @@ void CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback::Callb } CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback:: - CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -43891,8 +43891,8 @@ CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback() +CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback::~ +CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44376,7 +44376,7 @@ void CHIPOccupancySensingAttributeListAttributeCallback::CallbackFn( } CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -44394,8 +44394,8 @@ CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback:: } } -CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44445,7 +44445,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback::C } CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44464,8 +44464,8 @@ CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44516,7 +44516,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback } CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44535,8 +44535,8 @@ CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44587,7 +44587,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback } CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44606,8 +44606,8 @@ CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44658,7 +44658,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallbac } CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44677,8 +44677,8 @@ CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback: } } -CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44729,7 +44729,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCall } CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44748,8 +44748,8 @@ CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback: } } -CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44804,7 +44804,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCall } CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44823,8 +44823,8 @@ CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44879,7 +44879,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallb } CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -44897,8 +44897,8 @@ CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback:: } } -CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44952,7 +44952,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback::Callb } CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback:: - CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -44970,8 +44970,8 @@ CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback:: } } -CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback:: - ~CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback::~ +CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45025,7 +45025,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback::C } CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -45043,8 +45043,8 @@ CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45094,7 +45094,7 @@ void CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback::Ca } CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45113,8 +45113,8 @@ CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45165,7 +45165,7 @@ void CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback: } CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45184,8 +45184,8 @@ CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45236,7 +45236,7 @@ void CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback: } CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45255,8 +45255,8 @@ CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45307,7 +45307,7 @@ void CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback } CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45326,8 +45326,8 @@ CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45378,7 +45378,7 @@ void CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallb } CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45397,8 +45397,8 @@ CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45453,7 +45453,7 @@ void CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallb } CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45472,8 +45472,8 @@ CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45528,7 +45528,7 @@ void CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallba } CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -45546,8 +45546,8 @@ CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45601,7 +45601,7 @@ void CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback::Callba } CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback:: - CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -45619,8 +45619,8 @@ CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback:: } } -CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback:: - ~CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback::~ +CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45674,7 +45674,7 @@ void CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback::Ca } CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45693,8 +45693,8 @@ CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: } } -CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45744,7 +45744,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: } CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45763,8 +45763,8 @@ CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45815,7 +45815,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallbac } CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45834,8 +45834,8 @@ CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45886,7 +45886,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallbac } CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45905,8 +45905,8 @@ CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45957,7 +45957,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallba } CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -45976,8 +45976,8 @@ CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback } } -CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46028,7 +46028,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCal } CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -46047,8 +46047,8 @@ CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback } } -CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46103,7 +46103,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCal } CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -46122,8 +46122,8 @@ CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback: } } -CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46178,7 +46178,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCall } CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46196,8 +46196,8 @@ CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback:: } } -CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46251,7 +46251,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback::Call } CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback:: - CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -46270,8 +46270,8 @@ CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback:: } } -CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback:: - ~CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback::~ +CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46393,7 +46393,7 @@ void CHIPOzoneConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn } CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46411,8 +46411,8 @@ CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46462,7 +46462,7 @@ void CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback::Callbac } CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46480,8 +46480,8 @@ CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46531,7 +46531,7 @@ void CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callbac } CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46549,8 +46549,8 @@ CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46600,7 +46600,7 @@ void CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callba } CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46618,8 +46618,8 @@ CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback:: } } -CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46669,7 +46669,7 @@ void CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback::Cal } CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46687,8 +46687,8 @@ CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46742,7 +46742,7 @@ void CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback::Cal } CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46760,8 +46760,8 @@ CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47027,7 +47027,7 @@ void CHIPPm25ConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn( } CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47045,8 +47045,8 @@ CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47096,7 +47096,7 @@ void CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback::Callback } CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47114,8 +47114,8 @@ CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47165,7 +47165,7 @@ void CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callback } CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47183,8 +47183,8 @@ CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47234,7 +47234,7 @@ void CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callbac } CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47252,8 +47252,8 @@ CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: } } -CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47303,7 +47303,7 @@ void CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback::Call } CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47321,8 +47321,8 @@ CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47376,7 +47376,7 @@ void CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback::Call } CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47394,8 +47394,8 @@ CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47593,7 +47593,7 @@ void CHIPPm25ConcentrationMeasurementAttributeListAttributeCallback::CallbackFn( } CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47611,8 +47611,8 @@ CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47662,7 +47662,7 @@ void CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback::Cal } CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47681,8 +47681,8 @@ CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47732,7 +47732,7 @@ void CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback:: } CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47751,8 +47751,8 @@ CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47802,7 +47802,7 @@ void CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47821,8 +47821,8 @@ CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47873,7 +47873,7 @@ void CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback: } CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47892,8 +47892,8 @@ CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47944,7 +47944,7 @@ void CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallba } CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47963,8 +47963,8 @@ CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48019,7 +48019,7 @@ void CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallba } CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -48038,8 +48038,8 @@ CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48094,7 +48094,7 @@ void CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallbac } CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48112,8 +48112,8 @@ CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48167,7 +48167,7 @@ void CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback::Callbac } CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback:: - CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48185,8 +48185,8 @@ CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback:: } } -CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback:: - ~CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback::~ +CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48326,8 +48326,8 @@ CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback::CHIPPm1Concent } } -CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48395,8 +48395,8 @@ CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback::CHIPPm1Concent } } -CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48446,7 +48446,7 @@ void CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback::CallbackF } CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48464,8 +48464,8 @@ CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48515,7 +48515,7 @@ void CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callback } CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48533,8 +48533,8 @@ CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: } } -CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48584,7 +48584,7 @@ void CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback::Callb } CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48602,8 +48602,8 @@ CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48657,7 +48657,7 @@ void CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback::Callb } CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48675,8 +48675,8 @@ CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48942,7 +48942,7 @@ void CHIPPm10ConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn( } CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48960,8 +48960,8 @@ CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49011,7 +49011,7 @@ void CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback::Callback } CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49029,8 +49029,8 @@ CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49080,7 +49080,7 @@ void CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callback } CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49098,8 +49098,8 @@ CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49149,7 +49149,7 @@ void CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callbac } CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49167,8 +49167,8 @@ CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: } } -CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49218,7 +49218,7 @@ void CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback::Call } CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49236,8 +49236,8 @@ CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49291,7 +49291,7 @@ void CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback::Call } CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49309,8 +49309,8 @@ CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49508,7 +49508,7 @@ void CHIPPm10ConcentrationMeasurementAttributeListAttributeCallback::CallbackFn( } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -49527,8 +49527,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeC } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49581,8 +49581,7 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttri } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, - bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -49601,8 +49600,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttribu } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49655,8 +49654,7 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAt } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, - bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -49675,8 +49673,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttribu } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49729,8 +49727,7 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAt } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, - bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterPeakMeasuredValueAttributeCallbackType>(CallbackFn, this), keepAlive(keepAlive) @@ -49749,8 +49746,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttrib } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49803,8 +49800,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueA } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, - bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterAverageMeasuredValueAttributeCallbackType>(CallbackFn, this), @@ -49824,8 +49821,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAtt } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49879,8 +49876,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredVal } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, - bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterGeneratedCommandListAttributeCallbackType>(CallbackFn, this), @@ -49900,8 +49897,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAtt } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49959,8 +49956,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandLi } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, - bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterAcceptedCommandListAttributeCallbackType>(CallbackFn, this), keepAlive(keepAlive) @@ -49979,8 +49976,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttr } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50038,7 +50035,7 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandLis } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -50057,8 +50054,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallb } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50114,7 +50111,7 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttribute } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback:: - CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -50133,8 +50130,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeC } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback:: - ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback::~ +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50259,7 +50256,7 @@ void CHIPRadonConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn } CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback:: - CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50277,8 +50274,8 @@ CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback:: } } -CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback:: - ~CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback::~ +CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50328,7 +50325,7 @@ void CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback::Callbac } CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50346,8 +50343,8 @@ CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } } -CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback:: - ~CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ +CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50397,7 +50394,7 @@ void CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callbac } CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50415,8 +50412,8 @@ CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback:: } } -CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback:: - ~CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ +CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50466,7 +50463,7 @@ void CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callba } CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50484,8 +50481,8 @@ CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback:: } } -CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback:: - ~CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ +CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50535,7 +50532,7 @@ void CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback::Cal } CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback:: - CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50553,8 +50550,8 @@ CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback:: } } -CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback:: - ~CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback::~ +CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50608,7 +50605,7 @@ void CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback::Cal } CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback:: - CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : +CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50626,8 +50623,8 @@ CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback:: } } -CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback:: - ~CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback::~ +CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) 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 12d34873854914..147b18ffae1445 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 @@ -10453,192 +10453,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace DeviceEnergyManagement { namespace Attributes { -namespace ESAType { - -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESATypeEnum * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESATypeEnum value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); -} - -} // namespace ESAType - -namespace ESACanGenerate { - -EmberAfStatus Get(chip::EndpointId endpoint, bool * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, bool value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); -} - -} // namespace ESACanGenerate - -namespace ESAState { - -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESAStateEnum * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESAStateEnum value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); -} - -} // namespace ESAState - -namespace AbsMinPower { - -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_POWER_MW_ATTRIBUTE_TYPE); -} - -} // namespace AbsMinPower - -namespace AbsMaxPower { - -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_POWER_MW_ATTRIBUTE_TYPE); -} - -} // namespace AbsMaxPower - -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::DeviceEnergyManagement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap - namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) @@ -10676,65 +10490,11 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace EnergyEvse { namespace Attributes { -namespace State { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::StateEnum value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace State - -namespace SupplyState { +namespace NumberOfWeeklyTargets { -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::SupplyStateEnum * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); @@ -10746,9 +10506,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::Su *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::SupplyStateEnum value) +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -10756,16 +10516,16 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::Su Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } -} // namespace SupplyState +} // namespace NumberOfWeeklyTargets -namespace FaultState { +namespace NumberOfDailyTargets { -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::FaultStateEnum * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); @@ -10777,9 +10537,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::Fa *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::FaultStateEnum value) +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -10787,1027 +10547,10 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::Fa Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); -} - -} // namespace FaultState - -namespace ChargingEnabledUntil { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace ChargingEnabledUntil - -namespace DischargingEnabledUntil { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace DischargingEnabledUntil - -namespace CircuitCapacity { - -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); -} - -} // namespace CircuitCapacity - -namespace MinimumChargeCurrent { - -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); -} - -} // namespace MinimumChargeCurrent - -namespace MaximumChargeCurrent { - -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); -} - -} // namespace MaximumChargeCurrent - -namespace MaximumDischargeCurrent { - -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); -} - -} // namespace MaximumDischargeCurrent - -namespace UserMaximumChargeCurrent { - -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_AMPERAGE_MA_ATTRIBUTE_TYPE); -} - -} // namespace UserMaximumChargeCurrent - -namespace RandomizationDelayWindow { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); -} - -} // namespace RandomizationDelayWindow - -namespace NumberOfWeeklyTargets { - -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace NumberOfWeeklyTargets - -namespace NumberOfDailyTargets { - -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace NumberOfDailyTargets - -namespace NextChargeStartTime { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace NextChargeStartTime - -namespace NextChargeTargetTime { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace NextChargeTargetTime - -namespace NextChargeRequiredEnergy { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace NextChargeRequiredEnergy - -namespace NextChargeTargetSoC { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace NextChargeTargetSoC - -namespace ApproximateEVEfficiency { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace ApproximateEVEfficiency - -namespace StateOfCharge { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_PERCENT_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace StateOfCharge - -namespace BatteryCapacity { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace BatteryCapacity - -namespace VehicleID { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - uint8_t zclString[32 + 1]; - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, zclString, sizeof(zclString)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - size_t length = emberAfStringLength(zclString); - if (length == NumericAttributeTraits::kNullValue) - { - value.SetNull(); - return EMBER_ZCL_STATUS_SUCCESS; - } - auto & span = value.SetNonNull(); - - VerifyOrReturnError(span.size() == 32, EMBER_ZCL_STATUS_INVALID_DATA_TYPE); - memcpy(span.data(), &zclString[1], 32); - span.reduce_size(length); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) -{ - static_assert(32 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - uint8_t zclString[32 + 1]; - auto length = static_cast(value.size()); - Encoding::Put8(zclString, length); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - uint8_t zclString[1] = { 0xFF }; - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace VehicleID - -namespace SessionID { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT32U_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace SessionID - -namespace SessionDuration { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace SessionDuration - -namespace SessionEnergyCharged { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace SessionEnergyCharged - -namespace SessionEnergyDischarged { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_ENERGY_MWH_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace SessionEnergyDischarged - -namespace FeatureMap { - -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); -} - -} // namespace FeatureMap +} // namespace NumberOfDailyTargets 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 9540569158a171..f8c849863c7b59 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 @@ -2029,36 +2029,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace DeviceEnergyManagement { namespace Attributes { -namespace ESAType { -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESATypeEnum * value); // ESATypeEnum -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESATypeEnum value); -} // namespace ESAType - -namespace ESACanGenerate { -EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean -EmberAfStatus Set(chip::EndpointId endpoint, bool value); -} // namespace ESACanGenerate - -namespace ESAState { -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESAStateEnum * value); // ESAStateEnum -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::DeviceEnergyManagement::ESAStateEnum value); -} // namespace ESAState - -namespace AbsMinPower { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // power_mw -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -} // namespace AbsMinPower - -namespace AbsMaxPower { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // power_mw -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -} // namespace AbsMaxPower - -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); @@ -2070,68 +2040,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace EnergyEvse { namespace Attributes { -namespace State { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // StateEnum -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::StateEnum value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, - const chip::app::DataModel::Nullable & value); -} // namespace State - -namespace SupplyState { -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::SupplyStateEnum * value); // SupplyStateEnum -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::SupplyStateEnum value); -} // namespace SupplyState - -namespace FaultState { -EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::FaultStateEnum * value); // FaultStateEnum -EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::EnergyEvse::FaultStateEnum value); -} // namespace FaultState - -namespace ChargingEnabledUntil { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace ChargingEnabledUntil - -namespace DischargingEnabledUntil { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace DischargingEnabledUntil - -namespace CircuitCapacity { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -} // namespace CircuitCapacity - -namespace MinimumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -} // namespace MinimumChargeCurrent - -namespace MaximumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -} // namespace MaximumChargeCurrent - -namespace MaximumDischargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -} // namespace MaximumDischargeCurrent - -namespace UserMaximumChargeCurrent { -EmberAfStatus Get(chip::EndpointId endpoint, int64_t * value); // amperage_ma -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -} // namespace UserMaximumChargeCurrent - -namespace RandomizationDelayWindow { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // elapsed_s -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -} // namespace RandomizationDelayWindow - namespace NumberOfWeeklyTargets { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); @@ -2142,95 +2050,6 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace NumberOfDailyTargets -namespace NextChargeStartTime { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace NextChargeStartTime - -namespace NextChargeTargetTime { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace NextChargeTargetTime - -namespace NextChargeRequiredEnergy { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace NextChargeRequiredEnergy - -namespace NextChargeTargetSoC { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // percent -EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace NextChargeTargetSoC - -namespace ApproximateEVEfficiency { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace ApproximateEVEfficiency - -namespace StateOfCharge { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // percent -EmberAfStatus Set(chip::EndpointId endpoint, chip::Percent value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace StateOfCharge - -namespace BatteryCapacity { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace BatteryCapacity - -namespace VehicleID { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // char_string -EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace VehicleID - -namespace SessionID { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int32u -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace SessionID - -namespace SessionDuration { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // elapsed_s -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace SessionDuration - -namespace SessionEnergyCharged { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace SessionEnergyCharged - -namespace SessionEnergyDischarged { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // energy_mwh -EmberAfStatus Set(chip::EndpointId endpoint, int64_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace SessionEnergyDischarged - -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); From b24bb80417aef9d77e424aa3e3b0da5453087191 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 8 Jan 2024 21:24:21 +0000 Subject: [PATCH 077/143] Fixed incorrect type - not picked up by all compilers. --- .../energy-management-common/src/EnergyEvseManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp index 389a830e8da759..a71474f0913abb 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp @@ -59,7 +59,7 @@ CHIP_ERROR EnergyEvseManager::LoadPersistentAttributes() } // Restore UserMaximumChargeCurrent value - uint64_t tempUserMaximumChargeCurrent; + int64_t tempUserMaximumChargeCurrent; err = aProvider->ReadScalarValue(ConcreteAttributePath(aEndpointId, EnergyEvse::Id, Attributes::UserMaximumChargeCurrent::Id), tempUserMaximumChargeCurrent); if (err == CHIP_NO_ERROR) From 2fe195d83d51801afda3bfc3e7d1285f27eec4b1 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 8 Jan 2024 21:50:26 +0000 Subject: [PATCH 078/143] Re-ran bootstrap, and then regen-all - to pick up more zap generated fixes --- .../zap-generated/CHIPInvokeCallbacks.cpp | 64 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 879 +++++++++--------- 2 files changed, 473 insertions(+), 470 deletions(-) diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 3c2c132eec3246..8c3deacae5abaf 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -1545,7 +1545,7 @@ void CHIPGeneralCommissioningClusterArmFailSafeResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, ErrorCode, DebugText); } CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback:: -CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(jobject javaCallback) : + CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -1562,8 +1562,8 @@ CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback(jobject javaC } } -CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback::~ -CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback() +CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback:: + ~CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -1612,7 +1612,7 @@ void CHIPGeneralCommissioningClusterSetRegulatoryConfigResponseCallback::Callbac env->CallVoidMethod(javaCallbackRef, javaMethod, ErrorCode, DebugText); } CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback:: -CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback(jobject javaCallback) : + CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -1629,8 +1629,8 @@ CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback(jobject jav } } -CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback::~ -CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback() +CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback:: + ~CHIPGeneralCommissioningClusterCommissioningCompleteResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -2514,7 +2514,7 @@ void CHIPOperationalCredentialsClusterAttestationResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, AttestationElements, AttestationSignature); } CHIPOperationalCredentialsClusterCertificateChainResponseCallback:: -CHIPOperationalCredentialsClusterCertificateChainResponseCallback(jobject javaCallback) : + CHIPOperationalCredentialsClusterCertificateChainResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -2531,8 +2531,8 @@ CHIPOperationalCredentialsClusterCertificateChainResponseCallback(jobject javaCa } } -CHIPOperationalCredentialsClusterCertificateChainResponseCallback::~ -CHIPOperationalCredentialsClusterCertificateChainResponseCallback() +CHIPOperationalCredentialsClusterCertificateChainResponseCallback:: + ~CHIPOperationalCredentialsClusterCertificateChainResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -2910,7 +2910,7 @@ void CHIPGroupKeyManagementClusterKeySetReadResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, GroupKeySet); } CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback:: -CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(jobject javaCallback) : + CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -2927,8 +2927,8 @@ CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback(jobject javaCa } } -CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback::~ -CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback() +CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback:: + ~CHIPGroupKeyManagementClusterKeySetReadAllIndicesResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -3106,7 +3106,7 @@ void CHIPIcdManagementClusterStayActiveResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, PromisedActiveDuration); } CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback:: -CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback(jobject javaCallback) : + CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -3123,8 +3123,8 @@ CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback(jobject } } -CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback::~ -CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback() +CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback:: + ~CHIPOvenCavityOperationalStateClusterOperationalCommandResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -3367,7 +3367,7 @@ void CHIPLaundryWasherModeClusterChangeToModeResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, Status, StatusText); } CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback(jobject javaCallback) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -3384,8 +3384,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCa } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -3796,8 +3796,8 @@ CHIPRvcOperationalStateClusterOperationalCommandResponseCallback::CHIPRvcOperati } } -CHIPRvcOperationalStateClusterOperationalCommandResponseCallback::~ -CHIPRvcOperationalStateClusterOperationalCommandResponseCallback() +CHIPRvcOperationalStateClusterOperationalCommandResponseCallback:: + ~CHIPRvcOperationalStateClusterOperationalCommandResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6331,7 +6331,7 @@ void CHIPContentAppObserverClusterContentAppMessageResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, Status, Data, EncodingHint); } CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback:: -CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback(jobject javaCallback) : + CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -6348,8 +6348,8 @@ CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback(jobject ja } } -CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback::~ -CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback() +CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback:: + ~CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6426,7 +6426,7 @@ void CHIPElectricalMeasurementClusterGetProfileInfoResponseCommandCallback::Call env->CallVoidMethod(javaCallbackRef, javaMethod, profileCount, profileIntervalPeriod, maxNumberOfIntervals, listOfAttributes); } CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback:: -CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback(jobject javaCallback) : + CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -6443,8 +6443,8 @@ CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback(job } } -CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback::~ -CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback() +CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback:: + ~CHIPElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -7372,7 +7372,7 @@ void CHIPUnitTestingClusterTestNullableOptionalResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, wasPresent, wasNull, value, originalValue); } CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback:: -CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback(jobject javaCallback) : + CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -7389,8 +7389,8 @@ CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback(jobject javaCa } } -CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback::~ -CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback() +CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback:: + ~CHIPUnitTestingClusterTestComplexNullableOptionalResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -8267,7 +8267,7 @@ void CHIPUnitTestingClusterTestEmitTestEventResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, value); } CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback:: -CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback(jobject javaCallback) : + CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); @@ -8284,8 +8284,8 @@ CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback(jobject java } } -CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback::~ -CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback() +CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback:: + ~CHIPUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback() { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 5a72bbb8f90669..9b9c6dbf5b84a8 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -1416,7 +1416,7 @@ void CHIPOnOffAttributeListAttributeCallback::CallbackFn(void * context, } CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback:: -CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -1434,8 +1434,8 @@ CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback(jobject javaCa } } -CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback::~ -CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback() +CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback:: + ~CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -1507,8 +1507,8 @@ CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback::CHIPOnOffSwitc } } -CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback::~ -CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback() +CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback:: + ~CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5528,7 +5528,7 @@ void CHIPBasicInformationAttributeListAttributeCallback::CallbackFn( } CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback:: -CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5546,8 +5546,8 @@ CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback(jobject javaC } } -CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback::~ -CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback:: + ~CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5601,7 +5601,7 @@ void CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback::Callbac } CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback:: -CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5619,8 +5619,8 @@ CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback(jobject javaCa } } -CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback::~ -CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback:: + ~CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5818,7 +5818,7 @@ void CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback::CallbackFn( } CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback:: -CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5836,8 +5836,8 @@ CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback(jobject javaC } } -CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback::~ -CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback() +CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback:: + ~CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5929,7 +5929,7 @@ void CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback::Callbac } CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback:: -CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5947,8 +5947,8 @@ CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback(jobject javaC } } -CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback::~ -CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback() +CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback:: + ~CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -5998,7 +5998,7 @@ void CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback::Callbac } CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback:: -CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6016,8 +6016,8 @@ CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback(jobject java } } -CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback::~ -CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback:: + ~CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6071,7 +6071,7 @@ void CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback::Callba } CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback:: -CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6089,8 +6089,8 @@ CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback(jobject javaC } } -CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback::~ -CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback() +CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback:: + ~CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6356,7 +6356,7 @@ void CHIPLocalizationConfigurationSupportedLocalesAttributeCallback::CallbackFn( } CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback:: -CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6374,8 +6374,8 @@ CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback(jobject javaC } } -CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback::~ -CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback() +CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback:: + ~CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6429,7 +6429,7 @@ void CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback::Callbac } CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback:: -CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6447,8 +6447,8 @@ CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback(jobject javaCa } } -CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback::~ -CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback() +CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback:: + ~CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -6646,7 +6646,7 @@ void CHIPLocalizationConfigurationAttributeListAttributeCallback::CallbackFn( } CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback:: -CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -6664,8 +6664,8 @@ CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback(jobject javaCa } } -CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback::~ -CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback() +CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback:: + ~CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -7365,7 +7365,7 @@ void CHIPPowerSourceConfigurationSourcesAttributeCallback::CallbackFn( } CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback:: -CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -7383,8 +7383,8 @@ CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback(jobject javaCa } } -CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback::~ -CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback() +CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback:: + ~CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -7456,8 +7456,8 @@ CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback::CHIPPowerSourc } } -CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback::~ -CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback() +CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback:: + ~CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -12543,7 +12543,7 @@ void CHIPThreadNetworkDiagnosticsChannelPage0MaskAttributeCallback::CallbackFn( } CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback:: -CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -12561,8 +12561,8 @@ CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback(jobject jav } } -CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback::~ -CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback() +CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback:: + ~CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -12617,7 +12617,7 @@ void CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback::Callb } CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback:: -CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -12635,8 +12635,8 @@ CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCa } } -CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback::~ -CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback() +CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback:: + ~CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -12708,8 +12708,8 @@ CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback::CHIPThreadNetw } } -CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback::~ -CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback() +CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback:: + ~CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -13380,7 +13380,7 @@ void CHIPWiFiNetworkDiagnosticsBeaconRxCountAttributeCallback::CallbackFn(void * } CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback:: -CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -13398,8 +13398,8 @@ CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback(jobject javaCa } } -CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback::~ -CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback() +CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback:: + ~CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -13449,7 +13449,7 @@ void CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback::Callback } CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback:: -CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -13467,8 +13467,8 @@ CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback(jobject javaCa } } -CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback::~ -CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback() +CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback:: + ~CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -14282,7 +14282,7 @@ void CHIPEthernetNetworkDiagnosticsCarrierDetectAttributeCallback::CallbackFn(vo } CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback:: -CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -14300,8 +14300,8 @@ CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject java } } -CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback::~ -CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback() +CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback:: + ~CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -14355,7 +14355,7 @@ void CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback::Callba } CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback:: -CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -14373,8 +14373,8 @@ CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaC } } -CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback::~ -CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback() +CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback:: + ~CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -15284,7 +15284,7 @@ void CHIPTimeSynchronizationAttributeListAttributeCallback::CallbackFn( } CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback:: -CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -15302,8 +15302,8 @@ CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback(jobject j } } -CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback::~ -CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback() +CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback:: + ~CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -15357,7 +15357,7 @@ void CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback::Cal } CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback:: -CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -15375,8 +15375,8 @@ CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback(jobject ja } } -CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback::~ -CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback() +CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback:: + ~CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -15992,7 +15992,7 @@ void CHIPAdministratorCommissioningAdminVendorIdAttributeCallback::CallbackFn( } CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback:: -CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -16010,8 +16010,8 @@ CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback(jobject java } } -CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback::~ -CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback() +CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback:: + ~CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -16065,7 +16065,7 @@ void CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback::Callba } CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback:: -CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -16083,8 +16083,8 @@ CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback(jobject javaC } } -CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback::~ -CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback() +CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback:: + ~CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -16517,7 +16517,7 @@ void CHIPOperationalCredentialsFabricsAttributeCallback::CallbackFn( } CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback:: -CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -16535,8 +16535,8 @@ CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback(jobject javaC } } -CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback::~ -CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback() +CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback:: + ~CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -20166,7 +20166,7 @@ void CHIPOvenCavityOperationalStateCountdownTimeAttributeCallback::CallbackFn( } CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback:: -CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -20184,8 +20184,8 @@ CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback(jobject java } } -CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback::~ -CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback() +CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback:: + ~CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -20276,7 +20276,7 @@ void CHIPOvenCavityOperationalStateOperationalStateListAttributeCallback::Callba } CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback:: -CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -20294,8 +20294,8 @@ CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback(jobject java } } -CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback::~ -CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback() +CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback:: + ~CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -20349,7 +20349,7 @@ void CHIPOvenCavityOperationalStateGeneratedCommandListAttributeCallback::Callba } CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback:: -CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -20367,8 +20367,8 @@ CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback(jobject javaC } } -CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback::~ -CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback() +CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback:: + ~CHIPOvenCavityOperationalStateAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -22731,7 +22731,7 @@ void CHIPLaundryWasherModeAttributeListAttributeCallback::CallbackFn( } CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -22750,8 +22750,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallba } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -22890,7 +22890,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeSupportedModesAttributeC } CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -22909,8 +22909,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback( } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -22961,7 +22961,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeStartUpModeAttributeCall } CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -22980,8 +22980,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback(jobje } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23032,7 +23032,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeOnModeAttributeCallback: } CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -23051,8 +23051,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttribute } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23109,7 +23109,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandListAttr } CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -23128,8 +23128,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeC } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23186,7 +23186,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandListAttri } CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -23205,8 +23205,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback(jo } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -23261,7 +23261,7 @@ void CHIPRefrigeratorAndTemperatureControlledCabinetModeEventListAttributeCallba } CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback:: -CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -23280,8 +23280,8 @@ CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallbac } } -CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback::~ -CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback() +CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback:: + ~CHIPRefrigeratorAndTemperatureControlledCabinetModeAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -24820,7 +24820,7 @@ void CHIPRvcCleanModeAttributeListAttributeCallback::CallbackFn(void * context, } CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback:: -CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -24838,8 +24838,8 @@ CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback(jobject javaCa } } -CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback::~ -CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback() +CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback:: + ~CHIPTemperatureControlSupportedTemperatureLevelsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29261,7 +29261,7 @@ void CHIPHepaFilterMonitoringAttributeListAttributeCallback::CallbackFn( } CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback:: -CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29279,8 +29279,8 @@ CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback(jobject java } } -CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback::~ -CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback() +CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback:: + ~CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29330,7 +29330,7 @@ void CHIPActivatedCarbonFilterMonitoringLastChangedTimeAttributeCallback::Callba } CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback:: -CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -29349,8 +29349,8 @@ CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback(jobje } } -CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback::~ -CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback:: + ~CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29433,7 +29433,7 @@ void CHIPActivatedCarbonFilterMonitoringReplacementProductListAttributeCallback: } CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback:: -CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29451,8 +29451,8 @@ CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback(jobject } } -CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback::~ -CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback:: + ~CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29506,7 +29506,7 @@ void CHIPActivatedCarbonFilterMonitoringGeneratedCommandListAttributeCallback::C } CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback:: -CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29524,8 +29524,8 @@ CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback(jobject } } -CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback::~ -CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback:: + ~CHIPActivatedCarbonFilterMonitoringAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29651,7 +29651,7 @@ void CHIPActivatedCarbonFilterMonitoringEventListAttributeCallback::CallbackFn( } CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback:: -CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29669,8 +29669,8 @@ CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback(jobject javaCa } } -CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback::~ -CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback() +CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback:: + ~CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29724,7 +29724,7 @@ void CHIPActivatedCarbonFilterMonitoringAttributeListAttributeCallback::Callback } CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback:: -CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29742,8 +29742,8 @@ CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback(jobject javaC } } -CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback::~ -CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback() +CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback:: + ~CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -29797,7 +29797,7 @@ void CHIPBooleanStateConfigurationGeneratedCommandListAttributeCallback::Callbac } CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback:: -CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -29815,8 +29815,8 @@ CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback(jobject javaCa } } -CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback::~ -CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback() +CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback:: + ~CHIPBooleanStateConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30082,7 +30082,7 @@ void CHIPValveConfigurationAndControlOpenDurationAttributeCallback::CallbackFn( } CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback:: -CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30100,8 +30100,8 @@ CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback(jobject jav } } -CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback::~ -CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback() +CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback:: + ~CHIPValveConfigurationAndControlDefaultOpenDurationAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30219,7 +30219,7 @@ void CHIPValveConfigurationAndControlAutoCloseTimeAttributeCallback::CallbackFn( } CHIPValveConfigurationAndControlRemainingDurationAttributeCallback:: -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30237,8 +30237,8 @@ CHIPValveConfigurationAndControlRemainingDurationAttributeCallback(jobject javaC } } -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback::~ -CHIPValveConfigurationAndControlRemainingDurationAttributeCallback() +CHIPValveConfigurationAndControlRemainingDurationAttributeCallback:: + ~CHIPValveConfigurationAndControlRemainingDurationAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30560,7 +30560,7 @@ void CHIPValveConfigurationAndControlTargetLevelAttributeCallback::CallbackFn( } CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback:: -CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30578,8 +30578,8 @@ CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback(jobject ja } } -CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback::~ -CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback() +CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback:: + ~CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30633,7 +30633,7 @@ void CHIPValveConfigurationAndControlGeneratedCommandListAttributeCallback::Call } CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback:: -CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30651,8 +30651,8 @@ CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback(jobject jav } } -CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback::~ -CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback() +CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback:: + ~CHIPValveConfigurationAndControlAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30850,7 +30850,7 @@ void CHIPValveConfigurationAndControlAttributeListAttributeCallback::CallbackFn( } CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback:: -CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30868,8 +30868,8 @@ CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback(jobject jav } } -CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback::~ -CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback() +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -30923,7 +30923,7 @@ void CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback::Callb } CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback:: -CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -30941,8 +30941,8 @@ CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback(jobject java } } -CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback::~ -CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback() +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -31140,7 +31140,7 @@ void CHIPElectricalEnergyMeasurementAttributeListAttributeCallback::CallbackFn( } CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback:: -CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -31158,8 +31158,8 @@ CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback(jobject javaCa } } -CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback::~ -CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback() +CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback:: + ~CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -32375,7 +32375,7 @@ void CHIPDemandResponseLoadControlActiveEventsAttributeCallback::CallbackFn( } CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback:: -CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -32393,8 +32393,8 @@ CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback(jobject javaC } } -CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback::~ -CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback() +CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback:: + ~CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -32448,7 +32448,7 @@ void CHIPDemandResponseLoadControlGeneratedCommandListAttributeCallback::Callbac } CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback:: -CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -32466,8 +32466,8 @@ CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback(jobject javaCa } } -CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback::~ -CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback() +CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback:: + ~CHIPDemandResponseLoadControlAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -32665,7 +32665,7 @@ void CHIPDemandResponseLoadControlAttributeListAttributeCallback::CallbackFn( } CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback:: -CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -32683,8 +32683,8 @@ CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback(jobject jav } } -CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback::~ -CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback() +CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback:: + ~CHIPDeviceEnergyManagementPowerAdjustmentCapabilityAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35493,8 +35493,8 @@ CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback::CHIPWindowCove } } -CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback::~ -CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback() +CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback:: + ~CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35562,8 +35562,8 @@ CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback::CHIPWindowCove } } -CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback::~ -CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback() +CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback:: + ~CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35613,7 +35613,7 @@ void CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback::CallbackF } CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback:: -CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35631,8 +35631,8 @@ CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback(jobject javaC } } -CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback::~ -CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback() +CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback:: + ~CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35682,7 +35682,7 @@ void CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback::Callbac } CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback:: -CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35700,8 +35700,8 @@ CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback(jobject javaC } } -CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback::~ -CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback() +CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback:: + ~CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35751,7 +35751,7 @@ void CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback::Callbac } CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback:: -CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35769,8 +35769,8 @@ CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback(jobject java } } -CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback::~ -CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback() +CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback:: + ~CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -35820,7 +35820,7 @@ void CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback::Callba } CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback:: -CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -35838,8 +35838,8 @@ CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback(jobject java } } -CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback::~ -CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback() +CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback:: + ~CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -36681,8 +36681,8 @@ CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback::CHIPPumpConfig } } -CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback::~ -CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback() +CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback:: + ~CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -36750,8 +36750,8 @@ CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback::CHIPPumpConfig } } -CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback::~ -CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback() +CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback:: + ~CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37481,7 +37481,7 @@ void CHIPPumpConfigurationAndControlSpeedAttributeCallback::CallbackFn(void * co } CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback:: -CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37499,8 +37499,8 @@ CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback(jobject jav } } -CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback::~ -CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback() +CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback:: + ~CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37618,7 +37618,7 @@ void CHIPPumpConfigurationAndControlPowerAttributeCallback::CallbackFn(void * co } CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback:: -CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37636,8 +37636,8 @@ CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback(jobject j } } -CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback::~ -CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback() +CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback:: + ~CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37687,7 +37687,7 @@ void CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback::Cal } CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback:: -CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37705,8 +37705,8 @@ CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback(jobject jav } } -CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback::~ -CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback() +CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback:: + ~CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -37760,7 +37760,7 @@ void CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback::Callb } CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback:: -CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -37778,8 +37778,8 @@ CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback(jobject java } } -CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback::~ -CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback() +CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback:: + ~CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39410,7 +39410,7 @@ void CHIPFanControlAttributeListAttributeCallback::CallbackFn(void * context, } CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback:: -CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -39429,8 +39429,8 @@ CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback(jo } } -CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback::~ -CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback:: + ~CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39485,7 +39485,7 @@ void CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallba } CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback:: -CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -39504,8 +39504,8 @@ CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback(job } } -CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback::~ -CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback:: + ~CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39560,7 +39560,7 @@ void CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallbac } CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback:: -CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -39578,8 +39578,8 @@ CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback(jobject javaC } } -CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback::~ -CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback:: + ~CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -39633,7 +39633,7 @@ void CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback::Callbac } CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback:: -CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -39651,8 +39651,8 @@ CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback(jobject j } } -CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback::~ -CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback() +CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback:: + ~CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -40818,8 +40818,8 @@ CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback::CHIPBallastCon } } -CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback::~ -CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback() +CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback:: + ~CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43680,8 +43680,8 @@ CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback::CHIPRelativeHu } } -CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback::~ -CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback() +CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43749,8 +43749,8 @@ CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback::CHIPRelativeHu } } -CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback() +CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43800,7 +43800,7 @@ void CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback::CallbackF } CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback:: -CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -43818,8 +43818,8 @@ CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback(jobject jav } } -CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback::~ -CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback() +CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -43873,7 +43873,7 @@ void CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback::Callb } CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback:: -CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -43891,8 +43891,8 @@ CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback(jobject java } } -CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback::~ -CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback() +CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44376,7 +44376,7 @@ void CHIPOccupancySensingAttributeListAttributeCallback::CallbackFn( } CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -44394,8 +44394,8 @@ CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject } } -CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44445,7 +44445,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementMeasuredValueAttributeCallback::C } CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44464,8 +44464,8 @@ CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobj } } -CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44516,7 +44516,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementMinMeasuredValueAttributeCallback } CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44535,8 +44535,8 @@ CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobj } } -CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44587,7 +44587,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementMaxMeasuredValueAttributeCallback } CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44606,8 +44606,8 @@ CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(job } } -CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44658,7 +44658,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementPeakMeasuredValueAttributeCallbac } CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44677,8 +44677,8 @@ CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback( } } -CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44729,7 +44729,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementAverageMeasuredValueAttributeCall } CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44748,8 +44748,8 @@ CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback( } } -CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44804,7 +44804,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementGeneratedCommandListAttributeCall } CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -44823,8 +44823,8 @@ CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback(j } } -CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44879,7 +44879,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementAcceptedCommandListAttributeCallb } CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -44897,8 +44897,8 @@ CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback(jobject jav } } -CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -44952,7 +44952,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementEventListAttributeCallback::Callb } CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback:: -CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -44970,8 +44970,8 @@ CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback(jobject } } -CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback::~ -CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback() +CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback:: + ~CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45025,7 +45025,7 @@ void CHIPCarbonMonoxideConcentrationMeasurementAttributeListAttributeCallback::C } CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -45043,8 +45043,8 @@ CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject } } -CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45094,7 +45094,7 @@ void CHIPCarbonDioxideConcentrationMeasurementMeasuredValueAttributeCallback::Ca } CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45113,8 +45113,8 @@ CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobje } } -CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45165,7 +45165,7 @@ void CHIPCarbonDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback: } CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45184,8 +45184,8 @@ CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobje } } -CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45236,7 +45236,7 @@ void CHIPCarbonDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback: } CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45255,8 +45255,8 @@ CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobj } } -CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45307,7 +45307,7 @@ void CHIPCarbonDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback } CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45326,8 +45326,8 @@ CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(j } } -CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45378,7 +45378,7 @@ void CHIPCarbonDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallb } CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45397,8 +45397,8 @@ CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(j } } -CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45453,7 +45453,7 @@ void CHIPCarbonDioxideConcentrationMeasurementGeneratedCommandListAttributeCallb } CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45472,8 +45472,8 @@ CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jo } } -CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45528,7 +45528,7 @@ void CHIPCarbonDioxideConcentrationMeasurementAcceptedCommandListAttributeCallba } CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -45546,8 +45546,8 @@ CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback(jobject java } } -CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45601,7 +45601,7 @@ void CHIPCarbonDioxideConcentrationMeasurementEventListAttributeCallback::Callba } CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback:: -CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -45619,8 +45619,8 @@ CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject } } -CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback::~ -CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback() +CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback:: + ~CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45674,7 +45674,7 @@ void CHIPCarbonDioxideConcentrationMeasurementAttributeListAttributeCallback::Ca } CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45693,8 +45693,8 @@ CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback(jobjec } } -CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45744,7 +45744,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementMeasuredValueAttributeCallback:: } CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45763,8 +45763,8 @@ CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback(job } } -CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45815,7 +45815,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementMinMeasuredValueAttributeCallbac } CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45834,8 +45834,8 @@ CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback(job } } -CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45886,7 +45886,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementMaxMeasuredValueAttributeCallbac } CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -45905,8 +45905,8 @@ CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback(jo } } -CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -45957,7 +45957,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementPeakMeasuredValueAttributeCallba } CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -45976,8 +45976,8 @@ CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback } } -CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46028,7 +46028,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementAverageMeasuredValueAttributeCal } CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -46047,8 +46047,8 @@ CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback } } -CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46103,7 +46103,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementGeneratedCommandListAttributeCal } CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -46122,8 +46122,8 @@ CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback( } } -CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46178,7 +46178,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementAcceptedCommandListAttributeCall } CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46196,8 +46196,8 @@ CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback(jobject ja } } -CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46251,7 +46251,7 @@ void CHIPNitrogenDioxideConcentrationMeasurementEventListAttributeCallback::Call } CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback:: -CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -46270,8 +46270,8 @@ CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback(jobjec } } -CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback::~ -CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback() +CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback:: + ~CHIPNitrogenDioxideConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46393,7 +46393,7 @@ void CHIPOzoneConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn } CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46411,8 +46411,8 @@ CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaC } } -CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46462,7 +46462,7 @@ void CHIPOzoneConcentrationMeasurementMinMeasuredValueAttributeCallback::Callbac } CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46480,8 +46480,8 @@ CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaC } } -CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46531,7 +46531,7 @@ void CHIPOzoneConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callbac } CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46549,8 +46549,8 @@ CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject java } } -CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46600,7 +46600,7 @@ void CHIPOzoneConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callba } CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46618,8 +46618,8 @@ CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject j } } -CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46669,7 +46669,7 @@ void CHIPOzoneConcentrationMeasurementAverageMeasuredValueAttributeCallback::Cal } CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46687,8 +46687,8 @@ CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject j } } -CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -46742,7 +46742,7 @@ void CHIPOzoneConcentrationMeasurementGeneratedCommandListAttributeCallback::Cal } CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -46760,8 +46760,8 @@ CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject ja } } -CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPOzoneConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47027,7 +47027,7 @@ void CHIPPm25ConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn( } CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47045,8 +47045,8 @@ CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCa } } -CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47096,7 +47096,7 @@ void CHIPPm25ConcentrationMeasurementMinMeasuredValueAttributeCallback::Callback } CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47114,8 +47114,8 @@ CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCa } } -CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47165,7 +47165,7 @@ void CHIPPm25ConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callback } CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47183,8 +47183,8 @@ CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaC } } -CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47234,7 +47234,7 @@ void CHIPPm25ConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callbac } CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47252,8 +47252,8 @@ CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject ja } } -CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47303,7 +47303,7 @@ void CHIPPm25ConcentrationMeasurementAverageMeasuredValueAttributeCallback::Call } CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47321,8 +47321,8 @@ CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject ja } } -CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47376,7 +47376,7 @@ void CHIPPm25ConcentrationMeasurementGeneratedCommandListAttributeCallback::Call } CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47394,8 +47394,8 @@ CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject jav } } -CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPPm25ConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47593,7 +47593,7 @@ void CHIPPm25ConcentrationMeasurementAttributeListAttributeCallback::CallbackFn( } CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -47611,8 +47611,8 @@ CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback(jobject j } } -CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47662,7 +47662,7 @@ void CHIPFormaldehydeConcentrationMeasurementMeasuredValueAttributeCallback::Cal } CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47681,8 +47681,8 @@ CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback(jobjec } } -CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47732,7 +47732,7 @@ void CHIPFormaldehydeConcentrationMeasurementMinMeasuredValueAttributeCallback:: } CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47751,8 +47751,8 @@ CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobjec } } -CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47802,7 +47802,7 @@ void CHIPFormaldehydeConcentrationMeasurementMaxMeasuredValueAttributeCallback:: } CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47821,8 +47821,8 @@ CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobje } } -CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47873,7 +47873,7 @@ void CHIPFormaldehydeConcentrationMeasurementPeakMeasuredValueAttributeCallback: } CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47892,8 +47892,8 @@ CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback(jo } } -CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -47944,7 +47944,7 @@ void CHIPFormaldehydeConcentrationMeasurementAverageMeasuredValueAttributeCallba } CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -47963,8 +47963,8 @@ CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback(jo } } -CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48019,7 +48019,7 @@ void CHIPFormaldehydeConcentrationMeasurementGeneratedCommandListAttributeCallba } CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) @@ -48038,8 +48038,8 @@ CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback(job } } -CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48094,7 +48094,7 @@ void CHIPFormaldehydeConcentrationMeasurementAcceptedCommandListAttributeCallbac } CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48112,8 +48112,8 @@ CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback(jobject javaC } } -CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48167,7 +48167,7 @@ void CHIPFormaldehydeConcentrationMeasurementEventListAttributeCallback::Callbac } CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback:: -CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48185,8 +48185,8 @@ CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback(jobject j } } -CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback::~ -CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback() +CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback:: + ~CHIPFormaldehydeConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48326,8 +48326,8 @@ CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback::CHIPPm1Concent } } -CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPPm1ConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48395,8 +48395,8 @@ CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback::CHIPPm1Concent } } -CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48446,7 +48446,7 @@ void CHIPPm1ConcentrationMeasurementMaxMeasuredValueAttributeCallback::CallbackF } CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48464,8 +48464,8 @@ CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCa } } -CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48515,7 +48515,7 @@ void CHIPPm1ConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callback } CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48533,8 +48533,8 @@ CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject jav } } -CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48584,7 +48584,7 @@ void CHIPPm1ConcentrationMeasurementAverageMeasuredValueAttributeCallback::Callb } CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48602,8 +48602,8 @@ CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject jav } } -CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48657,7 +48657,7 @@ void CHIPPm1ConcentrationMeasurementGeneratedCommandListAttributeCallback::Callb } CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48675,8 +48675,8 @@ CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject java } } -CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPPm1ConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -48942,7 +48942,7 @@ void CHIPPm10ConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn( } CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -48960,8 +48960,8 @@ CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCa } } -CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49011,7 +49011,7 @@ void CHIPPm10ConcentrationMeasurementMinMeasuredValueAttributeCallback::Callback } CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49029,8 +49029,8 @@ CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCa } } -CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49080,7 +49080,7 @@ void CHIPPm10ConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callback } CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49098,8 +49098,8 @@ CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaC } } -CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49149,7 +49149,7 @@ void CHIPPm10ConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callbac } CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49167,8 +49167,8 @@ CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject ja } } -CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49218,7 +49218,7 @@ void CHIPPm10ConcentrationMeasurementAverageMeasuredValueAttributeCallback::Call } CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49236,8 +49236,8 @@ CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject ja } } -CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49291,7 +49291,7 @@ void CHIPPm10ConcentrationMeasurementGeneratedCommandListAttributeCallback::Call } CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -49309,8 +49309,8 @@ CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject jav } } -CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPPm10ConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49508,7 +49508,7 @@ void CHIPPm10ConcentrationMeasurementAttributeListAttributeCallback::CallbackFn( } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -49527,8 +49527,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeC } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49581,7 +49581,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValueAttri } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -49600,8 +49601,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttribu } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49654,7 +49655,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValueAt } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -49673,8 +49675,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttribu } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49727,7 +49729,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValueAt } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterPeakMeasuredValueAttributeCallbackType>(CallbackFn, this), keepAlive(keepAlive) @@ -49746,8 +49749,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttrib } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49800,8 +49803,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueA } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, - bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterAverageMeasuredValueAttributeCallbackType>(CallbackFn, this), @@ -49821,8 +49824,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAtt } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49876,8 +49879,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredVal } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, - bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterGeneratedCommandListAttributeCallbackType>(CallbackFn, this), @@ -49897,8 +49900,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAtt } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -49956,8 +49959,8 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandLi } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, - bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, + bool keepAlive) : chip::Callback::Callback< CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementClusterAcceptedCommandListAttributeCallbackType>(CallbackFn, this), keepAlive(keepAlive) @@ -49976,8 +49979,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttr } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50035,7 +50038,7 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandLis } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -50054,8 +50057,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallb } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50111,7 +50114,7 @@ void CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementEventListAttribute } CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback:: -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback( CallbackFn, this), keepAlive(keepAlive) @@ -50130,8 +50133,8 @@ CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeC } } -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback::~ -CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback() +CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback:: + ~CHIPTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50256,7 +50259,7 @@ void CHIPRadonConcentrationMeasurementMeasuredValueAttributeCallback::CallbackFn } CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback:: -CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50274,8 +50277,8 @@ CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback(jobject javaC } } -CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback::~ -CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback:: + ~CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50325,7 +50328,7 @@ void CHIPRadonConcentrationMeasurementMinMeasuredValueAttributeCallback::Callbac } CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback:: -CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50343,8 +50346,8 @@ CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback(jobject javaC } } -CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback::~ -CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback:: + ~CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50394,7 +50397,7 @@ void CHIPRadonConcentrationMeasurementMaxMeasuredValueAttributeCallback::Callbac } CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback:: -CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50412,8 +50415,8 @@ CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback(jobject java } } -CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback::~ -CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback:: + ~CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50463,7 +50466,7 @@ void CHIPRadonConcentrationMeasurementPeakMeasuredValueAttributeCallback::Callba } CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback:: -CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50481,8 +50484,8 @@ CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback(jobject j } } -CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback::~ -CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback() +CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback:: + ~CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50532,7 +50535,7 @@ void CHIPRadonConcentrationMeasurementAverageMeasuredValueAttributeCallback::Cal } CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback:: -CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50550,8 +50553,8 @@ CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback(jobject j } } -CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback::~ -CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback() +CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback:: + ~CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) @@ -50605,7 +50608,7 @@ void CHIPRadonConcentrationMeasurementGeneratedCommandListAttributeCallback::Cal } CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback:: -CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -50623,8 +50626,8 @@ CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback(jobject ja } } -CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback::~ -CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback() +CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback:: + ~CHIPRadonConcentrationMeasurementAcceptedCommandListAttributeCallback() { JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); if (env == nullptr) From 320b5e1e38a9705bb04bf891e5fa38622a1135da Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 8 Jan 2024 23:33:42 +0000 Subject: [PATCH 079/143] Added provisional handling for Faults --- .../include/EnergyEvseDelegateImpl.h | 6 + .../src/EnergyEvseDelegateImpl.cpp | 148 +++++++++++++----- 2 files changed, 119 insertions(+), 35 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 6cd6dd37f8df34..6eb2241638d84f 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -153,6 +153,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate Status SendEVNotDetectedEvent(); Status SendEnergyTransferStartedEvent(); Status SendEnergyTransferStoppedEvent(EnergyTransferStoppedReasonEnum reason); + Status SendFaultEvent(FaultStateEnum newFaultState); // ------------------------------------------------------------------ // Get attribute methods @@ -225,6 +226,10 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate int64_t mActualChargingCurrentLimit = 0; StateEnum mHwState = StateEnum::kNotPluggedIn; /* Hardware state */ + /* Variables to hold State and SupplyState in case a fault is raised */ + StateEnum mStateBeforeFault = StateEnum::kUnknownEnumValue; + SupplyStateEnum mSupplyStateBeforeFault = SupplyStateEnum::kUnknownEnumValue; + /* Callback related */ EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */ Status NotifyApplicationCurrentLimitChange(int64_t maximumChargeCurrent); @@ -232,6 +237,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate Status GetEVSEEnergyMeterValue(ChargingDischargingType meterType, int64_t & aMeterValue); /* Local State machine handling */ + Status CheckFaultOrDiagnostic(); Status HandleStateMachineEvent(EVSEStateMachineEvent event); Status HandleEVPluggedInEvent(); Status HandleEVNotDetectedEvent(); diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index d122de7921dac3..602d136fe4dd33 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -145,9 +145,11 @@ Status EnergyEvseDelegate::StartDiagnostics() ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()"); /* update SupplyState to indicate we are now in Diagnostics mode */ + // TODO save the value of SupplyState so it can be restored later SetSupplyState(SupplyStateEnum::kDisabledDiagnostics); - // TODO: Generate events + // TODO Application code would need to put the SupplyState back + // once diagnostics have been completed return Status::Success; } @@ -245,23 +247,6 @@ Status EnergyEvseDelegate::HwSetCableAssemblyLimit(int64_t currentmA) return ComputeMaxChargeCurrentLimit(); } -bool IsEvPluggedIn(StateEnum state) -{ - if ((state == StateEnum::kNotPluggedIn) || (state == StateEnum::kFault) || (state == StateEnum::kSessionEnding)) - { - return false; - } - return true; -} - -bool IsEvTransferringEnergy(StateEnum state) -{ - if ((state == StateEnum::kPluggedInCharging) || (state == StateEnum::kPluggedInDischarging)) - { - return true; - } - return false; -} /** * @brief Called by EVSE Hardware to indicate if EV is detected * @@ -333,29 +318,35 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) * * @param FaultStateEnum - the fault condition detected */ -Status EnergyEvseDelegate::HwSetFault(FaultStateEnum fault) +Status EnergyEvseDelegate::HwSetFault(FaultStateEnum newFaultState) { ChipLogProgress(AppServer, "EnergyEvseDelegate::Fault()"); - if (fault == FaultStateEnum::kNoError) + if (mFaultState == newFaultState) { - /* Update State to previous state */ - // TODO: need to work out the logic here! + ChipLogError(AppServer, "No change in fault state, ignoring call"); + return Status::Failure; + } + + /** Before we do anything we log the fault + * any change in FaultState reports previous fault and new fault + * and the state prior to the fault being raised */ + SendFaultEvent(newFaultState); - /* Update SupplyState to previous state */ + /* Updated FaultState before we call into the handlers */ + SetFaultState(newFaultState); + + if (newFaultState == FaultStateEnum::kNoError) + { + /* Fault has been cleared */ + HandleStateMachineEvent(EVSEStateMachineEvent::FaultCleared); } else { - /* Update State & SupplyState */ - SetState(StateEnum::kFault); - SetSupplyState(SupplyStateEnum::kDisabledError); + /* a new Fault has been raised */ + HandleStateMachineEvent(EVSEStateMachineEvent::FaultRaised); } - /* Update FaultState */ - SetFaultState(fault); - - // TODO: Generate events - return Status::Success; } @@ -551,10 +542,30 @@ Status EnergyEvseDelegate::HandleEVDemandEvent() return Status::Success; } +Status EnergyEvseDelegate::CheckFaultOrDiagnostic() +{ + if (mFaultState != FaultStateEnum::kNoError) + { + ChipLogError(AppServer, "EVSE: Trying to handle command when fault is present"); + return Status::Failure; + } + + if (mSupplyState == SupplyStateEnum::kDisabledDiagnostics) + { + ChipLogError(AppServer, "EVSE: Trying to handle command when in diagnostics mode"); + return Status::Failure; + } + return Status::Success; +} + Status EnergyEvseDelegate::HandleChargingEnabledEvent() { /* Check there is no Fault or Diagnostics condition */ - // TODO -! + Status status = CheckFaultOrDiagnostic(); + if (status != Status::Success) + { + return status; + } /* update SupplyState to say that charging is now enabled */ SetSupplyState(SupplyStateEnum::kChargingEnabled); @@ -587,8 +598,11 @@ Status EnergyEvseDelegate::HandleChargingEnabledEvent() Status EnergyEvseDelegate::HandleDischargingEnabledEvent() { /* Check there is no Fault or Diagnostics condition */ - // TODO -! - + Status status = CheckFaultOrDiagnostic(); + if (status != Status::Success) + { + return status; + } /* update SupplyState to say that charging is now enabled */ SetSupplyState(SupplyStateEnum::kDischargingEnabled); @@ -619,7 +633,11 @@ Status EnergyEvseDelegate::HandleDischargingEnabledEvent() Status EnergyEvseDelegate::HandleDisabledEvent() { /* Check there is no Fault or Diagnostics condition */ - // TODO -! + Status status = CheckFaultOrDiagnostic(); + if (status != Status::Success) + { + return status; + } /* update SupplyState to say that charging is now enabled */ SetSupplyState(SupplyStateEnum::kDisabled); @@ -642,12 +660,53 @@ Status EnergyEvseDelegate::HandleDisabledEvent() return Status::Success; } +/** + * @brief This handles the new fault + * + * Note that if multiple faults happen and this is called repeatedly + * We only save the previous State and SupplyState if its the first raising + * of the fault, so we can restore the state back once all faults have cleared +)*/ Status EnergyEvseDelegate::HandleFaultRaised() { + /* Save the current State and SupplyState so we can restore them if the fault clears */ + if (mStateBeforeFault == StateEnum::kUnknownEnumValue) + { + /* No existing fault - save this value to restore it later if it clears */ + mStateBeforeFault = mState; + } + + if (mSupplyStateBeforeFault == SupplyStateEnum::kUnknownEnumValue) + { + /* No existing fault */ + mSupplyStateBeforeFault = mSupplyState; + } + + /* Update State & SupplyState */ + SetState(StateEnum::kFault); + SetSupplyState(SupplyStateEnum::kDisabledError); + return Status::Success; } Status EnergyEvseDelegate::HandleFaultCleared() { + /* Check that something strange hasn't happened */ + if ((mStateBeforeFault == StateEnum::kUnknownEnumValue) || (mSupplyStateBeforeFault == SupplyStateEnum::kUnknownEnumValue)) + { + ChipLogError(AppServer, "EVSE: Something wrong trying to clear fault"); + return Status::Failure; + } + + /* Restore the State and SupplyState back to old values once all the faults have cleared + * Changing the State should notify the application, so it can continue charging etc + */ + SetState(mStateBeforeFault); + SetSupplyState(mSupplyStateBeforeFault); + + /* put back the sentinel to catch new faults if more are raised */ + mStateBeforeFault = StateEnum::kUnknownEnumValue; + mSupplyStateBeforeFault = SupplyStateEnum::kUnknownEnumValue; + return Status::Success; } @@ -865,6 +924,25 @@ Status EnergyEvseDelegate::SendEnergyTransferStoppedEvent(EnergyTransferStoppedR return Status::Success; } +Status EnergyEvseDelegate::SendFaultEvent(FaultStateEnum newFaultState) +{ + Events::Fault::Type event; + EventNumber eventNumber; + + event.sessionID = mSession.mSessionID; // Note here the event sessionID can be Null! + event.state = mState; // This is the state prior to the fault being raised + event.faultStatePreviousState = mFaultState; + event.faultStateCurrentState = newFaultState; + + CHIP_ERROR err = LogEvent(event, mEndpointId, eventNumber); + if (CHIP_NO_ERROR != err) + { + ChipLogError(AppServer, "Unable to send notify event: %" CHIP_ERROR_FORMAT, err.Format()); + return Status::Failure; + } + return Status::Success; +} + /** * Attribute methods */ From 3a7ace4dc82d6eef93db022b848bec0ef58584b8 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 9 Jan 2024 01:05:22 +0000 Subject: [PATCH 080/143] Added new test event triggers to help test Fault and Diagnostics --- .../include/EnergyEvseDelegateImpl.h | 7 +-- .../src/EVSEManufacturerImpl.cpp | 44 ++++++++++++++++++- .../src/EnergyEvseDelegateImpl.cpp | 40 +++++++++++++++-- .../EnergyEvseTestEventTriggerDelegate.h | 29 ++++++++---- 4 files changed, 104 insertions(+), 16 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 6eb2241638d84f..97da46322fd5d4 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -148,7 +148,7 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate Status HwSetFault(FaultStateEnum fault); Status HwSetRFID(ByteSpan uid); Status HwSetVehicleID(const CharSpan & vehID); - + Status HwDiagnosticsComplete(); Status SendEVConnectedEvent(); Status SendEVNotDetectedEvent(); Status SendEnergyTransferStartedEvent(); @@ -227,8 +227,9 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate StateEnum mHwState = StateEnum::kNotPluggedIn; /* Hardware state */ /* Variables to hold State and SupplyState in case a fault is raised */ - StateEnum mStateBeforeFault = StateEnum::kUnknownEnumValue; - SupplyStateEnum mSupplyStateBeforeFault = SupplyStateEnum::kUnknownEnumValue; + StateEnum mStateBeforeFault = StateEnum::kUnknownEnumValue; + SupplyStateEnum mSupplyStateBeforeFault = SupplyStateEnum::kUnknownEnumValue; + SupplyStateEnum mSupplyStateBeforeDiagnostics = SupplyStateEnum::kUnknownEnumValue; /* Callback related */ EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */ diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 8d4279601bd92a..c71db0047b8f20 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -181,6 +181,33 @@ void SetTestEventTrigger_EVChargeDemandClear() dg->HwSetState(sEVSETestEventSaveData.mOldHwStatePluggedInDemand); } +void SetTestEventTrigger_EVSEGroundFault() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetFault(FaultStateEnum::kGroundFault); +} + +void SetTestEventTrigger_EVSEOverTemperatureFault() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetFault(FaultStateEnum::kOverTemperature); +} + +void SetTestEventTrigger_EVSEFaultClear() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwSetFault(FaultStateEnum::kNoError); +} + +void SetTestEventTrigger_EVSEDiagnosticsComplete() +{ + EnergyEvseDelegate * dg = GetEvseDelegate(); + + dg->HwDiagnosticsComplete(); +} bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) { @@ -212,9 +239,24 @@ bool HandleEnergyEvseTestEventTrigger(uint64_t eventTrigger) ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EV Charge NoDemand"); SetTestEventTrigger_EVChargeDemandClear(); break; + case EnergyEvseTrigger::kEVSEGroundFault: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE has a GroundFault fault"); + SetTestEventTrigger_EVSEGroundFault(); + break; + case EnergyEvseTrigger::kEVSEOverTemperatureFault: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE has a OverTemperature fault"); + SetTestEventTrigger_EVSEOverTemperatureFault(); + break; + case EnergyEvseTrigger::kEVSEFaultClear: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE faults have cleared"); + SetTestEventTrigger_EVSEFaultClear(); + break; + case EnergyEvseTrigger::kEVSEDiagnosticsComplete: + ChipLogProgress(Support, "[EnergyEVSE-Test-Event] => EVSE Diagnostics Completed"); + SetTestEventTrigger_EVSEDiagnosticsComplete(); + break; default: - return false; } diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 602d136fe4dd33..468b6d5536a678 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -138,18 +138,31 @@ Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable /** * @brief Called when EVSE cluster receives StartDiagnostics command + * + * NOTE: Application code needs to call HwDiagnosticsComplete + * once diagnostics have been completed. */ Status EnergyEvseDelegate::StartDiagnostics() { /* For EVSE manufacturers to customize */ ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()"); + if (mSupplyState == SupplyStateEnum::kDisabledDiagnostics) + { + ChipLogError(AppServer, "EVSE: Already in diagnostics mode!"); + return Status::Failure; + } + /* update SupplyState to indicate we are now in Diagnostics mode */ - // TODO save the value of SupplyState so it can be restored later - SetSupplyState(SupplyStateEnum::kDisabledDiagnostics); + if (mSupplyStateBeforeDiagnostics != SupplyStateEnum::kUnknownEnumValue) + { + ChipLogError(AppServer, "EVSE: Something wrong trying to go into diagnostics mode"); + return Status::Failure; + } - // TODO Application code would need to put the SupplyState back - // once diagnostics have been completed + mSupplyStateBeforeDiagnostics = mSupplyState; + // Update the SupplyState - this will automatically callback the Application StateChanged callback + SetSupplyState(SupplyStateEnum::kDisabledDiagnostics); return Status::Success; } @@ -410,6 +423,25 @@ Status EnergyEvseDelegate::HwSetVehicleID(const CharSpan & newValue) return Status::Success; } +/** + * @brief Called by EVSE Hardware to indicate that it has finished its diagnostics test + */ +Status EnergyEvseDelegate::HwDiagnosticsComplete() +{ + if (mSupplyState != SupplyStateEnum::kDisabledDiagnostics) + { + ChipLogError(AppServer, "Incorrect state to be completing diagnostics"); + return Status::Failure; + } + + /* Restore the SupplyState to the saved state before diagnostics were triggered */ + SetSupplyState(mSupplyStateBeforeDiagnostics); + + /* Set the sentinel back for checking another diagnostics command */ + mSupplyStateBeforeDiagnostics = SupplyStateEnum::kUnknownEnumValue; + + return Status::Success; +} /* --------------------------------------------------------------------------- * Functions below are private helper functions internal to the delegate */ diff --git a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h index 7f199b21cdc255..cb9abd29da77f4 100644 --- a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h +++ b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h @@ -32,14 +32,27 @@ namespace chip { enum class EnergyEvseTrigger : uint64_t { // Scenarios - kBasicFunctionality = 0x0099000000000000, // Basic Functionality Test Event | Simulate installation with - // _{A_CIRCUIT_CAPACITY}_=32A and _{A_USER_MAXIMUM_CHARGE_CURRENT}_=32A - kBasicFunctionalityClear = 0x0099000000000001, // Basic Functionality Test Event Clear | End simulation of installation - kEVPluggedIn = 0x0099000000000002, // EV Plugged-in Test Event | Simulate plugging - // the EV into the EVSE using a cable of 63A capacity - kEVPluggedInClear = 0x0099000000000003, // EV Plugged-in Test Event Clear | Simulate unplugging the EV - kEVChargeDemand = 0x0099000000000004, // EV Charge Demand Test Event | Simulate the EV presenting charge demand to the EVSE - kEVChargeDemandClear = 0x0099000000000005, // EV Charge Demand Test Event Clear | Simulate the EV becoming fully charged + // Basic Functionality Test Event | Simulate installation with _{A_CIRCUIT_CAPACITY}_=32A and + // _{A_USER_MAXIMUM_CHARGE_CURRENT}_=32A + kBasicFunctionality = 0x0099000000000000, + // Basic Functionality Test Event Clear | End simulation of installation + kBasicFunctionalityClear = 0x0099000000000001, + // EV Plugged-in Test Event | Simulate plugging the EV into the EVSE using a cable of 63A capacity + kEVPluggedIn = 0x0099000000000002, + // EV Plugged-in Test Event Clear | Simulate unplugging the EV + kEVPluggedInClear = 0x0099000000000003, + // EV Charge Demand Test Event | Simulate the EV presenting charge demand to the EVSE + kEVChargeDemand = 0x0099000000000004, + // EV Charge Demand Test Event Clear | Simulate the EV becoming fully charged + kEVChargeDemandClear = 0x0099000000000005, + // EVSE has a GroundFault fault + kEVSEGroundFault = 0x0099000000000010, + // EVSE has a OverTemperature fault + kEVSEOverTemperatureFault = 0x0099000000000011, + // EVSE faults have cleared + kEVSEFaultClear = 0x0099000000000012, + // EVSE Diagnostics Complete | Simulate diagnostics have been completed and return to normal + kEVSEDiagnosticsComplete = 0x0099000000000020, }; class EnergyEvseTestEventTriggerDelegate : public TestEventTriggerDelegate From 309b8f6932f6fb2db1471f3235be80bf1fd244a2 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 9 Jan 2024 14:42:38 +0000 Subject: [PATCH 081/143] Added TC_EEVSE_2_4 --- src/python_testing/TC_EEVSE_2_4.py | 344 +++++++++++++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 src/python_testing/TC_EEVSE_2_4.py diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py new file mode 100644 index 00000000000000..e07b6602a9f000 --- /dev/null +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -0,0 +1,344 @@ +# +# 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. + + +import logging +import queue +import time +from datetime import datetime, timedelta, timezone + +import chip.clusters as Clusters +from chip.clusters import ClusterObjects as ClusterObjects +from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction +from chip.clusters.Types import NullValue +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class EventChangeCallback: + def __init__(self, expected_cluster: ClusterObjects): + self._q = queue.Queue() + self._expected_cluster = expected_cluster + + async def start(self, dev_ctrl, nodeid): + self._subscription = await dev_ctrl.ReadEvent(nodeid, + events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), + fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + self._subscription.SetEventUpdateCallback(self.__call__) + + def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): + if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: + logging.info( + f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') + self._q.put(res) + + def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): + try: + res = self._q.get(block=True, timeout=10) + except queue.Empty: + asserts.fail("Failed to receive a report for the event {}".format(expected_event)) + + asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") + asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") + return res.Data + + +class TC_EEVSE_2_4(MatterBaseTest): + async def read_evse_attribute_expect_success(self, endpoint, attribute): + full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) + cluster = Clusters.Objects.EnergyEvse + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + + async def check_evse_attribute(self, attribute, expected_value): + value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) + asserts.assert_equal(value, expected_value, + f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + + async def get_supported_energy_evse_attributes(self, endpoint): + return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") + + async def write_user_max_charge(self, endpoint, user_max_charge): + result = await self.default_controller.WriteAttribute(self.dut_node_id, + [(endpoint, + Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) + asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") + + async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, + min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( + chargingEnabledUntil=charge_until, + minimumChargeCurrent=min_charge, + maximumChargeCurrent=max_charge), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_disable_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + def desc_TC_EEVSE_2_4(self) -> str: + """Returns a description of this test""" + return "5.1.XXX. [TC-EEVSE-2.4] Fault test functionality with DUT as Server" + + def pics_TC_EEVSE_2_4(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + # In this case - there is no feature flags needed to run this test case + return None + + def steps_TC_EEVSE_2_4(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), + TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event. Verify Event EEVSE.S.E00(EVConnected) sent"), + TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("4b", "TH reads from the DUT the SessionID attribute. Value is saved for later"), + TestStep("5", "TH sends command EnableCharging with ChargingEnabledUntil=Null, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event. Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x3 (PluggedInCharging)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x1 (ChargingEnabled)"), + TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Ground Fault Test Event. Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x00 (NoError), FaultStateCurrentFaultState = 0x07 (GroundFault)"), + TestStep("7a", "TH reads from the DUT the State attribute. Verify value is 0x6 (Fault)"), + TestStep("7b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x4 (DisabledError)"), + TestStep("8", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Over Temperature Fault Test Event. Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x07 (GroundFault), FaultStateCurrentFaultState = 0x0F (OverTemperature)"), + TestStep("8a", "TH reads from the DUT the State attribute. Verify value is 0x6 (Fault)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x4 (DisabledError)"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Fault Test Event Clear. Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x0F (OverTemperature), FaultStateCurrentFaultState = 0x00 (NoError)"), + TestStep("9a", "TH reads from the DUT the State attribute. Verify value is 0x3 (PluggedInCharging)"), + TestStep("9b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x1 (ChargingEnabled)"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear."), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear. Verify Event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), + ] + + return steps + + async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): + try: + await self.send_single_cmd(endpoint=0, + cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( + enableKey, + eventTrigger) + ) + + except InteractionModelError as e: + asserts.fail(f"Unexpected error returned - {e.status}") + + # TC_EEVSE_2_4 tests steps + async def check_test_event_triggers_enabled(self): + full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled + cluster = Clusters.Objects.GeneralDiagnostics + test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) + asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") + + async def send_test_event_trigger_basic(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000000) + + async def send_test_event_trigger_basic_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000001) + + async def send_test_event_trigger_pluggedin(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000002) + + async def send_test_event_trigger_pluggedin_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000003) + + async def send_test_event_trigger_charge_demand(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000004) + + async def send_test_event_trigger_charge_demand_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000005) + + async def send_test_event_trigger_evse_ground_fault(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000010) + + async def send_test_event_trigger_evse_over_temperature_fault(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000011) + + async def send_test_event_trigger_evse_fault_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000012) + + async def send_test_event_trigger_evse_diagnostics_complete(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000020) + + def validate_energy_transfer_started_event(self, event_data, session_id, expected_state, expected_max_charge): + asserts.assert_equal(session_id, event_data.sessionID, + f"EnergyTransferStarted event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EnergyTransferStarted event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(expected_max_charge, event_data.maximumCurrent, + f"EnergyTransferStarted event maximumCurrent was {event_data.maximumCurrent}, expected {expected_max_charge}") + + def validate_energy_transfer_stopped_event(self, event_data, session_id, expected_state, expected_reason): + asserts.assert_equal(session_id, event_data.sessionID, + f"EnergyTransferStopped event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EnergyTransferStopped event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(expected_reason, event_data.reason, + f"EnergyTransferStopped event reason was {event_data.reason}, expected {expected_reason}") + + def validate_ev_connected_event(self, event_data, session_id): + asserts.assert_equal(session_id, event_data.sessionID, + f"EvConnected event session ID was {event_data.sessionID}, expected {session_id}") + + def validate_ev_not_detected_event(self, event_data, session_id, expected_state, expected_duration, expected_charged): + asserts.assert_equal(session_id, event_data.sessionID, + f"EvNotDetected event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EvNotDetected event event State was {event_data.state} expected {expected_state}") + asserts.assert_greater_equal(event_data.sessionDuration, expected_duration, + f"EvNotDetected event sessionDuration was {event_data.sessionDuration}, expected >= {expected_duration}") + asserts.assert_greater_equal(event_data.sessionEnergyCharged, expected_charged, + f"EvNotDetected event sessionEnergyCharged was {event_data.sessionEnergyCharged}, expected >= {expected_charged}") + + def validate_evse_fault_event(self, event_data, session_id, expected_state, previous_fault, current_fault): + asserts.assert_equal(session_id, event_data.sessionID, + f"Fault event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"Fault event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(event_data.faultStatePreviousState, previous_fault, + f"Fault event faultStatePreviousState was {event_data.faultStatePreviousState}, expected {previous_fault}") + asserts.assert_equal(event_data.faultStateCurrentState, current_fault, + f"Fault event faultStateCurrentState was {event_data.faultStateCurrentState}, expected {current_fault}") + + @async_test_body + async def test_TC_EEVSE_2_4(self): + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.EnergyEvse) + await events_callback.start(self.default_controller, self.dut_node_id) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic() + + # After a few seconds... + time.sleep(3) + + self.step("3a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + + self.step("3b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + + self.step("3c") + await self.check_evse_attribute("FaultState", Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError) + + self.step("4") + await self.send_test_event_trigger_pluggedin() + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EVConnected) + + self.step("4a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) + + self.step("4b") + # Save Session ID for later and check it against the value in the event + session_id = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionID") + self.validate_ev_connected_event(event_data, session_id) + + self.step("5") + charge_until = NullValue + min_charge_current = 6000 + max_charge_current = 60000 + await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + + self.step("6") + await self.send_test_event_trigger_charge_demand() + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) + + self.step("6a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) + + self.step("6b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("7") + await self.send_test_event_trigger_evse_ground_fault() + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.Fault) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging + previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError + current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault + self.validate_evse_fault_event(event_data, session_id, expected_state, previous_fault, current_fault) + + self.step("7a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) + + self.step("7b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledError) + + self.step("8") + await self.send_test_event_trigger_evse_over_temperature_fault() + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.Fault) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault + previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault + current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature + self.validate_evse_fault_event(event_data, session_id, expected_state, previous_fault, current_fault) + + self.step("8a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) + + self.step("8b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledError) + + self.step("9") + await self.send_test_event_trigger_evse_fault_clear() + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.Fault) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault + previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature + current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError + self.validate_evse_fault_event(event_data, session_id, expected_state, previous_fault, current_fault) + + self.step("9a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) + + self.step("9b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("10") + await self.send_test_event_trigger_charge_demand_clear() + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) + + self.step("11") + await self.send_test_event_trigger_pluggedin_clear() + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EVNotDetected) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand + self.validate_ev_not_detected_event(event_data, session_id, expected_state, expected_duration=0, expected_charged=0) + + self.step("12") + await self.send_test_event_trigger_basic_clear() + + +if __name__ == "__main__": + default_matter_test_main() From 9b02ef8c14a49702cf030ca4d6342e6492f98b7b Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 9 Jan 2024 17:00:08 +0000 Subject: [PATCH 082/143] Fix lint issue - unused datetime modules. --- src/python_testing/TC_EEVSE_2_4.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py index e07b6602a9f000..a686f4a657f572 100644 --- a/src/python_testing/TC_EEVSE_2_4.py +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -18,7 +18,6 @@ import logging import queue import time -from datetime import datetime, timedelta, timezone import chip.clusters as Clusters from chip.clusters import ClusterObjects as ClusterObjects From 228ffeda92ad0477b38d70b35873aba9b0095e43 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 10 Jan 2024 11:58:36 +0000 Subject: [PATCH 083/143] Committed suggested change to comment --- .../device-energy-management-server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index 255976b61da748..eb63aa31da330f 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -336,7 +336,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, /* earliestStartTime is optional based on the StartTimeAdjust (STA) feature AND is nullable */ if (!(forecast.earliestStartTime.HasValue()) || !(forecast.latestEndTime.HasValue())) { - /* These should not be NULL since this command requires STA feature and these are mandatory for that */ + /* These should have values, since this command requires STA feature and these are mandatory for that */ ChipLogError(Zcl, "DEM: EarliestStartTime / LatestEndTime do not have values"); ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure); return; From 925a701a12e76b6587027973737294a42fae084b Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 10 Jan 2024 22:58:03 +0000 Subject: [PATCH 084/143] Added TC_EEVSE_2_5.py to support DiagnosticsCommand testing. Also changed the SupplyState reverting to Disabled once diagnostics is complete to match the spec. --- .../include/EnergyEvseDelegateImpl.h | 5 +- .../src/EnergyEvseDelegateImpl.cpp | 16 +- src/python_testing/TC_EEVSE_2_5.py | 216 ++++++++++++++++++ 3 files changed, 221 insertions(+), 16 deletions(-) create mode 100644 src/python_testing/TC_EEVSE_2_5.py diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 97da46322fd5d4..dc46e58d5021a7 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -227,9 +227,8 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate StateEnum mHwState = StateEnum::kNotPluggedIn; /* Hardware state */ /* Variables to hold State and SupplyState in case a fault is raised */ - StateEnum mStateBeforeFault = StateEnum::kUnknownEnumValue; - SupplyStateEnum mSupplyStateBeforeFault = SupplyStateEnum::kUnknownEnumValue; - SupplyStateEnum mSupplyStateBeforeDiagnostics = SupplyStateEnum::kUnknownEnumValue; + StateEnum mStateBeforeFault = StateEnum::kUnknownEnumValue; + SupplyStateEnum mSupplyStateBeforeFault = SupplyStateEnum::kUnknownEnumValue; /* Callback related */ EVSECallbackWrapper mCallbacks = { .handler = nullptr, .arg = 0 }; /* Wrapper to allow callbacks to be registered */ diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 468b6d5536a678..095d8914660cd4 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -153,14 +153,6 @@ Status EnergyEvseDelegate::StartDiagnostics() return Status::Failure; } - /* update SupplyState to indicate we are now in Diagnostics mode */ - if (mSupplyStateBeforeDiagnostics != SupplyStateEnum::kUnknownEnumValue) - { - ChipLogError(AppServer, "EVSE: Something wrong trying to go into diagnostics mode"); - return Status::Failure; - } - - mSupplyStateBeforeDiagnostics = mSupplyState; // Update the SupplyState - this will automatically callback the Application StateChanged callback SetSupplyState(SupplyStateEnum::kDisabledDiagnostics); @@ -434,11 +426,9 @@ Status EnergyEvseDelegate::HwDiagnosticsComplete() return Status::Failure; } - /* Restore the SupplyState to the saved state before diagnostics were triggered */ - SetSupplyState(mSupplyStateBeforeDiagnostics); - - /* Set the sentinel back for checking another diagnostics command */ - mSupplyStateBeforeDiagnostics = SupplyStateEnum::kUnknownEnumValue; + /* Restore the SupplyState to Disabled (per spec) - client will need to + * re-enable charging or discharging to get out of this state */ + SetSupplyState(SupplyStateEnum::kDisabled); return Status::Success; } diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py new file mode 100644 index 00000000000000..78737af4b6637a --- /dev/null +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -0,0 +1,216 @@ +# +# 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. + + +import logging +import queue +import time + +import chip.clusters as Clusters +from chip.clusters import ClusterObjects as ClusterObjects +from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction +from chip.clusters.Types import NullValue +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class EventChangeCallback: + def __init__(self, expected_cluster: ClusterObjects): + self._q = queue.Queue() + self._expected_cluster = expected_cluster + + async def start(self, dev_ctrl, nodeid): + self._subscription = await dev_ctrl.ReadEvent(nodeid, + events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), + fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + self._subscription.SetEventUpdateCallback(self.__call__) + + def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): + if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: + logging.info( + f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') + self._q.put(res) + + def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): + try: + res = self._q.get(block=True, timeout=10) + except queue.Empty: + asserts.fail("Failed to receive a report for the event {}".format(expected_event)) + + asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") + asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") + return res.Data + + +class TC_EEVSE_2_5(MatterBaseTest): + async def read_evse_attribute_expect_success(self, endpoint, attribute): + full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) + cluster = Clusters.Objects.EnergyEvse + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + + async def check_evse_attribute(self, attribute, expected_value): + value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) + asserts.assert_equal(value, expected_value, + f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + + async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, + min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( + chargingEnabledUntil=charge_until, + minimumChargeCurrent=min_charge, + maximumChargeCurrent=max_charge), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_start_diagnostics_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.StartDiagnostics(), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + def desc_TC_EEVSE_2_5(self) -> str: + """Returns a description of this test""" + return "5.1.XXX. [TC-EEVSE-2.4] Fault test functionality with DUT as Server" + + def pics_TC_EEVSE_2_5(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + # In this case - there is no feature flags needed to run this test case + return None + + def steps_TC_EEVSE_2_5(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), + TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), + TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), + TestStep("4", "TH sends command EnableCharging with ChargingEnabledUntil=Null, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), + TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("4b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (ChargingEnabled)"), + TestStep("5", "TH sends command StartDiagnostics"), + TestStep("5a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("5b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (DisabledDiagnostics)"), + TestStep("6", "A few seconds later TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Diagnostics Complete Event"), + TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (Disabled)"), + TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), + ] + + return steps + + async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): + try: + await self.send_single_cmd(endpoint=0, + cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( + enableKey, + eventTrigger) + ) + + except InteractionModelError as e: + asserts.fail(f"Unexpected error returned - {e.status}") + + # TC_EEVSE_2_5 tests steps + async def check_test_event_triggers_enabled(self): + full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled + cluster = Clusters.Objects.GeneralDiagnostics + test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) + asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") + + async def send_test_event_trigger_basic(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000000) + + async def send_test_event_trigger_basic_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000001) + + async def send_test_event_trigger_evse_diagnostics_complete(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000020) + + @async_test_body + async def test_TC_EEVSE_2_5(self): + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.EnergyEvse) + await events_callback.start(self.default_controller, self.dut_node_id) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic() + + # After a few seconds... + time.sleep(1) + + self.step("3a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + + self.step("3b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + + self.step("3c") + await self.check_evse_attribute("FaultState", Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError) + + self.step("4") + charge_until = NullValue + min_charge_current = 6000 + max_charge_current = 60000 + await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + + self.step("4a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + + self.step("4b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("5") + await self.send_start_diagnostics_command(endpoint=1) + + self.step("5a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + + self.step("5b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledDiagnostics) + + self.step("6") + await self.send_test_event_trigger_evse_diagnostics_complete() + + self.step("6a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + + self.step("6b") + # It should go to disabled after a diagnostics session + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + + self.step("7") + await self.send_test_event_trigger_basic_clear() + + +if __name__ == "__main__": + default_matter_test_main() From bd83ba4f2dd8fbf49e508e7af59d4750a6c495c4 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 11 Jan 2024 01:39:24 +0000 Subject: [PATCH 085/143] Created a helper EEVSE base class to avoid repetition in the different test cases. --- src/python_testing/TC_EEVSE_2_2.py | 135 +------------------ src/python_testing/TC_EEVSE_2_4.py | 160 +--------------------- src/python_testing/TC_EEVSE_2_5.py | 91 +------------ src/python_testing/TC_EEVSE_Utils.py | 191 +++++++++++++++++++++++++++ 4 files changed, 202 insertions(+), 375 deletions(-) create mode 100644 src/python_testing/TC_EEVSE_Utils.py diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index faac9004e6909b..f92e577a9315ae 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -28,50 +28,12 @@ from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts -logger = logging.getLogger(__name__) - - -class EventChangeCallback: - def __init__(self, expected_cluster: ClusterObjects): - self._q = queue.Queue() - self._expected_cluster = expected_cluster - - async def start(self, dev_ctrl, nodeid): - self._subscription = await dev_ctrl.ReadEvent(nodeid, - events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), - fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) - self._subscription.SetEventUpdateCallback(self.__call__) - - def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): - if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: - logging.info( - f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') - self._q.put(res) - - def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): - try: - res = self._q.get(block=True, timeout=10) - except queue.Empty: - asserts.fail("Failed to receive a report for the event {}".format(expected_event)) - - asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") - asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") - return res.Data - +from TC_EEVSE_Utils import EventChangeCallback, EEVSEBaseTestHelper -class TC_EEVSE_2_2(MatterBaseTest): - async def read_evse_attribute_expect_success(self, endpoint, attribute): - full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) - cluster = Clusters.Objects.EnergyEvse - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) +logger = logging.getLogger(__name__) - async def check_evse_attribute(self, attribute, expected_value): - value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) - asserts.assert_equal(value, expected_value, - f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") - async def get_supported_energy_evse_attributes(self, endpoint): - return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") +class TC_EEVSE_2_2(MatterBaseTest, EEVSEBaseTestHelper): async def write_user_max_charge(self, endpoint, user_max_charge): result = await self.default_controller.WriteAttribute(self.dut_node_id, @@ -79,28 +41,6 @@ async def write_user_max_charge(self, endpoint, user_max_charge): Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") - async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, - min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): - try: - await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( - chargingEnabledUntil=charge_until, - minimumChargeCurrent=min_charge, - maximumChargeCurrent=max_charge), - endpoint=1, - timedRequestTimeoutMs=timedRequestTimeoutMs) - - except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - - async def send_disable_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): - try: - await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), - endpoint=1, - timedRequestTimeoutMs=timedRequestTimeoutMs) - - except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - def desc_TC_EEVSE_2_2(self) -> str: """Returns a description of this test""" return "5.1.3. [TC-EEVSE-2.2] Primary functionality with DUT as Server" @@ -162,74 +102,9 @@ def steps_TC_EEVSE_2_2(self) -> list[TestStep]: return steps - async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): - try: - await self.send_single_cmd(endpoint=0, - cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( - enableKey, - eventTrigger) - ) - - except InteractionModelError as e: - asserts.fail(f"Unexpected error returned - {e.status}") - - # TC_EEVSE_2_2 tests steps - async def check_test_event_triggers_enabled(self): - full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled - cluster = Clusters.Objects.GeneralDiagnostics - test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) - asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") - - async def send_test_event_trigger_basic(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000000) - - async def send_test_event_trigger_basic_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000001) - - async def send_test_event_trigger_pluggedin(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000002) - - async def send_test_event_trigger_pluggedin_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000003) - - async def send_test_event_trigger_charge_demand(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000004) - - async def send_test_event_trigger_charge_demand_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000005) - - def validate_energy_transfer_started_event(self, event_data, session_id, expected_state, expected_max_charge): - asserts.assert_equal(session_id, event_data.sessionID, - f"EnergyTransferStarted event session ID was {event_data.sessionID}, expected {session_id}") - asserts.assert_equal(expected_state, event_data.state, - f"EnergyTransferStarted event State was {event_data.state} expected {expected_state}") - asserts.assert_equal(expected_max_charge, event_data.maximumCurrent, - f"EnergyTransferStarted event maximumCurrent was {event_data.maximumCurrent}, expected {expected_max_charge}") - - def validate_energy_transfer_stopped_event(self, event_data, session_id, expected_state, expected_reason): - asserts.assert_equal(session_id, event_data.sessionID, - f"EnergyTransferStopped event session ID was {event_data.sessionID}, expected {session_id}") - asserts.assert_equal(expected_state, event_data.state, - f"EnergyTransferStopped event State was {event_data.state} expected {expected_state}") - asserts.assert_equal(expected_reason, event_data.reason, - f"EnergyTransferStopped event reason was {event_data.reason}, expected {expected_reason}") - - def validate_ev_connected_event(self, event_data, session_id): - asserts.assert_equal(session_id, event_data.sessionID, - f"EvConnected event session ID was {event_data.sessionID}, expected {session_id}") - - def validate_ev_not_detected_event(self, event_data, session_id, expected_state, expected_duration, expected_charged): - asserts.assert_equal(session_id, event_data.sessionID, - f"EvNotDetected event session ID was {event_data.sessionID}, expected {session_id}") - asserts.assert_equal(expected_state, event_data.state, - f"EvNotDetected event event State was {event_data.state} expected {expected_state}") - asserts.assert_greater_equal(event_data.sessionDuration, expected_duration, - f"EvNotDetected event sessionDuration was {event_data.sessionDuration}, expected >= {expected_duration}") - asserts.assert_greater_equal(event_data.sessionEnergyCharged, expected_charged, - f"EvNotDetected event sessionEnergyCharged was {event_data.sessionEnergyCharged}, expected >= {expected_charged}") - @async_test_body async def test_TC_EEVSE_2_2(self): + self.step("1") # Commission DUT - already done @@ -244,7 +119,7 @@ async def test_TC_EEVSE_2_2(self): await self.send_test_event_trigger_basic() # After a few seconds... - time.sleep(3) + time.sleep(1) self.step("3a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py index a686f4a657f572..3e7e947c60d9fb 100644 --- a/src/python_testing/TC_EEVSE_2_4.py +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -27,78 +27,12 @@ from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts +from TC_EEVSE_Utils import EventChangeCallback, EEVSEBaseTestHelper + logger = logging.getLogger(__name__) -class EventChangeCallback: - def __init__(self, expected_cluster: ClusterObjects): - self._q = queue.Queue() - self._expected_cluster = expected_cluster - - async def start(self, dev_ctrl, nodeid): - self._subscription = await dev_ctrl.ReadEvent(nodeid, - events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), - fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) - self._subscription.SetEventUpdateCallback(self.__call__) - - def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): - if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: - logging.info( - f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') - self._q.put(res) - - def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): - try: - res = self._q.get(block=True, timeout=10) - except queue.Empty: - asserts.fail("Failed to receive a report for the event {}".format(expected_event)) - - asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") - asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") - return res.Data - - -class TC_EEVSE_2_4(MatterBaseTest): - async def read_evse_attribute_expect_success(self, endpoint, attribute): - full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) - cluster = Clusters.Objects.EnergyEvse - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) - - async def check_evse_attribute(self, attribute, expected_value): - value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) - asserts.assert_equal(value, expected_value, - f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") - - async def get_supported_energy_evse_attributes(self, endpoint): - return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") - - async def write_user_max_charge(self, endpoint, user_max_charge): - result = await self.default_controller.WriteAttribute(self.dut_node_id, - [(endpoint, - Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) - asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") - - async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, - min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): - try: - await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( - chargingEnabledUntil=charge_until, - minimumChargeCurrent=min_charge, - maximumChargeCurrent=max_charge), - endpoint=1, - timedRequestTimeoutMs=timedRequestTimeoutMs) - - except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - - async def send_disable_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): - try: - await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), - endpoint=1, - timedRequestTimeoutMs=timedRequestTimeoutMs) - - except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") +class TC_EEVSE_2_4(MatterBaseTest, EEVSEBaseTestHelper): def desc_TC_EEVSE_2_4(self) -> str: """Returns a description of this test""" @@ -140,94 +74,6 @@ def steps_TC_EEVSE_2_4(self) -> list[TestStep]: return steps - async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): - try: - await self.send_single_cmd(endpoint=0, - cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( - enableKey, - eventTrigger) - ) - - except InteractionModelError as e: - asserts.fail(f"Unexpected error returned - {e.status}") - - # TC_EEVSE_2_4 tests steps - async def check_test_event_triggers_enabled(self): - full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled - cluster = Clusters.Objects.GeneralDiagnostics - test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) - asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") - - async def send_test_event_trigger_basic(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000000) - - async def send_test_event_trigger_basic_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000001) - - async def send_test_event_trigger_pluggedin(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000002) - - async def send_test_event_trigger_pluggedin_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000003) - - async def send_test_event_trigger_charge_demand(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000004) - - async def send_test_event_trigger_charge_demand_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000005) - - async def send_test_event_trigger_evse_ground_fault(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000010) - - async def send_test_event_trigger_evse_over_temperature_fault(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000011) - - async def send_test_event_trigger_evse_fault_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000012) - - async def send_test_event_trigger_evse_diagnostics_complete(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000020) - - def validate_energy_transfer_started_event(self, event_data, session_id, expected_state, expected_max_charge): - asserts.assert_equal(session_id, event_data.sessionID, - f"EnergyTransferStarted event session ID was {event_data.sessionID}, expected {session_id}") - asserts.assert_equal(expected_state, event_data.state, - f"EnergyTransferStarted event State was {event_data.state} expected {expected_state}") - asserts.assert_equal(expected_max_charge, event_data.maximumCurrent, - f"EnergyTransferStarted event maximumCurrent was {event_data.maximumCurrent}, expected {expected_max_charge}") - - def validate_energy_transfer_stopped_event(self, event_data, session_id, expected_state, expected_reason): - asserts.assert_equal(session_id, event_data.sessionID, - f"EnergyTransferStopped event session ID was {event_data.sessionID}, expected {session_id}") - asserts.assert_equal(expected_state, event_data.state, - f"EnergyTransferStopped event State was {event_data.state} expected {expected_state}") - asserts.assert_equal(expected_reason, event_data.reason, - f"EnergyTransferStopped event reason was {event_data.reason}, expected {expected_reason}") - - def validate_ev_connected_event(self, event_data, session_id): - asserts.assert_equal(session_id, event_data.sessionID, - f"EvConnected event session ID was {event_data.sessionID}, expected {session_id}") - - def validate_ev_not_detected_event(self, event_data, session_id, expected_state, expected_duration, expected_charged): - asserts.assert_equal(session_id, event_data.sessionID, - f"EvNotDetected event session ID was {event_data.sessionID}, expected {session_id}") - asserts.assert_equal(expected_state, event_data.state, - f"EvNotDetected event event State was {event_data.state} expected {expected_state}") - asserts.assert_greater_equal(event_data.sessionDuration, expected_duration, - f"EvNotDetected event sessionDuration was {event_data.sessionDuration}, expected >= {expected_duration}") - asserts.assert_greater_equal(event_data.sessionEnergyCharged, expected_charged, - f"EvNotDetected event sessionEnergyCharged was {event_data.sessionEnergyCharged}, expected >= {expected_charged}") - - def validate_evse_fault_event(self, event_data, session_id, expected_state, previous_fault, current_fault): - asserts.assert_equal(session_id, event_data.sessionID, - f"Fault event session ID was {event_data.sessionID}, expected {session_id}") - asserts.assert_equal(expected_state, event_data.state, - f"Fault event State was {event_data.state} expected {expected_state}") - asserts.assert_equal(event_data.faultStatePreviousState, previous_fault, - f"Fault event faultStatePreviousState was {event_data.faultStatePreviousState}, expected {previous_fault}") - asserts.assert_equal(event_data.faultStateCurrentState, current_fault, - f"Fault event faultStateCurrentState was {event_data.faultStateCurrentState}, expected {current_fault}") - @async_test_body async def test_TC_EEVSE_2_4(self): self.step("1") diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index 78737af4b6637a..112c6552627053 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -27,70 +27,12 @@ from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts +from TC_EEVSE_Utils import EventChangeCallback, EEVSEBaseTestHelper + logger = logging.getLogger(__name__) -class EventChangeCallback: - def __init__(self, expected_cluster: ClusterObjects): - self._q = queue.Queue() - self._expected_cluster = expected_cluster - - async def start(self, dev_ctrl, nodeid): - self._subscription = await dev_ctrl.ReadEvent(nodeid, - events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), - fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) - self._subscription.SetEventUpdateCallback(self.__call__) - - def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): - if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: - logging.info( - f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') - self._q.put(res) - - def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): - try: - res = self._q.get(block=True, timeout=10) - except queue.Empty: - asserts.fail("Failed to receive a report for the event {}".format(expected_event)) - - asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") - asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") - return res.Data - - -class TC_EEVSE_2_5(MatterBaseTest): - async def read_evse_attribute_expect_success(self, endpoint, attribute): - full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) - cluster = Clusters.Objects.EnergyEvse - return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) - - async def check_evse_attribute(self, attribute, expected_value): - value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) - asserts.assert_equal(value, expected_value, - f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") - - async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, - min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): - try: - await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( - chargingEnabledUntil=charge_until, - minimumChargeCurrent=min_charge, - maximumChargeCurrent=max_charge), - endpoint=1, - timedRequestTimeoutMs=timedRequestTimeoutMs) - - except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - - async def send_start_diagnostics_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, - expected_status: Status = Status.Success): - try: - await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.StartDiagnostics(), - endpoint=1, - timedRequestTimeoutMs=timedRequestTimeoutMs) - - except InteractionModelError as e: - asserts.assert_equal(e.status, expected_status, "Unexpected error returned") +class TC_EEVSE_2_5(MatterBaseTest, EEVSEBaseTestHelper): def desc_TC_EEVSE_2_5(self) -> str: """Returns a description of this test""" @@ -123,33 +65,6 @@ def steps_TC_EEVSE_2_5(self) -> list[TestStep]: return steps - async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): - try: - await self.send_single_cmd(endpoint=0, - cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( - enableKey, - eventTrigger) - ) - - except InteractionModelError as e: - asserts.fail(f"Unexpected error returned - {e.status}") - - # TC_EEVSE_2_5 tests steps - async def check_test_event_triggers_enabled(self): - full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled - cluster = Clusters.Objects.GeneralDiagnostics - test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) - asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") - - async def send_test_event_trigger_basic(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000000) - - async def send_test_event_trigger_basic_clear(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000001) - - async def send_test_event_trigger_evse_diagnostics_complete(self): - await self.send_test_event_triggers(eventTrigger=0x0099000000000020) - @async_test_body async def test_TC_EEVSE_2_5(self): self.step("1") diff --git a/src/python_testing/TC_EEVSE_Utils.py b/src/python_testing/TC_EEVSE_Utils.py new file mode 100644 index 00000000000000..dfd788b6e3b111 --- /dev/null +++ b/src/python_testing/TC_EEVSE_Utils.py @@ -0,0 +1,191 @@ +# +# 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. + + +import logging +import queue + +import chip.clusters as Clusters +from chip.clusters import ClusterObjects as ClusterObjects +from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction +from chip.interaction_model import InteractionModelError, Status +from matter_testing_support import MatterBaseTest +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class EventChangeCallback: + def __init__(self, expected_cluster: ClusterObjects): + self._q = queue.Queue() + self._expected_cluster = expected_cluster + + async def start(self, dev_ctrl, nodeid): + self._subscription = await dev_ctrl.ReadEvent(nodeid, + events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), + fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) + self._subscription.SetEventUpdateCallback(self.__call__) + + def __call__(self, res: EventReadResult, transaction: SubscriptionTransaction): + if res.Status == Status.Success and res.Header.ClusterId == self._expected_cluster.id: + logging.info( + f'Got subscription report for event on cluster {self._expected_cluster}: {res.Data}') + self._q.put(res) + + def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): + try: + res = self._q.get(block=True, timeout=10) + except queue.Empty: + asserts.fail("Failed to receive a report for the event {}".format(expected_event)) + + asserts.assert_equal(res.Header.ClusterId, expected_event.cluster_id, "Expected cluster ID not found in event report") + asserts.assert_equal(res.Header.EventId, expected_event.event_id, "Expected event ID not found in event report") + return res.Data + + +class EEVSEBaseTestHelper: + + async def read_evse_attribute_expect_success(self, endpoint, attribute): + full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) + cluster = Clusters.Objects.EnergyEvse + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + + async def check_evse_attribute(self, attribute, expected_value): + value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) + asserts.assert_equal(value, expected_value, + f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + + async def get_supported_energy_evse_attributes(self, endpoint): + return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") + + async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, + min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( + chargingEnabledUntil=charge_until, + minimumChargeCurrent=min_charge, + maximumChargeCurrent=max_charge), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_disable_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_start_diagnostics_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.StartDiagnostics(), + endpoint=1, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): + try: + await self.send_single_cmd(endpoint=0, + cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( + enableKey, + eventTrigger) + ) + + except InteractionModelError as e: + asserts.fail(f"Unexpected error returned - {e.status}") + + async def check_test_event_triggers_enabled(self): + full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled + cluster = Clusters.Objects.GeneralDiagnostics + test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) + asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") + + async def send_test_event_trigger_basic(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000000) + + async def send_test_event_trigger_basic_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000001) + + async def send_test_event_trigger_pluggedin(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000002) + + async def send_test_event_trigger_pluggedin_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000003) + + async def send_test_event_trigger_charge_demand(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000004) + + async def send_test_event_trigger_charge_demand_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000005) + + async def send_test_event_trigger_evse_ground_fault(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000010) + + async def send_test_event_trigger_evse_over_temperature_fault(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000011) + + async def send_test_event_trigger_evse_fault_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000012) + + async def send_test_event_trigger_evse_diagnostics_complete(self): + await self.send_test_event_triggers(eventTrigger=0x0099000000000020) + + def validate_energy_transfer_started_event(self, event_data, session_id, expected_state, expected_max_charge): + asserts.assert_equal(session_id, event_data.sessionID, + f"EnergyTransferStarted event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EnergyTransferStarted event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(expected_max_charge, event_data.maximumCurrent, + f"EnergyTransferStarted event maximumCurrent was {event_data.maximumCurrent}, expected {expected_max_charge}") + + def validate_energy_transfer_stopped_event(self, event_data, session_id, expected_state, expected_reason): + asserts.assert_equal(session_id, event_data.sessionID, + f"EnergyTransferStopped event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EnergyTransferStopped event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(expected_reason, event_data.reason, + f"EnergyTransferStopped event reason was {event_data.reason}, expected {expected_reason}") + + def validate_ev_connected_event(self, event_data, session_id): + asserts.assert_equal(session_id, event_data.sessionID, + f"EvConnected event session ID was {event_data.sessionID}, expected {session_id}") + + def validate_ev_not_detected_event(self, event_data, session_id, expected_state, expected_duration, expected_charged): + asserts.assert_equal(session_id, event_data.sessionID, + f"EvNotDetected event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"EvNotDetected event event State was {event_data.state} expected {expected_state}") + asserts.assert_greater_equal(event_data.sessionDuration, expected_duration, + f"EvNotDetected event sessionDuration was {event_data.sessionDuration}, expected >= {expected_duration}") + asserts.assert_greater_equal(event_data.sessionEnergyCharged, expected_charged, + f"EvNotDetected event sessionEnergyCharged was {event_data.sessionEnergyCharged}, expected >= {expected_charged}") + + def validate_evse_fault_event(self, event_data, session_id, expected_state, previous_fault, current_fault): + asserts.assert_equal(session_id, event_data.sessionID, + f"Fault event session ID was {event_data.sessionID}, expected {session_id}") + asserts.assert_equal(expected_state, event_data.state, + f"Fault event State was {event_data.state} expected {expected_state}") + asserts.assert_equal(event_data.faultStatePreviousState, previous_fault, + f"Fault event faultStatePreviousState was {event_data.faultStatePreviousState}, expected {previous_fault}") + asserts.assert_equal(event_data.faultStateCurrentState, current_fault, + f"Fault event faultStateCurrentState was {event_data.faultStateCurrentState}, expected {current_fault}") From 514e18e0fc09405c0c3aee0964ed13b318e3695a Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 11 Jan 2024 01:40:19 +0000 Subject: [PATCH 086/143] Restyled by isort --- src/python_testing/TC_EEVSE_2_2.py | 3 +-- src/python_testing/TC_EEVSE_2_4.py | 3 +-- src/python_testing/TC_EEVSE_2_5.py | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index f92e577a9315ae..a27d8cf52ebbf9 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -27,8 +27,7 @@ from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts - -from TC_EEVSE_Utils import EventChangeCallback, EEVSEBaseTestHelper +from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback logger = logging.getLogger(__name__) diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py index 3e7e947c60d9fb..92e4d12409a541 100644 --- a/src/python_testing/TC_EEVSE_2_4.py +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -26,8 +26,7 @@ from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts - -from TC_EEVSE_Utils import EventChangeCallback, EEVSEBaseTestHelper +from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback logger = logging.getLogger(__name__) diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index 112c6552627053..9ea74065fd10bc 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -26,8 +26,7 @@ from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts - -from TC_EEVSE_Utils import EventChangeCallback, EEVSEBaseTestHelper +from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback logger = logging.getLogger(__name__) From 21cd6d7bfa2fd459437b728f05f9da525f3f8bbb Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 11 Jan 2024 17:59:05 +0000 Subject: [PATCH 087/143] Fixed Lint issues --- src/python_testing/TC_EEVSE_2_2.py | 5 +---- src/python_testing/TC_EEVSE_2_4.py | 5 ----- src/python_testing/TC_EEVSE_2_5.py | 5 ----- src/python_testing/TC_EEVSE_Utils.py | 1 - 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index a27d8cf52ebbf9..83bc676ed75b7c 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -16,15 +16,12 @@ import logging -import queue import time from datetime import datetime, timedelta, timezone import chip.clusters as Clusters -from chip.clusters import ClusterObjects as ClusterObjects -from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction from chip.clusters.Types import NullValue -from chip.interaction_model import InteractionModelError, Status +from chip.interaction_model import Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py index 92e4d12409a541..8a28b562635390 100644 --- a/src/python_testing/TC_EEVSE_2_4.py +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -16,16 +16,11 @@ import logging -import queue import time import chip.clusters as Clusters -from chip.clusters import ClusterObjects as ClusterObjects -from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction from chip.clusters.Types import NullValue -from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from mobly import asserts from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback logger = logging.getLogger(__name__) diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index 9ea74065fd10bc..a9da6c4df8bf94 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -16,16 +16,11 @@ import logging -import queue import time import chip.clusters as Clusters -from chip.clusters import ClusterObjects as ClusterObjects -from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction from chip.clusters.Types import NullValue -from chip.interaction_model import InteractionModelError, Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from mobly import asserts from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback logger = logging.getLogger(__name__) diff --git a/src/python_testing/TC_EEVSE_Utils.py b/src/python_testing/TC_EEVSE_Utils.py index dfd788b6e3b111..f4916b0900f033 100644 --- a/src/python_testing/TC_EEVSE_Utils.py +++ b/src/python_testing/TC_EEVSE_Utils.py @@ -22,7 +22,6 @@ from chip.clusters import ClusterObjects as ClusterObjects from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction from chip.interaction_model import InteractionModelError, Status -from matter_testing_support import MatterBaseTest from mobly import asserts logger = logging.getLogger(__name__) From 9ab79d154b8892b039c2f99411b81a6d6200991f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 11 Jan 2024 18:48:34 +0000 Subject: [PATCH 088/143] Revamped TC_EEVSE_2_5 to match spec behaviour (cannot start diagnostics unless Disabled). Also removed hard-coded endpoint ids in Utils --- .../src/EnergyEvseDelegateImpl.cpp | 4 +- src/python_testing/TC_EEVSE_2_5.py | 47 ++++++++++++------- src/python_testing/TC_EEVSE_Utils.py | 20 ++++---- 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 095d8914660cd4..98dc99ac22f156 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -147,9 +147,9 @@ Status EnergyEvseDelegate::StartDiagnostics() /* For EVSE manufacturers to customize */ ChipLogProgress(AppServer, "EnergyEvseDelegate::StartDiagnostics()"); - if (mSupplyState == SupplyStateEnum::kDisabledDiagnostics) + if (mSupplyState != SupplyStateEnum::kDisabled) { - ChipLogError(AppServer, "EVSE: Already in diagnostics mode!"); + ChipLogError(AppServer, "EVSE: cannot be put into diagnostics mode if it is not Disabled!"); return Status::Failure; } diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index a9da6c4df8bf94..27dfca05ced439 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -21,6 +21,7 @@ import chip.clusters as Clusters from chip.clusters.Types import NullValue from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from chip.interaction_model import Status from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback logger = logging.getLogger(__name__) @@ -42,19 +43,22 @@ def steps_TC_EEVSE_2_5(self) -> list[TestStep]: TestStep("1", "Commissioning, already done", is_commissioning=True), TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), - TestStep("3a", "After a few seconds TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("3a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), TestStep("3b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), TestStep("3c", "TH reads from the DUT the FaultState attribute. Verify value is 0x00 (NoError)"), TestStep("4", "TH sends command EnableCharging with ChargingEnabledUntil=Null, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), TestStep("4a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("4b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (ChargingEnabled)"), - TestStep("5", "TH sends command StartDiagnostics"), - TestStep("5a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("5b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (DisabledDiagnostics)"), - TestStep("6", "A few seconds later TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Diagnostics Complete Event"), + TestStep("4b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x01 (ChargingEnabled)"), + TestStep("5", "TH sends command StartDiagnostics. Verify that command is rejected with Failure"), + TestStep("6", "TH sends command Disable."), TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (Disabled)"), - TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), + TestStep("7", "TH sends command StartDiagnostics. Verify that command is accepted with Success"), + TestStep("7a", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (DisabledDiagnostics)"), + TestStep("8", "A few seconds later TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Diagnostics Complete Event"), + TestStep("8a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (Disabled)"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), ] return steps @@ -74,9 +78,6 @@ async def test_TC_EEVSE_2_5(self): self.step("3") await self.send_test_event_trigger_basic() - # After a few seconds... - time.sleep(1) - self.step("3a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) @@ -99,25 +100,35 @@ async def test_TC_EEVSE_2_5(self): await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) self.step("5") - await self.send_start_diagnostics_command(endpoint=1) + # Check we get a failure because the state needs to be Disabled to run a Diagnostic + await self.send_start_diagnostics_command(expected_status=Status.Failure) + + self.step("6") + await self.send_disable_command() - self.step("5a") + self.step("6a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) - self.step("5b") + self.step("6b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + + self.step("7") + await self.send_start_diagnostics_command() + + self.step("7a") await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledDiagnostics) - self.step("6") + self.step("8") await self.send_test_event_trigger_evse_diagnostics_complete() - self.step("6a") + self.step("8a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) - self.step("6b") - # It should go to disabled after a diagnostics session + self.step("8b") + # It should stay disabled after a diagnostics session await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) - self.step("7") + self.step("9") await self.send_test_event_trigger_basic_clear() diff --git a/src/python_testing/TC_EEVSE_Utils.py b/src/python_testing/TC_EEVSE_Utils.py index f4916b0900f033..d2d5873c37d0b4 100644 --- a/src/python_testing/TC_EEVSE_Utils.py +++ b/src/python_testing/TC_EEVSE_Utils.py @@ -32,9 +32,9 @@ def __init__(self, expected_cluster: ClusterObjects): self._q = queue.Queue() self._expected_cluster = expected_cluster - async def start(self, dev_ctrl, nodeid): + async def start(self, dev_ctrl, nodeid, endpoint: int = 1): self._subscription = await dev_ctrl.ReadEvent(nodeid, - events=[(1, self._expected_cluster, 1)], reportInterval=(1, 5), + events=[(endpoint, self._expected_cluster, 1)], reportInterval=(1, 5), fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) self._subscription.SetEventUpdateCallback(self.__call__) @@ -62,41 +62,41 @@ async def read_evse_attribute_expect_success(self, endpoint, attribute): cluster = Clusters.Objects.EnergyEvse return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) - async def check_evse_attribute(self, attribute, expected_value): - value = await self.read_evse_attribute_expect_success(endpoint=1, attribute=attribute) + async def check_evse_attribute(self, attribute, expected_value, endpoint: int = 1): + value = await self.read_evse_attribute_expect_success(endpoint=endpoint, attribute=attribute) asserts.assert_equal(value, expected_value, f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") async def get_supported_energy_evse_attributes(self, endpoint): return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") - async def send_enable_charge_command(self, endpoint: int = 0, charge_until: int = None, timedRequestTimeoutMs: int = 3000, + async def send_enable_charge_command(self, endpoint: int = 1, charge_until: int = None, timedRequestTimeoutMs: int = 3000, min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( chargingEnabledUntil=charge_until, minimumChargeCurrent=min_charge, maximumChargeCurrent=max_charge), - endpoint=1, + endpoint=endpoint, timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_disable_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): + async def send_disable_command(self, endpoint: int = 1, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), - endpoint=1, + endpoint=endpoint, timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_start_diagnostics_command(self, endpoint: int = 0, timedRequestTimeoutMs: int = 3000, + async def send_start_diagnostics_command(self, endpoint: int = 1, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.StartDiagnostics(), - endpoint=1, + endpoint=endpoint, timedRequestTimeoutMs=timedRequestTimeoutMs) except InteractionModelError as e: From 2e774fe53de8ca01405aaca364ac36a11a98128f Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 00:41:19 +0000 Subject: [PATCH 089/143] Implemented timer to disable the EVSE automatically. --- .../include/EnergyEvseDelegateImpl.h | 26 +++++- .../src/EVSEManufacturerImpl.cpp | 5 + .../src/EnergyEvseDelegateImpl.cpp | 93 ++++++++++++++++++- src/python_testing/TC_EEVSE_2_2.py | 19 ++-- 4 files changed, 127 insertions(+), 16 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index dc46e58d5021a7..86a85363ed31a3 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -136,6 +136,15 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate */ Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg); + /** + * @brief This is used to start a check on if the Enabled timer needs to be started + * + * It should be called after the EVSE is initialised and the persisted attributes + * have been loaded, and time has been synchronised. If time isn't sync'd + * yet it will call itself back periodically (if required). + */ + Status ScheduleCheckOnEnabledTimeout(); + // ----------------------------------------------------------------- // Internal API to allow an EVSE to change its internal state etc Status HwSetMaxHardwareCurrentLimit(int64_t currentmA); @@ -214,10 +223,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate private: /* Constants */ - static constexpr int DEFAULT_MIN_CHARGE_CURRENT = 6000; /* 6A */ - static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */ - static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW = 600; /* 600s */ - static constexpr int kMaxVehicleIDBufSize = 32; + static constexpr int DEFAULT_MIN_CHARGE_CURRENT = 6000; /* 6A */ + static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */ + static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW = 600; /* 600s */ + static constexpr int kMaxVehicleIDBufSize = 32; + static constexpr int PERIODIC_CHECK_INTERVAL_REAL_TIME_CLOCK_NOT_SYNCED = 30; /* private variables for controlling the hardware - these are not attributes */ int64_t mMaxHardwareCurrentLimit = 0; /* Hardware current limit in mA */ @@ -254,6 +264,14 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate */ Status ComputeMaxChargeCurrentLimit(); + /** + * @brief This checks if the charging or discharging needs to be disabled + * + * @params pointer to SystemLayer + * @params pointer to EnergyEvseDelegate + */ + static void EvseCheckTimerExpiry(System::Layer * systemLayer, void * delegate); + /* Attributes */ StateEnum mState = StateEnum::kNotPluggedIn; SupplyStateEnum mSupplyState = SupplyStateEnum::kDisabled; diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index c71db0047b8f20..183e8a176a4a45 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -59,6 +59,11 @@ CHIP_ERROR EVSEManufacturer::Init() // uint8_t uid[10] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE }; // dg->HwSetRFID(ByteSpan(uid)); + /* Once the system is initialised then check to see if the state was restored + * (e.g. after a power outage), and if the Enable timer check needs to be started + */ + dg->ScheduleCheckOnEnabledTimeout(); + return CHIP_NO_ERROR; } diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 98dc99ac22f156..fdbd1c73638548 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -42,6 +42,13 @@ EnergyEvseDelegate::~EnergyEvseDelegate() } } +/** + * @brief Helper function to get current timestamp in Epoch format + * + * @param chipEpoch reference to hold return timestamp + */ +CHIP_ERROR GetEpochTS(uint32_t & chipEpoch); + /** * @brief Called when EVSE cluster receives Disable command */ @@ -105,8 +112,6 @@ Status EnergyEvseDelegate::EnableCharging(const DataModel::Nullable & /* check chargingEnabledUntil is in the future */ ChipLogError(AppServer, "Charging enabled until: %lu", static_cast(chargingEnabledUntil.Value())); SetChargingEnabledUntil(chargingEnabledUntil); - // TODO start a timer to disable charging later - // if (checkChargingEnabled) } /* If it looks ok, store the min & max charging current */ @@ -136,6 +141,76 @@ Status EnergyEvseDelegate::EnableDischarging(const DataModel::Nullable return HandleStateMachineEvent(EVSEStateMachineEvent::DischargingEnabledEvent); } +/** + * @brief Routine to help schedule a timer callback to check if the EVSE should go disabled + * + * If the clock is sync'd we can work out when to call back to check when to disable the EVSE + * automatically. If the clock isn't sync'd the we just set a timer to check once every 30s. + * + * We first check the SupplyState to check if it is EnabledCharging or EnabledDischarging + * Then if the EnabledCharging/DischargingUntil is not Null, then we compute a delay to come + * back and check. + */ +Status EnergyEvseDelegate::ScheduleCheckOnEnabledTimeout() +{ + + uint32_t chipEpoch = 0; + DataModel::Nullable enabledUntilTime; + + if (mSupplyState == SupplyStateEnum::kChargingEnabled) + { + enabledUntilTime = GetChargingEnabledUntil(); + } + else if (mSupplyState == SupplyStateEnum::kDischargingEnabled) + { + enabledUntilTime = GetDischargingEnabledUntil(); + } + else + { + // In all other states the EVSE is disabled + return Status::Success; + } + + if (enabledUntilTime.IsNull()) + { + /* This is enabled indefinitely so don't schedule a callback */ + return Status::Success; + } + + CHIP_ERROR err = GetEpochTS(chipEpoch); + if (err == CHIP_NO_ERROR) + { + /* time is sync'd */ + int32_t delta = static_cast(enabledUntilTime.Value() - chipEpoch); + if (delta > 0) + { + /* The timer hasn't expired yet - set a timer to check in the future */ + ChipLogDetail(AppServer, "Setting EVSE Enable check timer for %d seconds", delta); + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(delta), EvseCheckTimerExpiry, this); + } + else + { + /* we have gone past the enabledUntilTime - so we need to disable */ + ChipLogDetail(AppServer, "EVSE enable time expired, disabling charging"); + Disable(); + } + } + else if (err == CHIP_ERROR_REAL_TIME_NOT_SYNCED) + { + /* Real time isn't sync'd -lets check again in 30 seconds - otherwise keep the charger enabled */ + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(PERIODIC_CHECK_INTERVAL_REAL_TIME_CLOCK_NOT_SYNCED), + EvseCheckTimerExpiry, this); + } + return Status::Success; +} + +void EnergyEvseDelegate::EvseCheckTimerExpiry(System::Layer * systemLayer, void * delegate) +{ + EnergyEvseDelegate * dg = reinterpret_cast(delegate); + + dg->ScheduleCheckOnEnabledTimeout(); +} + /** * @brief Called when EVSE cluster receives StartDiagnostics command * @@ -615,6 +690,9 @@ Status EnergyEvseDelegate::HandleChargingEnabledEvent() default: break; } + + ScheduleCheckOnEnabledTimeout(); + return Status::Success; } Status EnergyEvseDelegate::HandleDischargingEnabledEvent() @@ -650,6 +728,9 @@ Status EnergyEvseDelegate::HandleDischargingEnabledEvent() default: break; } + + ScheduleCheckOnEnabledTimeout(); + return Status::Success; } Status EnergyEvseDelegate::HandleDisabledEvent() @@ -1366,6 +1447,14 @@ CHIP_ERROR GetEpochTS(uint32_t & chipEpoch) System::Clock::Milliseconds64 cTMs; CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); + + /* If the GetClock_RealTimeMS returns CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, then + * This platform cannot ever report real time ! + * This should not be certifiable since getting time is a Mandatory + * feature of EVSE Cluster + */ + VerifyOrDie(err != CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + if (err != CHIP_NO_ERROR) { ChipLogError(Zcl, "EVSE: Unable to get current time - err:%" CHIP_ERROR_FORMAT, err.Format()); diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index 83bc676ed75b7c..ce4b543bc2d9c1 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -176,24 +176,24 @@ async def test_TC_EEVSE_2_2(self): self.step("7") # Sleep for the charging duration plus a couple of seconds to check it has stopped time.sleep(charging_duration + 2) - # TODO check EnergyTransferredStoped (EvseStopped) - # event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) - # expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVSEStopped - # self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) + # check EnergyTransferredStoped (EvseStopped) + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStopped) + expected_reason = Clusters.EnergyEvse.Enums.EnergyTransferStoppedReasonEnum.kEVSEStopped + self.validate_energy_transfer_stopped_event(event_data, session_id, expected_state, expected_reason) self.step("7a") -# await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand) + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInDemand) self.step("7b") -# await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) self.step("8") charge_until = NullValue min_charge_current = 6000 max_charge_current = 12000 - # TODO reinstate this check + await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) - # event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) + event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) self.step("8a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) @@ -213,8 +213,7 @@ async def test_TC_EEVSE_2_2(self): await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) # from step 8 above - validate event - # TODO reinstate this check - # self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) + self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) self.step("9") # This will only work if the optional UserMaximumChargeCurrent attribute is supported From cafe1b45c026876a8f1804a025a94d0ebb1eec3a Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 00:54:37 +0000 Subject: [PATCH 090/143] Added documentation to cover concern about long-lived bytespan in enableKey --- .../EnergyEvseTestEventTriggerDelegate.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h index cb9abd29da77f4..1828d30d19eed0 100644 --- a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h +++ b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h @@ -62,7 +62,17 @@ class EnergyEvseTestEventTriggerDelegate : public TestEventTriggerDelegate mEnableKey(enableKey), mOtherDelegate(otherDelegate) {} + /** + * This function expects the enableKey ByteSpan to be valid forever. + * Typically this feature is only enabled in certification testing + * and uses a static secret key in the device for testing (e.g. in factory data) + */ bool DoesEnableKeyMatch(const ByteSpan & enableKey) const override; + + /** This function must return True if the eventTrigger is recognised and handled + * It must return False to allow a higher level TestEvent handler to check other + * clusters that may handle it. + */ CHIP_ERROR HandleEventTrigger(uint64_t eventTrigger) override; private: From c52fe69c1a9a28f8b909f47d7cc538fb313782a2 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 08:11:47 +0000 Subject: [PATCH 091/143] Fixed Lint and build issues on other platforms --- .../energy-management-common/src/EnergyEvseDelegateImpl.cpp | 2 +- src/python_testing/TC_EEVSE_2_5.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index fdbd1c73638548..63498e204e850a 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -185,7 +185,7 @@ Status EnergyEvseDelegate::ScheduleCheckOnEnabledTimeout() if (delta > 0) { /* The timer hasn't expired yet - set a timer to check in the future */ - ChipLogDetail(AppServer, "Setting EVSE Enable check timer for %d seconds", delta); + ChipLogDetail(AppServer, "Setting EVSE Enable check timer for %ld seconds", static_cast(delta)); DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(delta), EvseCheckTimerExpiry, this); } else diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index 27dfca05ced439..0179df90892687 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -16,7 +16,6 @@ import logging -import time import chip.clusters as Clusters from chip.clusters.Types import NullValue From f50ef1e7be5f15f24c67c9ef45686458551bd055 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 12 Jan 2024 08:19:47 +0000 Subject: [PATCH 092/143] Restyled by isort --- src/python_testing/TC_EEVSE_2_5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index 0179df90892687..a4b35a7e9feae9 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -19,8 +19,8 @@ import chip.clusters as Clusters from chip.clusters.Types import NullValue -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from chip.interaction_model import Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback logger = logging.getLogger(__name__) From bd975624e0745853acaf96e3bbaa96781cdc2020 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 18:45:58 +0000 Subject: [PATCH 093/143] Implemented some of the feedback on PR --- .../include/EnergyEvseDelegateImpl.h | 16 +++--- .../src/EVSEManufacturerImpl.cpp | 52 +++++++++++++------ .../src/EnergyEvseDelegateImpl.cpp | 3 +- .../src/EnergyEvseManager.cpp | 7 +-- 4 files changed, 46 insertions(+), 32 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 86a85363ed31a3..1b97fef5a8e54e 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -223,11 +223,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate private: /* Constants */ - static constexpr int DEFAULT_MIN_CHARGE_CURRENT = 6000; /* 6A */ - static constexpr int DEFAULT_USER_MAXIMUM_CHARGE_CURRENT = kMaximumChargeCurrent; /* 80A */ - static constexpr int DEFAULT_RANDOMIZATION_DELAY_WINDOW = 600; /* 600s */ - static constexpr int kMaxVehicleIDBufSize = 32; - static constexpr int PERIODIC_CHECK_INTERVAL_REAL_TIME_CLOCK_NOT_SYNCED = 30; + static constexpr int kDefaultMinChargeCurrent = 6000; /* 6A */ + static constexpr int kDefaultUserMaximumChargeCurrent = kMaximumChargeCurrent; /* 80A */ + static constexpr int kDefaultRandomizationDelayWindow = 600; /* 600s */ + static constexpr int kMaxVehicleIDBufSize = 32; + static constexpr int kPeriodicCheckIntervalRealTimeClockNotSynced = 30; /* private variables for controlling the hardware - these are not attributes */ int64_t mMaxHardwareCurrentLimit = 0; /* Hardware current limit in mA */ @@ -279,11 +279,11 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate DataModel::Nullable mChargingEnabledUntil; // TODO Default to 0 to indicate disabled DataModel::Nullable mDischargingEnabledUntil; // TODO Default to 0 to indicate disabled int64_t mCircuitCapacity = 0; - int64_t mMinimumChargeCurrent = DEFAULT_MIN_CHARGE_CURRENT; + int64_t mMinimumChargeCurrent = kDefaultMinChargeCurrent; int64_t mMaximumChargeCurrent = 0; int64_t mMaximumDischargeCurrent = 0; - int64_t mUserMaximumChargeCurrent = DEFAULT_USER_MAXIMUM_CHARGE_CURRENT; // TODO update spec - uint32_t mRandomizationDelayWindow = DEFAULT_RANDOMIZATION_DELAY_WINDOW; + int64_t mUserMaximumChargeCurrent = kDefaultUserMaximumChargeCurrent; // TODO update spec + uint32_t mRandomizationDelayWindow = kDefaultRandomizationDelayWindow; /* PREF attributes */ uint8_t mNumberOfWeeklyTargets = 0; uint8_t mNumberOfDailyTargets = 1; diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 183e8a176a4a45..6e646a8dad42ee 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -42,22 +42,16 @@ CHIP_ERROR EVSEManufacturer::Init() dg->HwRegisterEvseCallbackHandler(ApplicationCallbackHandler, reinterpret_cast(this)); - // For Manufacturer to specify the hardware capability in mA - // dg->HwSetMaxHardwareCurrentLimit(32000); - - // For Manufacturer to specify the CircuitCapacity (e.g. from DIP switches) - // dg->HwSetCircuitCapacity(20000); - - // For now let's pretend the EV is plugged in, and asking for demand - // dg->HwSetState(StateEnum::kPluggedInDemand); - // dg->HwSetCableAssemblyLimit(63000); - - // For now let's pretend the vehicle ID is set - // dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_123456789")); - - // For now let's pretend the RFID sensor was triggered - send an event - // uint8_t uid[10] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE }; - // dg->HwSetRFID(ByteSpan(uid)); + /* + * This is an example implementation for manufacturers to consider + * + * For Manufacturer to specify the hardware capability in mA: + * dg->HwSetMaxHardwareCurrentLimit(32000); // 32A + * + * For Manufacturer to specify the CircuitCapacity in mA (e.g. from DIP switches) + * dg->HwSetCircuitCapacity(20000); // 20A + * + */ /* Once the system is initialised then check to see if the state was restored * (e.g. after a power outage), and if the Enable timer check needs to be started @@ -67,6 +61,32 @@ CHIP_ERROR EVSEManufacturer::Init() return CHIP_NO_ERROR; } +/* + * When the EV is plugged in, and asking for demand change the state + * and set the CableAssembly current limit + * + * EnergyEvseDelegate * dg = GetEvseManufacturer()->GetDelegate(); + * if (dg == nullptr) + * { + * ChipLogError(AppServer, "Delegate is not initialized"); + * return CHIP_ERROR_UNINITIALIZED; + * } + * + * dg->HwSetState(StateEnum::kPluggedInDemand); + * dg->HwSetCableAssemblyLimit(63000); // 63A = 63000mA + * + * + * If the vehicle ID can be retrieved (e.g. over Powerline) + * dg->HwSetVehicleID(CharSpan::fromCharString("TEST_VEHICLE_123456789")); + * + * + * If the EVSE has an RFID sensor, the RFID value read can cause an event to be sent + * (e.g. can be used to indicate if a user as tried to activate the charging) + * + * uint8_t uid[10] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE }; + * dg->HwSetRFID(ByteSpan(uid)); + */ + CHIP_ERROR EVSEManufacturer::Shutdown() { return CHIP_NO_ERROR; diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 63498e204e850a..dc3385c850c85f 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -198,7 +198,7 @@ Status EnergyEvseDelegate::ScheduleCheckOnEnabledTimeout() else if (err == CHIP_ERROR_REAL_TIME_NOT_SYNCED) { /* Real time isn't sync'd -lets check again in 30 seconds - otherwise keep the charger enabled */ - DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(PERIODIC_CHECK_INTERVAL_REAL_TIME_CLOCK_NOT_SYNCED), + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(kPeriodicCheckIntervalRealTimeClockNotSynced), EvseCheckTimerExpiry, this); } return Status::Success; @@ -387,7 +387,6 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) /* All other states should be managed by the Delegate */ ChipLogError(AppServer, "HwSetState received invalid enum from caller"); return Status::Failure; - break; } return Status::Success; diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp index a71474f0913abb..710b13f9d342b8 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp @@ -105,12 +105,7 @@ CHIP_ERROR EnergyEvseManager::LoadPersistentAttributes() CHIP_ERROR EnergyEvseManager::Init() { - CHIP_ERROR err = Instance::Init(); - if (err != CHIP_NO_ERROR) - { - return err; - } - + ReturnErrorOnFailure(Instance::Init()); return LoadPersistentAttributes(); } From 895b55238ccb4183542e413801bb3e13d390d048 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 19:16:25 +0000 Subject: [PATCH 094/143] Refactored HwSetState to use nested switch statements to be clear that all enums are caught. --- .../src/EnergyEvseDelegateImpl.cpp | 48 +++++++++++++++---- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index dc3385c850c85f..14486d9528512f 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -345,41 +345,71 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) switch (newState) { case StateEnum::kNotPluggedIn: - if (mHwState == StateEnum::kPluggedInNoDemand || mHwState == StateEnum::kPluggedInDemand) + switch (mHwState) { + case StateEnum::kNotPluggedIn: + // No change + break; + case StateEnum::kPluggedInNoDemand: + case StateEnum::kPluggedInDemand: /* EVSE has been unplugged now */ mHwState = newState; HandleStateMachineEvent(EVSEStateMachineEvent::EVNotDetectedEvent); + break; + + default: + // invalid value for mHwState + ChipLogError(AppServer, "HwSetState newstate(kNotPluggedIn) - Invalid value for mHwState"); + mHwState = newState; // set it to the new state + break; } break; case StateEnum::kPluggedInNoDemand: - if (mHwState == StateEnum::kNotPluggedIn) + switch (mHwState) { + case StateEnum::kNotPluggedIn: /* EV was unplugged, now is plugged in */ mHwState = newState; HandleStateMachineEvent(EVSEStateMachineEvent::EVPluggedInEvent); - } - else if (mHwState == StateEnum::kPluggedInDemand) - { + break; + case StateEnum::kPluggedInNoDemand: + // No change + break; + case StateEnum::kPluggedInDemand: /* EV was plugged in and wanted demand, now doesn't want demand */ mHwState = newState; HandleStateMachineEvent(EVSEStateMachineEvent::EVNoDemandEvent); + break; + default: + // invalid value for mHwState + ChipLogError(AppServer, "HwSetState newstate(kNotPluggedIn) - Invalid value for mHwState"); + mHwState = newState; // set it to the new state + break; } break; case StateEnum::kPluggedInDemand: - if (mHwState == StateEnum::kNotPluggedIn) + switch (mHwState) { + case StateEnum::kNotPluggedIn: /* EV was unplugged, now is plugged in and wants demand */ mHwState = newState; HandleStateMachineEvent(EVSEStateMachineEvent::EVPluggedInEvent); HandleStateMachineEvent(EVSEStateMachineEvent::EVDemandEvent); - } - else if (mHwState == StateEnum::kPluggedInNoDemand) - { + break; + case StateEnum::kPluggedInNoDemand: /* EV was plugged in and didn't want demand, now does want demand */ mHwState = newState; HandleStateMachineEvent(EVSEStateMachineEvent::EVDemandEvent); + break; + case StateEnum::kPluggedInDemand: + // No change + break; + default: + // invalid value for mHwState + ChipLogError(AppServer, "HwSetState newstate(kNotPluggedIn) - Invalid value for mHwState"); + mHwState = newState; // set it to the new state + break; } break; From 87fe6cca8cc63d0b595994dfcdeb72a9dc1aedf3 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 19:55:32 +0000 Subject: [PATCH 095/143] Fixed error messages --- .../src/EnergyEvseDelegateImpl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 14486d9528512f..6704eda6fa0158 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -360,7 +360,7 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) default: // invalid value for mHwState ChipLogError(AppServer, "HwSetState newstate(kNotPluggedIn) - Invalid value for mHwState"); - mHwState = newState; // set it to the new state + mHwState = newState; // set it to the new state anyway break; } break; @@ -383,8 +383,8 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) break; default: // invalid value for mHwState - ChipLogError(AppServer, "HwSetState newstate(kNotPluggedIn) - Invalid value for mHwState"); - mHwState = newState; // set it to the new state + ChipLogError(AppServer, "HwSetState newstate(kPluggedInNoDemand) - Invalid value for mHwState"); + mHwState = newState; // set it to the new state anyway break; } break; @@ -407,8 +407,8 @@ Status EnergyEvseDelegate::HwSetState(StateEnum newState) break; default: // invalid value for mHwState - ChipLogError(AppServer, "HwSetState newstate(kNotPluggedIn) - Invalid value for mHwState"); - mHwState = newState; // set it to the new state + ChipLogError(AppServer, "HwSetState newstate(kPluggedInDemand) - Invalid value for mHwState"); + mHwState = newState; // set it to the new state anyway break; } break; From 6b12abe16ef943d4c8ef05aa3b20bd20690050c0 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 20:54:51 +0000 Subject: [PATCH 096/143] Test scripts: Removed hardcoded endpoint 1 (use --endpoint 1 in args), allowed the enableKey to be passed in using --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --- src/python_testing/TC_EEVSE_2_2.py | 24 +++++++---------- src/python_testing/TC_EEVSE_2_4.py | 8 +++--- src/python_testing/TC_EEVSE_2_5.py | 6 +++-- src/python_testing/TC_EEVSE_Utils.py | 39 +++++++++++++++++++++------- 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index ce4b543bc2d9c1..fd5a3a042f5fa8 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -31,12 +31,6 @@ class TC_EEVSE_2_2(MatterBaseTest, EEVSEBaseTestHelper): - async def write_user_max_charge(self, endpoint, user_max_charge): - result = await self.default_controller.WriteAttribute(self.dut_node_id, - [(endpoint, - Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) - asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") - def desc_TC_EEVSE_2_2(self) -> str: """Returns a description of this test""" return "5.1.3. [TC-EEVSE-2.2] Primary functionality with DUT as Server" @@ -106,7 +100,9 @@ async def test_TC_EEVSE_2_2(self): # Subscribe to Events and when they are sent push them to a queue for checking later events_callback = EventChangeCallback(Clusters.EnergyEvse) - await events_callback.start(self.default_controller, self.dut_node_id) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) self.step("2") await self.check_test_event_triggers_enabled() @@ -135,7 +131,7 @@ async def test_TC_EEVSE_2_2(self): self.step("4b") # Save Session ID for later and check it against the value in the event - session_id = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionID") + session_id = await self.read_evse_attribute_expect_success(attribute="SessionID") self.validate_ev_connected_event(event_data, session_id) self.step("5") @@ -167,7 +163,7 @@ async def test_TC_EEVSE_2_2(self): await self.check_evse_attribute("MinimumChargeCurrent", min_charge_current) self.step("6e") - circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute="CircuitCapacity") + circuit_capacity = await self.read_evse_attribute_expect_success(attribute="CircuitCapacity") expected_max_charge = min(max_charge_current, circuit_capacity) await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) @@ -192,7 +188,7 @@ async def test_TC_EEVSE_2_2(self): min_charge_current = 6000 max_charge_current = 12000 - await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) self.step("8a") @@ -208,7 +204,7 @@ async def test_TC_EEVSE_2_2(self): await self.check_evse_attribute("MinimumChargeCurrent", min_charge_current) self.step("8e") - circuit_capacity = await self.read_evse_attribute_expect_success(endpoint=1, attribute="CircuitCapacity") + circuit_capacity = await self.read_evse_attribute_expect_success(attribute="CircuitCapacity") expected_max_charge = min(max_charge_current, circuit_capacity) await self.check_evse_attribute("MaximumChargeCurrent", expected_max_charge) @@ -217,7 +213,7 @@ async def test_TC_EEVSE_2_2(self): self.step("9") # This will only work if the optional UserMaximumChargeCurrent attribute is supported - supported_attributes = await self.get_supported_energy_evse_attributes(endpoint=1) + supported_attributes = await self.get_supported_energy_evse_attributes() if Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent.attribute_id in supported_attributes: logging.info("UserMaximumChargeCurrent is supported...") user_max_charge_current = 6000 @@ -243,7 +239,7 @@ async def test_TC_EEVSE_2_2(self): self.step("11") await self.send_test_event_trigger_charge_demand() # Check we get EnergyTransferStarted again - await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) event_data = events_callback.WaitForEventReport(Clusters.EnergyEvse.Events.EnergyTransferStarted) self.validate_energy_transfer_started_event(event_data, session_id, expected_state, expected_max_charge) @@ -275,7 +271,7 @@ async def test_TC_EEVSE_2_2(self): await self.check_evse_attribute("SessionID", session_id) self.step("13d") - session_duration = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionDuration") + session_duration = await self.read_evse_attribute_expect_success(attribute="SessionDuration") asserts.assert_greater_equal(session_duration, charging_duration, f"Unexpected 'SessionDuration' value - expected >= {charging_duration}, was {session_duration}") diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py index 8a28b562635390..9379e23332e813 100644 --- a/src/python_testing/TC_EEVSE_2_4.py +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -75,7 +75,9 @@ async def test_TC_EEVSE_2_4(self): # Subscribe to Events and when they are sent push them to a queue for checking later events_callback = EventChangeCallback(Clusters.EnergyEvse) - await events_callback.start(self.default_controller, self.dut_node_id) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) self.step("2") await self.check_test_event_triggers_enabled() @@ -104,14 +106,14 @@ async def test_TC_EEVSE_2_4(self): self.step("4b") # Save Session ID for later and check it against the value in the event - session_id = await self.read_evse_attribute_expect_success(endpoint=1, attribute="SessionID") + session_id = await self.read_evse_attribute_expect_success(attribute="SessionID") self.validate_ev_connected_event(event_data, session_id) self.step("5") charge_until = NullValue min_charge_current = 6000 max_charge_current = 60000 - await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) self.step("6") await self.send_test_event_trigger_charge_demand() diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index a4b35a7e9feae9..1a647c20e0bcef 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -69,7 +69,9 @@ async def test_TC_EEVSE_2_5(self): # Subscribe to Events and when they are sent push them to a queue for checking later events_callback = EventChangeCallback(Clusters.EnergyEvse) - await events_callback.start(self.default_controller, self.dut_node_id) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) self.step("2") await self.check_test_event_triggers_enabled() @@ -90,7 +92,7 @@ async def test_TC_EEVSE_2_5(self): charge_until = NullValue min_charge_current = 6000 max_charge_current = 60000 - await self.send_enable_charge_command(endpoint=1, charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) self.step("4a") await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) diff --git a/src/python_testing/TC_EEVSE_Utils.py b/src/python_testing/TC_EEVSE_Utils.py index d2d5873c37d0b4..fb6bfa1f714d13 100644 --- a/src/python_testing/TC_EEVSE_Utils.py +++ b/src/python_testing/TC_EEVSE_Utils.py @@ -32,9 +32,9 @@ def __init__(self, expected_cluster: ClusterObjects): self._q = queue.Queue() self._expected_cluster = expected_cluster - async def start(self, dev_ctrl, nodeid, endpoint: int = 1): - self._subscription = await dev_ctrl.ReadEvent(nodeid, - events=[(endpoint, self._expected_cluster, 1)], reportInterval=(1, 5), + async def start(self, dev_ctrl, node_id: int, endpoint: int): + self._subscription = await dev_ctrl.ReadEvent(node_id, + events=[(endpoint, self._expected_cluster, True)], reportInterval=(1, 5), fabricFiltered=False, keepSubscriptions=True, autoResubscribe=False) self._subscription.SetEventUpdateCallback(self.__call__) @@ -57,20 +57,28 @@ def WaitForEventReport(self, expected_event: ClusterObjects.ClusterEvent): class EEVSEBaseTestHelper: - async def read_evse_attribute_expect_success(self, endpoint, attribute): + async def read_evse_attribute_expect_success(self, endpoint: int = None, attribute: str = ""): full_attr = getattr(Clusters.EnergyEvse.Attributes, attribute) cluster = Clusters.Objects.EnergyEvse return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) - async def check_evse_attribute(self, attribute, expected_value, endpoint: int = 1): + async def check_evse_attribute(self, attribute, expected_value, endpoint: int = None): value = await self.read_evse_attribute_expect_success(endpoint=endpoint, attribute=attribute) asserts.assert_equal(value, expected_value, f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") - async def get_supported_energy_evse_attributes(self, endpoint): + async def get_supported_energy_evse_attributes(self, endpoint: int = None): return await self.read_evse_attribute_expect_success(endpoint, "AttributeList") - async def send_enable_charge_command(self, endpoint: int = 1, charge_until: int = None, timedRequestTimeoutMs: int = 3000, + async def write_user_max_charge(self, endpoint: int = None, user_max_charge: int = 0): + if endpoint is None: + endpoint = self.matter_test_config.endpoint + result = await self.default_controller.WriteAttribute(self.dut_node_id, + [(endpoint, + Clusters.EnergyEvse.Attributes.UserMaximumChargeCurrent(user_max_charge))]) + asserts.assert_equal(result[0].Status, Status.Success, "UserMaximumChargeCurrent write failed") + + async def send_enable_charge_command(self, endpoint: int = None, charge_until: int = None, timedRequestTimeoutMs: int = 3000, min_charge: int = None, max_charge: int = None, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.EnableCharging( @@ -83,7 +91,7 @@ async def send_enable_charge_command(self, endpoint: int = 1, charge_until: int except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_disable_command(self, endpoint: int = 1, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): + async def send_disable_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.Disable(), endpoint=endpoint, @@ -92,7 +100,7 @@ async def send_disable_command(self, endpoint: int = 1, timedRequestTimeoutMs: i except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_start_diagnostics_command(self, endpoint: int = 1, timedRequestTimeoutMs: int = 3000, + async def send_start_diagnostics_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, expected_status: Status = Status.Success): try: await self.send_single_cmd(cmd=Clusters.EnergyEvse.Commands.StartDiagnostics(), @@ -102,8 +110,18 @@ async def send_start_diagnostics_command(self, endpoint: int = 1, timedRequestTi except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000): + async def send_test_event_triggers(self, enableKey: bytes = None, eventTrigger=0x0099000000000000): + # get the test event enable key or assume the default + # This can be passed in on command line using + # --hex-arg enableKey:000102030405060708090a0b0c0d0e0f + if enableKey is None: + if 'enableKey' not in self.matter_test_config.global_test_params: + enableKey = bytes([b for b in range(16)]) + else: + enableKey = self.matter_test_config.global_test_params['enableKey'] + try: + # GeneralDiagnosics cluster is meant to be on Endpoint 0 (Root) await self.send_single_cmd(endpoint=0, cmd=Clusters.GeneralDiagnostics.Commands.TestEventTrigger( enableKey, @@ -116,6 +134,7 @@ async def send_test_event_triggers(self, enableKey=bytes([b for b in range(16)]) async def check_test_event_triggers_enabled(self): full_attr = Clusters.GeneralDiagnostics.Attributes.TestEventTriggersEnabled cluster = Clusters.Objects.GeneralDiagnostics + # GeneralDiagnosics cluster is meant to be on Endpoint 0 (Root) test_event_enabled = await self.read_single_attribute_check_success(endpoint=0, cluster=cluster, attribute=full_attr) asserts.assert_equal(test_event_enabled, True, "TestEventTriggersEnabled is False") From 303ca2af24d85deea20612109f9377140a7bc057 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 21:31:08 +0000 Subject: [PATCH 097/143] Made enum class for callbacks and improved documentation comments based on feedback. --- .../include/EVSECallbacks.h | 16 +++++++++++----- .../include/EnergyEvseDelegateImpl.h | 16 ++++++++++++---- .../EnergyEvseTestEventTriggerDelegate.h | 11 +++++++---- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h index e72ee80ef9fcca..15578405552d78 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h +++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h @@ -30,31 +30,37 @@ using namespace chip::app::Clusters::EnergyEvse; * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement * and potential future clusters. */ -enum EVSECallbackType + +enum class EVSECallbackType : uint8_t { /* * The State has changed (e.g. from Disabled to Charging, or vice-versa) */ StateChanged, /* - * ChargeCurrent has changed + * ChargeCurrent has changed (e.g. maxChargingCurrent so requires an + update to advertise a different charging current to the EV) */ ChargeCurrentChanged, /* * Charging Preferences have changed + * The daily charging target time, SoC / Added Energy schedules have changed + * and may require the local optimiser to re-run. */ ChargingPreferencesChanged, /* - * Energy Meter Reading requested + * Energy Meter Reading requested from the hardware, e.g. so that the session + * information can be updated. */ EnergyMeterReadingRequested, /* - * DeviceEnergyManagement has changed + * The associated DeviceEnergyManagement cluster has changed. This may mean + * that the start time, or power profile or power levels have been adjusted */ DeviceEnergyManagementChanged, }; -enum ChargingDischargingType +enum class ChargingDischargingType : uint8_t { kCharging, kDischarging diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 1b97fef5a8e54e..8cf76f1b7a29bf 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -137,11 +137,19 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate Status HwRegisterEvseCallbackHandler(EVSECallbackFunc handler, intptr_t arg); /** - * @brief This is used to start a check on if the Enabled timer needs to be started + * @brief Decides if a timer is needed based on EVSE state and sets a callback if needed * - * It should be called after the EVSE is initialised and the persisted attributes - * have been loaded, and time has been synchronised. If time isn't sync'd - * yet it will call itself back periodically (if required). + * In order to ensure the EVSE restarts charging (if enabled) after power loss + * this should be called after the EVSE is initialised + * (e.g. HwSetMaxHardwareCurrentLimit and HwSetCircuitCapacity have been called) + * and the persisted attributes have been loaded, and time has been synchronised. + * + * If time isn't sync'd yet it will call itself back periodically (if required) + * until time is sync'd. + * + * It is also called when a EnableCharging or EnableDischarging command + * is recv'd to schedule when the EVSE should be automatically disabled based + * on ChargingEnabledUntil / DischargingEnabledUntil expiring. */ Status ScheduleCheckOnEnabledTimeout(); diff --git a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h index 1828d30d19eed0..3c1dff4f5e7f81 100644 --- a/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h +++ b/src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h @@ -58,14 +58,17 @@ enum class EnergyEvseTrigger : uint64_t class EnergyEvseTestEventTriggerDelegate : public TestEventTriggerDelegate { public: + /** + * This class expects the enableKey ByteSpan to be valid forever. + * Typically this feature is only enabled in certification testing + * and uses a static secret key in the device for testing (e.g. in factory data) + */ explicit EnergyEvseTestEventTriggerDelegate(const ByteSpan & enableKey, TestEventTriggerDelegate * otherDelegate) : mEnableKey(enableKey), mOtherDelegate(otherDelegate) {} - /** - * This function expects the enableKey ByteSpan to be valid forever. - * Typically this feature is only enabled in certification testing - * and uses a static secret key in the device for testing (e.g. in factory data) + /* This function returns True if the enableKey received in the TestEventTrigger command + * matches the value passed into the constructor. */ bool DoesEnableKeyMatch(const ByteSpan & enableKey) const override; From 34c077d0d015762e5f7d8c98e6a03bf5bb93c473 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 22:14:05 +0000 Subject: [PATCH 098/143] Fixed another python lint issue. --- src/python_testing/TC_EEVSE_2_2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python_testing/TC_EEVSE_2_2.py b/src/python_testing/TC_EEVSE_2_2.py index fd5a3a042f5fa8..8ebc78a22e94cd 100644 --- a/src/python_testing/TC_EEVSE_2_2.py +++ b/src/python_testing/TC_EEVSE_2_2.py @@ -21,7 +21,6 @@ import chip.clusters as Clusters from chip.clusters.Types import NullValue -from chip.interaction_model import Status from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts from TC_EEVSE_Utils import EEVSEBaseTestHelper, EventChangeCallback From 50793c3a86e76de039fa5c6be68f93310823b006 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Fri, 12 Jan 2024 23:58:28 +0000 Subject: [PATCH 099/143] Updated README.md with help on how to build for test event triggers, using chip-repl and python testing. --- .../energy-management-app/linux/README.md | 366 +++++++++++++++++- 1 file changed, 364 insertions(+), 2 deletions(-) diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md index 9671ab073b12a8..a6a9e9671f622c 100644 --- a/examples/energy-management-app/linux/README.md +++ b/examples/energy-management-app/linux/README.md @@ -13,10 +13,17 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** - [CHIP Linux Energy Management Example](#chip-linux-energy-management-example) - [Building](#building) - - [Commandline Arguments](#commandline-arguments) + - [Commandline arguments](#commandline-arguments) - [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4) - - [Running RPC console](#running-rpc-console) + - [Running RPC Console](#running-rpc-console) - [Device Tracing](#device-tracing) + - [Python TestCases](#python-testcases) + - [Running the test cases:](#running-the-test-cases) + - [CHIP-REPL Interaction](#chip-repl-interaction) + - [Building chip-repl:](#building-chip-repl) + - [Activating python virtual env](#activating-python-virtual-env) + - [Interacting with CHIP-REPL and the example app](#interacting-with-chip-repl-and-the-example-app) + - [Using chip-repl to Fake a charging session](#using-chip-repl-to-fake-a-charging-session)
@@ -141,3 +148,358 @@ Obtain tracing json file. $ ./{PIGWEED_REPO}/pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py -s localhost:33000 \ -o {OUTPUT_FILE} -t {ELF_FILE} {PIGWEED_REPO}/pw_trace_tokenized/pw_trace_protos/trace_rpc.proto ``` + +## Python TestCases + +When you want to test this cluster you can use chip-repl or chip-tool by hand. +CHIP-REPL is slightly easier to interact with when dealing with some of the +complex structures. + +There are several test scripts provided for EVSE (in +[src/python_testing](src/python_testing)): + +- TC_EEVSE_2_2: This validates the primary functionality +- TC_EEVSE_2_3: This validates Get/Set/Clear target commands +- TC_EEVSE_2_4: This validates Faults +- TC_EEVSE_2_5: This validates EVSE diagnostic command (optional) + +These scripts require the use of TestEventsTriggers via the GeneralDiagnostics +cluster on Endpoint 0. This requires an enableKey (16 bytes) and a set of +reserved int64_t TestEvent trigger codes. + +By default the test event support is not enabled, and when compiling the example +app you need to add `chip_enable_energy_evse_trigger=true` to the gn args. + + $ gn gen out/debug + $ ninja -C out/debug --args='chip_enable_energy_evse_trigger=true` + +Once the application is built you also need to tell it at runtime what the +chosen enable key is using the `--enable-key` command line option. + + $ ./chip-energy-management-app --enable-key 000102030405060708090a0b0c0d0e0f + +### Running the test cases: + +From the top-level of the connectedhomeip repo type: + +```bash + $ python src/python_testing/TC_EEVSE_2_2.py --endpoint 1 -m on-network -n 1234 -p 20202021 -d 3840 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f +``` + +- Note that the `--endpoint 1` must be used with the example, since the EVSE + cluster is on endpoint 1. The `--hex-arg enableKey:` value must match + the `--enable-key ` used on chip-energy-management-app args. + +## CHIP-REPL Interaction + +- See chip-repl documentation in + [Matter_REPL_Intro](../../../docs/guides/repl/Matter_REPL_Intro.ipynb) + +### Building chip-repl: + +```bash + $ ./build_python.sh -i +``` + +### Activating python virtual env + +- You need to repeat this step each time you start a new shell. + +```bash + $ source /bin/activate +``` + +### Interacting with CHIP-REPL and the example app + +- Step 1: Launch the example app + +```bash + $ ./chip-energy-management-app --enable-key 000102030405060708090a0b0c0d0e0f +``` + +- Step 2: Launch CHIP-REPL + +```bash + $ chip-repl +``` + +- Step 3: (In chip-repl) Commissioning OnNetwork + +```python + devCtrl.CommissionOnNetwork(1234,20202021) # Commission with NodeID 1234 +Established secure session with Device +Commissioning complete +Out[2]: +``` + +- Step 4: (In chip-repl) Read EVSE attributes + +```python + # Read from NodeID 1234, Endpoint 1, all attributes on EnergyEvse cluster + await devCtrl.ReadAttribute(1234,[(1, chip.clusters.EnergyEvse)]) + +{ +│ 1: { +│ │ : { +│ │ │ : 3790455237, +│ │ │ : Null, +│ │ │ : , +│ │ │ : Null, +│ │ │ : Null, +│ │ │ : 0, +│ │ │ : Null, +│ │ │ : Null, +│ │ │ : [ +... │ │ ], +│ │ │ : 6000, +│ │ │ : Null, +│ │ │ : 758415333, +│ │ │ : 0, +│ │ │ : 1, +│ │ │ : [ +... +│ │ │ ], +│ │ │ : , +│ │ │ : Null, +│ │ │ : Null, +│ │ │ : Null, +│ │ │ : Null, +│ │ │ : Null, +│ │ │ : [ +... │ │ ], +│ │ │ : Null, +│ │ │ : 0, +│ │ │ : Null, +│ │ │ : , +│ │ │ : 600, +│ │ │ : 0, +│ │ │ : 1, +│ │ │ : 80000, +│ │ │ : 2 +│ │ } +│ } +} + +``` + +- Step 5: Setting up a subscription so that attributes updates are sent + automatically + +```python + reportingTimingParams = (3, 60) # MinInterval = 3s, MaxInterval = 60s + subscription = await devCtrl.ReadAttribute(1234,[(1, chip.clusters.EnergyEvse)], reportInterval=reportingTimingParams) +``` + +- Step 6: Send an EnableCharging command which lasts for 60 seconds The + EnableCharging takes an optional parameter which allows the charger to + automatically disable itself at some preset time in the future. Note that it + uses Epoch_s (which is from Jan 1 2000) which is a uint32_t in seconds. + +```python + from datetime import datetime, timezone, timedelta + epoch_end = int((datetime.now(tz=timezone.utc) + timedelta(seconds=60) - datetime(2000, 1, 1, 0, 0, 0, 0, timezone.utc)).total_seconds()) + + await devCtrl.SendCommand(1234, 1, chip.clusters.EnergyEvse.Commands.EnableCharging(chargingEnabledUntil=epoch_end,minimumChargeCurrent=2000,maximumChargeCurrent=25000),timedRequestTimeoutMs=3000) +``` + +The output should look like: + +``` +Attribute Changed: +{ +│ 'Endpoint': 1, +│ 'Attribute': , +│ 'Value': +} +Attribute Changed: +{ +│ 'Endpoint': 1, +│ 'Attribute': , +│ 'Value': 2000 +} +Attribute Changed: +{ +│ 'Endpoint': 1, +│ 'Attribute': , +│ 'Value': 758416066 +} +``` + +After 60 seconds the charging should automatically become disabled: + +```python +Attribute Changed: +{ +│ 'Endpoint': 1, +│ 'Attribute': , +│ 'Value': +} +Attribute Changed: +{ +│ 'Endpoint': 1, +│ 'Attribute': , +│ 'Value': 0 +} +Attribute Changed: +{ +│ 'Endpoint': 1, +│ 'Attribute': , +│ 'Value': 0 +} +Attribute Changed: +{ +│ 'Endpoint': 1, +│ 'Attribute': , +│ 'Value': 0 +} +``` + +Note that you can omit the `chargingEnabledUntil` argument and it will charge +indefinitely. + +### Using chip-repl to Fake a charging session + +If you haven't implemented a real EVSE but want to simulate plugging in an EV +then you can use a few of the test event triggers to simulate these scenarios. + +The test event triggers values can be found in: +[EnergyEvseTestEventTriggerDelegate.h](../../../src/app/clusters/energy-evse-server/EnergyEvseTestEventTriggerDelegate.h) + +- 0x0099000000000000 - Simulates the EVSE being installed on a 32A supply +- 0x0099000000000002 - Simulates the EVSE being plugged in (this should + generate an EVConnected event) +- 0x0099000000000004 - Simulates the EVSE requesting power + +To send a test event trigger to the app, use the following commands (in +chip-repl): + +```python + # Read the events + await devCtrl.ReadEvent(1234,[(1, chip.clusters.EnergyEvse,1)]) +[] + + # send 1st event trigger to 'install' the EVSE on a 32A supply + await devCtrl.SendCommand(1234, 0, chip.clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000)) + + # send 2nd event trigger to plug the EV in + await devCtrl.SendCommand(1234, 0, chip.clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000002)) + +``` + +Now send the enable charging command (omit the chargingEnabledUntil arg this +time): + +```python + await devCtrl.SendCommand(1234, 1, chip.clusters.EnergyEvse.Commands.EnableCharging(minimumChargeCurrent=2000,maximumChargeCurrent=25000),timedRequestTimeoutMs=3000) +``` + +Now send the test event trigger to simulate the EV asking for demand: + +```python + # send 2nd event trigger to plug the EV in + await devCtrl.SendCommand(1234, 0, chip.clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000004)) + + # Read the events + await devCtrl.ReadEvent(1234,[(1, chip.clusters.EnergyEvse,1)]) +[ +│ EventReadResult( +│ │ Header=EventHeader( +│ │ │ EndpointId=1, +│ │ │ ClusterId=153, +│ │ │ EventId=0, +│ │ │ EventNumber=65538, +│ │ │ Priority=, +│ │ │ Timestamp=1705102500069, +│ │ │ TimestampType= +│ │ ), +│ │ Status=, +│ │ Data=EVConnected( +│ │ │ sessionID=0 +│ │ ) +│ ), +│ EventReadResult( +│ │ Header=EventHeader( +│ │ │ EndpointId=1, +│ │ │ ClusterId=153, +│ │ │ EventId=2, +│ │ │ EventNumber=65539, +│ │ │ Priority=, +│ │ │ Timestamp=1705102801764, +│ │ │ TimestampType= +│ │ ), +│ │ Status=, +│ │ Data=EnergyTransferStarted( +│ │ │ sessionID=0, +│ │ │ state=, +│ │ │ maximumCurrent=25000 +│ │ ) +│ ) +] +``` + +- We can see that the `EventNumber 65538` was sent when the vehicle was + plugged in, and a new `sessionID=0` was created. +- We can also see that the EnergyTransferStarted was sent in + `EventNumber 65539` + +What happens when we unplug the vehicle? + +```python + await devCtrl.SendCommand(1234, 0, chip.clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000001)) +``` + +When we re-read the events: + +```python +[ +│ EventReadResult( +│ │ Header=EventHeader( +│ │ │ EndpointId=1, +│ │ │ ClusterId=153, +│ │ │ EventId=3, +│ │ │ EventNumber=65540, +│ │ │ Priority=, +│ │ │ Timestamp=1705102996749, +│ │ │ TimestampType= +│ │ ), +│ │ Status=, +│ │ Data=EnergyTransferStopped( +│ │ │ sessionID=0, +│ │ │ state=, +│ │ │ reason=, +│ │ │ energyTransferred=0 +│ │ ) +│ ), +│ EventReadResult( +│ │ Header=EventHeader( +│ │ │ EndpointId=1, +│ │ │ ClusterId=153, +│ │ │ EventId=1, +│ │ │ EventNumber=65541, +│ │ │ Priority=, +│ │ │ Timestamp=1705102996749, +│ │ │ TimestampType= +│ │ ), +│ │ Status=, +│ │ Data=EVNotDetected( +│ │ │ sessionID=0, +│ │ │ state=, +│ │ │ sessionDuration=0, +│ │ │ sessionEnergyCharged=0, +│ │ │ sessionEnergyDischarged=0 +│ │ ) +│ ) +] + +``` + +- In `EventNumber 65540` we had an EnergyTransferStopped event with reason + `kOther`. + + This was a rather abrupt end to a charging session (normally we would see + the EVSE or EV decide to stop charging), but this demonstrates the cable + being pulled out without a graceful charging shutdown. + +- In `EventNumber 65541` we had an EvNotDetected event showing that the state + was `kPluggedInCharging` prior to the EV being not detected (normally in a + graceful shutdown this would be `kPluggedInNoDemand` or `kPluggedInDemand`). From f6293264611e8cb7433c9ee0e1622bbc8fd71b4a Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 13:30:52 +0000 Subject: [PATCH 100/143] Tweaks to README.md to avoid Myst syntax highlighting issues. --- examples/energy-management-app/linux/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md index a6a9e9671f622c..fbf2e83d730970 100644 --- a/examples/energy-management-app/linux/README.md +++ b/examples/energy-management-app/linux/README.md @@ -237,7 +237,9 @@ Out[2]: ```python # Read from NodeID 1234, Endpoint 1, all attributes on EnergyEvse cluster await devCtrl.ReadAttribute(1234,[(1, chip.clusters.EnergyEvse)]) +``` +``` { │ 1: { │ │ : { @@ -327,7 +329,7 @@ Attribute Changed: After 60 seconds the charging should automatically become disabled: -```python +``` Attribute Changed: { │ 'Endpoint': 1, @@ -374,10 +376,6 @@ To send a test event trigger to the app, use the following commands (in chip-repl): ```python - # Read the events - await devCtrl.ReadEvent(1234,[(1, chip.clusters.EnergyEvse,1)]) -[] - # send 1st event trigger to 'install' the EVSE on a 32A supply await devCtrl.SendCommand(1234, 0, chip.clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=bytes([b for b in range(16)]), eventTrigger=0x0099000000000000)) @@ -401,6 +399,9 @@ Now send the test event trigger to simulate the EV asking for demand: # Read the events await devCtrl.ReadEvent(1234,[(1, chip.clusters.EnergyEvse,1)]) +``` + +``` [ │ EventReadResult( │ │ Header=EventHeader( @@ -450,7 +451,7 @@ What happens when we unplug the vehicle? When we re-read the events: -```python +``` [ │ EventReadResult( │ │ Header=EventHeader( From 4d2108bec230b3f1669c4fee7747c7af1119df54 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 13:41:22 +0000 Subject: [PATCH 101/143] Improved error logging around GetEpochTS() --- .../src/EnergyEvseDelegateImpl.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 6704eda6fa0158..2b4a6e44f5fcea 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -1510,9 +1510,12 @@ void EvseSession::StartSession(int64_t chargingMeterValue, int64_t dischargingMe { /* Get Timestamp */ uint32_t chipEpoch = 0; - if (GetEpochTS(chipEpoch) != CHIP_NO_ERROR) + CHIP_ERROR err = GetEpochTS(chipEpoch); + if (err != CHIP_NO_ERROR) { - ChipLogError(AppServer, "EVSE: Failed to get timestamp when starting session"); + /* Note that the error will be also be logged inside GetErrorTS() - + * adding context here to help debugging */ + ChipLogError(AppServer, "EVSE: Unable to get current time when starting session - err:%" CHIP_ERROR_FORMAT, err.Format()); return; } mStartTime = chipEpoch; @@ -1556,9 +1559,13 @@ void EvseSession::RecalculateSessionDuration() { /* Get Timestamp */ uint32_t chipEpoch = 0; - if (GetEpochTS(chipEpoch) != CHIP_NO_ERROR) + CHIP_ERROR err = GetEpochTS(chipEpoch); + if (err != CHIP_NO_ERROR) { - ChipLogError(AppServer, "EVSE: Failed to get timestamp when updating session duration"); + /* Note that the error will be also be logged inside GetErrorTS() - + * adding context here to help debugging */ + ChipLogError(AppServer, "EVSE: Unable to get current time when updating session duration - err:%" CHIP_ERROR_FORMAT, + err.Format()); return; } From 1f16b6c3b5d64720cb9f7a824c684bfdb513d8e2 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 14:32:37 +0000 Subject: [PATCH 102/143] Made main use std::unique_ptr instead of using new/delete per PR comments. Also moved GetEVSEManufacturer declaration to header file. --- .../include/EVSEManufacturerImpl.h | 11 +++ .../src/EVSEManufacturerImpl.cpp | 3 - examples/energy-management-app/linux/main.cpp | 79 ++++++++----------- 3 files changed, 44 insertions(+), 49 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h index 01f46a9d717e19..5bf253aef81d9b 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h @@ -66,6 +66,17 @@ class EVSEManufacturer int64_t mLastDischargingEnergyMeter = 0; }; +/** @brief Helper function to return the singleton EVSEManufacturer instance + * + * This is needed by the EVSEManufacturer class to support TestEventTriggers + * which are called outside of any class context. This allows the EVSEManufacturer + * class to return the relevant Delegate instance in which to invoke the test + * events on. + * + * This function is typically found in main.cpp or wherever the singleton is created. + */ +EVSEManufacturer * GetEvseManufacturer(); + } // namespace EnergyEvse } // namespace Clusters } // namespace app diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp index 6e646a8dad42ee..da21a51cf7eb5d 100644 --- a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp @@ -25,9 +25,6 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; -/* Function prototype - this should be implemented somewhere in main.cpp or similar */ -EVSEManufacturer * GetEvseManufacturer(); - CHIP_ERROR EVSEManufacturer::Init() { /* Manufacturers should modify this to do any custom initialisation */ diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp index 83cdecbe83db15..faf7651875fa94 100644 --- a/examples/energy-management-app/linux/main.cpp +++ b/examples/energy-management-app/linux/main.cpp @@ -35,48 +35,47 @@ using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; -static EnergyEvseDelegate * gDelegate = nullptr; -static EnergyEvseManager * gInstance = nullptr; -static EVSEManufacturer * gEvseManufacturer = nullptr; +static std::unique_ptr gDelegate; +static std::unique_ptr gInstance; +static std::unique_ptr gEvseManufacturer; -EVSEManufacturer * GetEvseManufacturer() +EVSEManufacturer * EnergyEvse::GetEvseManufacturer() { - return gEvseManufacturer; + return gEvseManufacturer.get(); } void ApplicationInit() { CHIP_ERROR err; - if ((gDelegate != nullptr) || (gInstance != nullptr) || (gEvseManufacturer != nullptr)) + if (gDelegate || gInstance || gEvseManufacturer) { ChipLogError(AppServer, "EVSE Instance or Delegate, EvseManufacturer already exist."); return; } - gDelegate = new EnergyEvseDelegate(); - if (gDelegate == nullptr) + gDelegate = std::make_unique(); + if (!gDelegate) { ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseDelegate"); return; } /* Manufacturer may optionally not support all features, commands & attributes */ - gInstance = - new EnergyEvseManager(EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate, - BitMask( - EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, - EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x), - BitMask(OptionalAttributes::kSupportsUserMaximumChargingCurrent, - OptionalAttributes::kSupportsRandomizationWindow, - OptionalAttributes::kSupportsApproximateEvEfficiency), - BitMask(OptionalCommands::kSupportsStartDiagnostics)); - - if (gInstance == nullptr) + gInstance = std::make_unique( + EndpointId(ENERGY_EVSE_ENDPOINT), *gDelegate, + BitMask(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, + EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, + EnergyEvse::Feature::kV2x), + BitMask(OptionalAttributes::kSupportsUserMaximumChargingCurrent, + OptionalAttributes::kSupportsRandomizationWindow, + OptionalAttributes::kSupportsApproximateEvEfficiency), + BitMask(OptionalCommands::kSupportsStartDiagnostics)); + + if (!gInstance) { ChipLogError(AppServer, "Failed to allocate memory for EnergyEvseManager"); - delete gDelegate; - gDelegate = nullptr; + gDelegate.reset(); return; } @@ -84,22 +83,18 @@ void ApplicationInit() if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Init failed on gInstance"); - delete gInstance; - delete gDelegate; - gInstance = nullptr; - gDelegate = nullptr; + gInstance.reset(); + gDelegate.reset(); return; } /* Now create EVSEManufacturer*/ - gEvseManufacturer = new EVSEManufacturer(gInstance); - if (gEvseManufacturer == nullptr) + gEvseManufacturer = std::make_unique(gInstance.get()); + if (!gEvseManufacturer) { ChipLogError(AppServer, "Failed to allocate memory for EvseManufacturer"); - delete gInstance; - delete gDelegate; - gInstance = nullptr; - gDelegate = nullptr; + gInstance.reset(); + gDelegate.reset(); return; } @@ -108,12 +103,9 @@ void ApplicationInit() if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Init failed on gEvseManufacturer"); - delete gEvseManufacturer; - delete gInstance; - delete gDelegate; - gEvseManufacturer = nullptr; - gInstance = nullptr; - gDelegate = nullptr; + gEvseManufacturer.reset(); + gInstance.reset(); + gDelegate.reset(); return; } } @@ -123,17 +115,12 @@ void ApplicationShutdown() ChipLogDetail(AppServer, "Energy Management App: ApplicationShutdown()"); /* Shutdown the EVSEManufacturer*/ - gEvseManufacturer->Shutdown(); + if (gEvseManufacturer) + gEvseManufacturer->Shutdown(); /* Shutdown the Instance - deregister attribute & command handler */ - gInstance->Shutdown(); - - delete gEvseManufacturer; - delete gInstance; - delete gDelegate; - gEvseManufacturer = nullptr; - gInstance = nullptr; - gDelegate = nullptr; + if (gInstance) + gInstance->Shutdown(); } int main(int argc, char * argv[]) From 13f16a87259f6c3579c8e3fe8ba95337c8c12644 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 16:41:36 +0000 Subject: [PATCH 103/143] Fixing MISSPELL issues in README.md --- .github/.wordlist.txt | 2 + .../energy-management-app/linux/README.md | 44 ++++++++++--------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 44470a612f42c7..07f3df6b7a9822 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -519,8 +519,10 @@ EthyleneOxideConcentrationMeasurement EvalCode EvalCodeWithName EvalFrameDefault +EV EVB evk +EVSE exceptfds ExchangeContext exe diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md index fbf2e83d730970..be4e265e45b37d 100644 --- a/examples/energy-management-app/linux/README.md +++ b/examples/energy-management-app/linux/README.md @@ -17,7 +17,7 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** - [Running the Complete Example on Raspberry Pi 4](#running-the-complete-example-on-raspberry-pi-4) - [Running RPC Console](#running-rpc-console) - [Device Tracing](#device-tracing) - - [Python TestCases](#python-testcases) + - [Python Test Cases](#python-test-cases) - [Running the test cases:](#running-the-test-cases) - [CHIP-REPL Interaction](#chip-repl-interaction) - [Building chip-repl:](#building-chip-repl) @@ -149,7 +149,7 @@ Obtain tracing json file. -o {OUTPUT_FILE} -t {ELF_FILE} {PIGWEED_REPO}/pw_trace_tokenized/pw_trace_protos/trace_rpc.proto ``` -## Python TestCases +## Python Test Cases When you want to test this cluster you can use chip-repl or chip-tool by hand. CHIP-REPL is slightly easier to interact with when dealing with some of the @@ -158,20 +158,20 @@ complex structures. There are several test scripts provided for EVSE (in [src/python_testing](src/python_testing)): -- TC_EEVSE_2_2: This validates the primary functionality -- TC_EEVSE_2_3: This validates Get/Set/Clear target commands -- TC_EEVSE_2_4: This validates Faults -- TC_EEVSE_2_5: This validates EVSE diagnostic command (optional) +- `TC_EEVSE_2_2`: This validates the primary functionality +- `TC_EEVSE_2_3`: This validates Get/Set/Clear target commands +- `TC_EEVSE_2_4`: This validates Faults +- `TC_EEVSE_2_5`: This validates EVSE diagnostic command (optional) -These scripts require the use of TestEventsTriggers via the GeneralDiagnostics -cluster on Endpoint 0. This requires an enableKey (16 bytes) and a set of -reserved int64_t TestEvent trigger codes. +These scripts require the use of Test Event Triggers via the GeneralDiagnostics +cluster on Endpoint 0. This requires an `enableKey` (16 bytes) and a set of +reserved int64_t test event trigger codes. By default the test event support is not enabled, and when compiling the example app you need to add `chip_enable_energy_evse_trigger=true` to the gn args. $ gn gen out/debug - $ ninja -C out/debug --args='chip_enable_energy_evse_trigger=true` + $ ninja -C out/debug --args='chip_enable_energy_evse_trigger=true' Once the application is built you also need to tell it at runtime what the chosen enable key is using the `--enable-key` command line option. @@ -292,10 +292,11 @@ Out[2]: subscription = await devCtrl.ReadAttribute(1234,[(1, chip.clusters.EnergyEvse)], reportInterval=reportingTimingParams) ``` -- Step 6: Send an EnableCharging command which lasts for 60 seconds The - EnableCharging takes an optional parameter which allows the charger to - automatically disable itself at some preset time in the future. Note that it - uses Epoch_s (which is from Jan 1 2000) which is a uint32_t in seconds. +- Step 6: Send an `EnableCharging` command which lasts for 60 seconds The + `EnableCharging` takes an optional `chargingEnabledUntil` parameter which + allows the charger to automatically disable itself at some preset time in + the future. Note that it uses Epoch_s (which is from Jan 1 2000) which is a + uint32_t in seconds. ```python from datetime import datetime, timezone, timedelta @@ -369,7 +370,7 @@ The test event triggers values can be found in: - 0x0099000000000000 - Simulates the EVSE being installed on a 32A supply - 0x0099000000000002 - Simulates the EVSE being plugged in (this should - generate an EVConnected event) + generate an `EVConnected` event) - 0x0099000000000004 - Simulates the EVSE requesting power To send a test event trigger to the app, use the following commands (in @@ -384,7 +385,7 @@ chip-repl): ``` -Now send the enable charging command (omit the chargingEnabledUntil arg this +Now send the enable charging command (omit the `chargingEnabledUntil` arg this time): ```python @@ -440,7 +441,7 @@ Now send the test event trigger to simulate the EV asking for demand: - We can see that the `EventNumber 65538` was sent when the vehicle was plugged in, and a new `sessionID=0` was created. -- We can also see that the EnergyTransferStarted was sent in +- We can also see that the `EnergyTransferStarted` was sent in `EventNumber 65539` What happens when we unplug the vehicle? @@ -494,13 +495,14 @@ When we re-read the events: ``` -- In `EventNumber 65540` we had an EnergyTransferStopped event with reason +- In `EventNumber 65540` we had an `EnergyTransferStopped` event with reason `kOther`. This was a rather abrupt end to a charging session (normally we would see the EVSE or EV decide to stop charging), but this demonstrates the cable being pulled out without a graceful charging shutdown. -- In `EventNumber 65541` we had an EvNotDetected event showing that the state - was `kPluggedInCharging` prior to the EV being not detected (normally in a - graceful shutdown this would be `kPluggedInNoDemand` or `kPluggedInDemand`). +- In `EventNumber 65541` we had an `EvNotDetected` event showing that the + state was `kPluggedInCharging` prior to the EV being not detected (normally + in a graceful shutdown this would be `kPluggedInNoDemand` or + `kPluggedInDemand`). From 0d64694c7d63aad41e53e25513883cb52690267d Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 22:36:27 +0000 Subject: [PATCH 104/143] Small change missed in main.cpp missed in unique_ptr change. --- examples/energy-management-app/linux/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/energy-management-app/linux/main.cpp b/examples/energy-management-app/linux/main.cpp index 093b35df3a774a..23ec97e267f45d 100644 --- a/examples/energy-management-app/linux/main.cpp +++ b/examples/energy-management-app/linux/main.cpp @@ -201,7 +201,7 @@ CHIP_ERROR EVSEManufacturerInit() { CHIP_ERROR err; - if (gEvseManufacturer != nullptr) + if (gEvseManufacturer) { ChipLogError(AppServer, "EvseManufacturer already exist."); return CHIP_ERROR_INCORRECT_STATE; From 1aed9757b19743ee0c26db6f52c4a2d4f8c559d4 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 22:51:58 +0000 Subject: [PATCH 105/143] Changed all-clusters app stubs to use unique_ptr style instead of new/delete. --- .../src/device-energy-management-stub.cpp | 25 +++++++--------- .../src/energy-evse-stub.cpp | 29 ++++++++++--------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp index 87758953441827..f06f1af2ca90e2 100644 --- a/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp @@ -23,8 +23,8 @@ using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::DeviceEnergyManagement; -static DeviceEnergyManagementDelegate * gDelegate = nullptr; -static DeviceEnergyManagementManager * gInstance = nullptr; +static std::unique_ptr gDelegate; +static std::unique_ptr gInstance; void emberAfDeviceEnergyManagementClusterInitCallback(chip::EndpointId endpointId) { @@ -33,21 +33,21 @@ void emberAfDeviceEnergyManagementClusterInitCallback(chip::EndpointId endpointI CHIP_ERROR err; - if ((gDelegate != nullptr) || (gInstance != nullptr)) + if (gDelegate || gInstance) { ChipLogError(AppServer, "DEM Instance or Delegate already exist."); return; } - gDelegate = new DeviceEnergyManagementDelegate(); - if (gDelegate == nullptr) + gDelegate = std::make_unique(); + if (!gDelegate) { ChipLogError(AppServer, "Failed to allocate memory for DeviceEnergyManagementDelegate"); return; } /* Manufacturer may optionally not support all features, commands & attributes */ - gInstance = new DeviceEnergyManagementManager( + gInstance = std::make_unique( endpointId, *gDelegate, BitMask( DeviceEnergyManagement::Feature::kPowerForecastReporting, DeviceEnergyManagement::Feature::kStateForecastReporting, @@ -55,11 +55,10 @@ void emberAfDeviceEnergyManagementClusterInitCallback(chip::EndpointId endpointI BitMask(OptionalCommands::kSupportsModifyForecastRequest, OptionalCommands::kSupportsRequestConstraintBasedForecast)); - if (gInstance == nullptr) + if (!gInstance) { ChipLogError(AppServer, "Failed to allocate memory for DeviceEnergyManagementManager"); - delete gDelegate; - gDelegate = nullptr; + gDelegate.reset(); return; } @@ -67,10 +66,8 @@ void emberAfDeviceEnergyManagementClusterInitCallback(chip::EndpointId endpointI if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Init failed on gInstance"); - delete gInstance; - delete gDelegate; - gInstance = nullptr; - gDelegate = nullptr; + gInstance.reset(); + gDelegate.reset(); return; } -} +} \ No newline at end of file diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp index a0773de104c187..f9983d47883852 100644 --- a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp @@ -22,25 +22,26 @@ using namespace chip; using namespace chip::app::Clusters; using namespace chip::app::Clusters::EnergyEvse; -static EnergyEvseDelegate * gDelegate = nullptr; -static EnergyEvseManager * gInstance = nullptr; +static std::unique_ptr gDelegate; +static std::unique_ptr gInstance; void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gInstance == nullptr); - gDelegate = new EnergyEvseDelegate(); - if (gDelegate != nullptr) + VerifyOrDie(!gInstance); + + gDelegate = std::make_unique(); + if (gDelegate) { - gInstance = - new EnergyEvseManager(endpointId, *gDelegate, - BitMask( - EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, - EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, EnergyEvse::Feature::kV2x), - BitMask(OptionalAttributes::kSupportsUserMaximumChargingCurrent, - OptionalAttributes::kSupportsRandomizationWindow, - OptionalAttributes::kSupportsApproximateEvEfficiency), - BitMask(OptionalCommands::kSupportsStartDiagnostics)); + gInstance = std::make_unique( + endpointId, *gDelegate, + BitMask(EnergyEvse::Feature::kChargingPreferences, EnergyEvse::Feature::kPlugAndCharge, + EnergyEvse::Feature::kRfid, EnergyEvse::Feature::kSoCReporting, + EnergyEvse::Feature::kV2x), + BitMask(OptionalAttributes::kSupportsUserMaximumChargingCurrent, + OptionalAttributes::kSupportsRandomizationWindow, + OptionalAttributes::kSupportsApproximateEvEfficiency), + BitMask(OptionalCommands::kSupportsStartDiagnostics)); gInstance->Init(); /* Register Attribute & Command handlers */ } From 304cec11df23ae8336523cda975ca4fc3eafb600 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 22:58:19 +0000 Subject: [PATCH 106/143] Removed unhelpful comment --- .../device-energy-management-server.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.h b/src/app/clusters/device-energy-management-server/device-energy-management-server.h index ce9641104e5db4..7ab6a8aa60f306 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.h +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.h @@ -37,10 +37,6 @@ using namespace chip::app::Clusters::DeviceEnergyManagement::Attributes; using chip::Protocols::InteractionModel::Status; -/** - * @brief Defines methods for implementing application-specific logic for this Cluster. - * - */ class Delegate { public: From e2c9b65b0dc52d68d7de4fc62edbc6e36b543386 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 13 Jan 2024 22:58:41 +0000 Subject: [PATCH 107/143] Restyled by whitespace --- .../all-clusters-common/src/device-energy-management-stub.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp index f06f1af2ca90e2..385c1cfa43c8ee 100644 --- a/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp @@ -70,4 +70,4 @@ void emberAfDeviceEnergyManagementClusterInitCallback(chip::EndpointId endpointI gDelegate.reset(); return; } -} \ No newline at end of file +} From a1b379e79740c930175757c905ffe55b0227d032 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 23:46:26 +0000 Subject: [PATCH 108/143] Fixes #31061 Updated DEVICE_TYPE to 0x050C now this has been allocated --- .../linux/include/CHIPProjectAppConfig.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h index f22628d0f69def..e091fa9cf7c91c 100644 --- a/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h +++ b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h @@ -32,15 +32,13 @@ #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 0 -// Bulbs do not typically use this - enabled so we can use shell to discover commissioners #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1 -// TODO We don’t have one yet - but we’d need to change this -#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 257 // 0x0101 = 257 = Dimmable Bulb +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x050C // Energy EVSE #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_NAME 1 From 8788e1f2f4e59626676e6e85a0d435df7b51e6c8 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sat, 13 Jan 2024 23:46:26 +0000 Subject: [PATCH 109/143] Fixes #31061 Updated DEVICE_TYPE to 0x050C now this has been allocated --- .../linux/include/CHIPProjectAppConfig.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h index f22628d0f69def..e091fa9cf7c91c 100644 --- a/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h +++ b/examples/energy-management-app/linux/include/CHIPProjectAppConfig.h @@ -32,15 +32,13 @@ #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 0 -// Bulbs do not typically use this - enabled so we can use shell to discover commissioners #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1 -// TODO We don’t have one yet - but we’d need to change this -#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 257 // 0x0101 = 257 = Dimmable Bulb +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x050C // Energy EVSE #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_NAME 1 From c0626e5ef65d6697173fefecaafe48199d1ddbf1 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 00:23:03 +0000 Subject: [PATCH 110/143] Updated energy-evse-cluster.xml to use latest EnergyEVSE.adoc which removes numberOfWeeklyTargets, numberOfDailyTargets, and adds new ChargingTargetScheduleStruct in Get/Set/Clear Target commands --- .../all-clusters-app.matter | 21 +- .../all-clusters-common/all-clusters-app.zap | 54 +--- .../energy-management-app.matter | 21 +- .../energy-management-app.zap | 32 --- .../include/EnergyEvseDelegateImpl.h | 4 - .../src/EnergyEvseDelegateImpl.cpp | 8 - .../energy-evse-server/energy-evse-server.cpp | 4 - .../energy-evse-server/energy-evse-server.h | 7 +- .../data-model/chip/energy-evse-cluster.xml | 111 ++++---- .../data_model/controller-clusters.matter | 19 +- .../chip/devicecontroller/ChipClusters.java | 89 +------ .../chip/devicecontroller/ChipStructs.java | 61 +++++ .../devicecontroller/ClusterIDMapping.java | 21 +- .../devicecontroller/ClusterInfoMapping.java | 21 +- .../devicecontroller/ClusterReadMapping.java | 22 -- .../chip/devicecontroller/cluster/files.gni | 1 + .../cluster/clusters/EnergyEvseCluster.kt | 235 ++--------------- .../java/matter/controller/cluster/files.gni | 1 + .../CHIPAttributeTLVValueDecoder.cpp | 32 --- .../zap-generated/CHIPInvokeCallbacks.cpp | 171 ++++++++----- .../python/chip/clusters/CHIPClusters.py | 16 +- .../python/chip/clusters/Objects.py | 64 ++--- .../MTRAttributeSpecifiedCheck.mm | 6 - .../MTRAttributeTLVValueDecoder.mm | 22 -- .../CHIP/zap-generated/MTRBaseClusters.h | 16 +- .../CHIP/zap-generated/MTRBaseClusters.mm | 78 +----- .../CHIP/zap-generated/MTRClusterConstants.h | 2 - .../CHIP/zap-generated/MTRClusters.h | 8 +- .../CHIP/zap-generated/MTRClusters.mm | 16 +- .../zap-generated/MTRCommandPayloadsObjc.h | 10 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 136 ++++++---- .../CHIP/zap-generated/MTRStructsObjc.h | 6 + .../CHIP/zap-generated/MTRStructsObjc.mm | 30 +++ .../zap-generated/attributes/Accessors.cpp | 62 ----- .../zap-generated/attributes/Accessors.h | 10 - .../zap-generated/cluster-objects.cpp | 71 +++--- .../zap-generated/cluster-objects.h | 78 +++--- .../app-common/zap-generated/ids/Attributes.h | 8 - .../zap-generated/cluster/Commands.h | 28 +- .../cluster/ComplexArgumentParser.cpp | 34 +++ .../cluster/ComplexArgumentParser.h | 5 + .../cluster/logging/DataModelLogger.cpp | 39 ++- .../cluster/logging/DataModelLogger.h | 3 + .../zap-generated/cluster/Commands.h | 239 +++--------------- 44 files changed, 654 insertions(+), 1268 deletions(-) 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 9c3e474946addf..132a5533a14ce4 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 @@ -3867,6 +3867,11 @@ provisional cluster EnergyEvse = 153 { optional energy_mwh addedEnergy = 2; } + struct ChargingTargetScheduleStruct { + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional ChargingTargetStruct chargingTargets[] = 1; + } + info event EVConnected = 0 { int32u sessionID = 0; } @@ -3914,8 +3919,6 @@ provisional cluster EnergyEvse = 153 { readonly attribute optional amperage_ma maximumDischargeCurrent = 8; attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; - readonly attribute optional int8u numberOfWeeklyTargets = 33; - readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; @@ -3936,8 +3939,7 @@ provisional cluster EnergyEvse = 153 { readonly attribute int16u clusterRevision = 65533; response struct GetTargetsResponse = 0 { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } request struct EnableChargingRequest { @@ -3952,12 +3954,7 @@ provisional cluster EnergyEvse = 153 { } request struct SetTargetsRequest { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; - } - - request struct GetTargetsRequest { - TargetDayOfWeekBitmap daysToReturn = 0; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } /** Allows a client to disable the EVSE from charging and discharging. */ @@ -3971,7 +3968,7 @@ provisional cluster EnergyEvse = 153 { /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; /** Allows a client to retrieve the user specified charging targets. */ - timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6; + timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; } @@ -7454,8 +7451,6 @@ endpoint 1 { callback attribute maximumDischargeCurrent default = 0; callback attribute userMaximumChargeCurrent default = 0; callback attribute randomizationDelayWindow default = 600; - callback attribute numberOfWeeklyTargets default = 0; - callback attribute numberOfDailyTargets default = 1; callback attribute nextChargeStartTime; callback attribute nextChargeTargetTime; callback attribute nextChargeRequiredEnergy; 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 0c14d72717e091..71be89cecc77ae 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": [ @@ -8427,7 +8427,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8459,7 +8459,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8475,7 +8475,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8491,7 +8491,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -8507,7 +8507,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12257,38 +12257,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "NumberOfWeeklyTargets", - "code": 33, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "NumberOfDailyTargets", - "code": 34, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NextChargeStartTime", "code": 35, 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 d48a22c42cc51e..79b2a2b46894b1 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 @@ -972,6 +972,11 @@ provisional cluster EnergyEvse = 153 { optional energy_mwh addedEnergy = 2; } + struct ChargingTargetScheduleStruct { + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional ChargingTargetStruct chargingTargets[] = 1; + } + info event EVConnected = 0 { int32u sessionID = 0; } @@ -1019,8 +1024,6 @@ provisional cluster EnergyEvse = 153 { readonly attribute optional amperage_ma maximumDischargeCurrent = 8; attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; - readonly attribute optional int8u numberOfWeeklyTargets = 33; - readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; @@ -1041,8 +1044,7 @@ provisional cluster EnergyEvse = 153 { readonly attribute int16u clusterRevision = 65533; response struct GetTargetsResponse = 0 { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } request struct EnableChargingRequest { @@ -1057,12 +1059,7 @@ provisional cluster EnergyEvse = 153 { } request struct SetTargetsRequest { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; - } - - request struct GetTargetsRequest { - TargetDayOfWeekBitmap daysToReturn = 0; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } /** Allows a client to disable the EVSE from charging and discharging. */ @@ -1076,7 +1073,7 @@ provisional cluster EnergyEvse = 153 { /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; /** Allows a client to retrieve the user specified charging targets. */ - timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6; + timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; } @@ -1308,8 +1305,6 @@ endpoint 1 { callback attribute maximumDischargeCurrent default = 0; callback attribute userMaximumChargeCurrent default = 0; callback attribute randomizationDelayWindow default = 600; - callback attribute numberOfWeeklyTargets default = 0; - callback attribute numberOfDailyTargets default = 1; callback attribute nextChargeStartTime; callback attribute nextChargeTargetTime; callback attribute nextChargeRequiredEnergy; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index 55d62101227dab..c160b35de2f7d8 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -2768,38 +2768,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "NumberOfWeeklyTargets", - "code": 33, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "NumberOfDailyTargets", - "code": 34, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NextChargeStartTime", "code": 35, diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 8cf76f1b7a29bf..e365ef4f304ba6 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -208,8 +208,6 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate CHIP_ERROR SetRandomizationDelayWindow(uint32_t) override; /* PREF attributes */ - uint8_t GetNumberOfWeeklyTargets() override; - uint8_t GetNumberOfDailyTargets() override; DataModel::Nullable GetNextChargeStartTime() override; DataModel::Nullable GetNextChargeTargetTime() override; DataModel::Nullable GetNextChargeRequiredEnergy() override; @@ -293,8 +291,6 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate int64_t mUserMaximumChargeCurrent = kDefaultUserMaximumChargeCurrent; // TODO update spec uint32_t mRandomizationDelayWindow = kDefaultRandomizationDelayWindow; /* PREF attributes */ - uint8_t mNumberOfWeeklyTargets = 0; - uint8_t mNumberOfDailyTargets = 1; DataModel::Nullable mNextChargeStartTime; DataModel::Nullable mNextChargeTargetTime; DataModel::Nullable mNextChargeRequiredEnergy; diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 2b4a6e44f5fcea..dc60d748958894 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -1374,14 +1374,6 @@ CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue) } /* PREF attributes */ -uint8_t EnergyEvseDelegate::GetNumberOfWeeklyTargets() -{ - return mNumberOfWeeklyTargets; -} -uint8_t EnergyEvseDelegate::GetNumberOfDailyTargets() -{ - return mNumberOfDailyTargets; -} DataModel::Nullable EnergyEvseDelegate::GetNextChargeStartTime() { return mNextChargeStartTime; diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp index bc07ba07eef55a..d718eb134c2f81 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp +++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp @@ -95,10 +95,6 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu /* Optional */ return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow()); /* PREF - ChargingPreferences attributes */ - case NumberOfWeeklyTargets::Id: - return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets()); - case NumberOfDailyTargets::Id: - return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets()); case NextChargeStartTime::Id: return aEncoder.Encode(mDelegate.GetNextChargeStartTime()); case NextChargeTargetTime::Id: diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h index a194551607c6f4..edac2357e97c39 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.h +++ b/src/app/clusters/energy-evse-server/energy-evse-server.h @@ -94,8 +94,6 @@ class Delegate virtual int64_t GetUserMaximumChargeCurrent() = 0; virtual uint32_t GetRandomizationDelayWindow() = 0; /* PREF attributes */ - virtual uint8_t GetNumberOfWeeklyTargets() = 0; - virtual uint8_t GetNumberOfDailyTargets() = 0; virtual DataModel::Nullable GetNextChargeStartTime() = 0; virtual DataModel::Nullable GetNextChargeTargetTime() = 0; virtual DataModel::Nullable GetNextChargeRequiredEnergy() = 0; @@ -142,9 +140,8 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface public: Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs, OptionalCommands aOptionalCmds) : - AttributeAccessInterface(MakeOptional(aEndpointId), Id), - CommandHandlerInterface(MakeOptional(aEndpointId), Id), mDelegate(aDelegate), mFeature(aFeature), - mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds) + AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), + mDelegate(aDelegate), mFeature(aFeature), mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds) { /* set the base class delegates endpointId */ mDelegate.SetEndpointId(aEndpointId); diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 2e58fb31da3f42..048f217abb7db4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -13,6 +13,7 @@ limitations under the License. --> + @@ -23,6 +24,7 @@ limitations under the License. + @@ -31,6 +33,7 @@ limitations under the License. + @@ -51,12 +54,14 @@ limitations under the License. + + @@ -67,12 +72,20 @@ limitations under the License. + - - - + + + + + + + + + + Energy EVSE Energy Management @@ -81,92 +94,97 @@ limitations under the License. true true Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. - - + - State - SupplyState - FaultState + + State + SupplyState + FaultState ChargingEnabledUntil + DischargingEnabledUntil CircuitCapacity MinimumChargeCurrent MaximumChargeCurrent + MaximumDischargeCurrent - UserMaximumChargeCurrent - - + RandomizationDelayWindow - NumberOfWeeklyTargets + - NumberOfDailyTargets + - NextChargeStartTime + + NextChargeStartTime - NextChargeTargetTime + + NextChargeTargetTime + NextChargeRequiredEnergy - NextChargeTargetSoC + + NextChargeTargetSoC - - + + ApproximateEVEfficiency - StateOfCharge + + StateOfCharge + BatteryCapacity + VehicleID SessionID SessionDuration SessionEnergyCharged + SessionEnergyDischarged - + Allows a client to disable the EVSE from charging and discharging. - - + + Allows a client to enable the EVSE to charge an EV. - - + + Allows a client to enable the EVSE to discharge an EV. - + Allows a client to put the EVSE into a self-diagnostics mode. - - - + + Allows a client to set the user specified charging targets. - - + Allows a client to retrieve the user specified charging targets. - + Allows a client to clear all stored charging targets. - - - + + The GetTargetsResponse is sent in response to the GetTargets Command. @@ -176,30 +194,30 @@ limitations under the License. EVNotDetected - + - + EnergyTransferStarted - + EnergyTransferStopped - - + + Fault - - - + + + RFID @@ -208,10 +226,11 @@ limitations under the License. - - - - + + + + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9b39b0d849af15..9fe728a6497994 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4655,6 +4655,11 @@ provisional cluster EnergyEvse = 153 { optional energy_mwh addedEnergy = 2; } + struct ChargingTargetScheduleStruct { + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional ChargingTargetStruct chargingTargets[] = 1; + } + info event EVConnected = 0 { int32u sessionID = 0; } @@ -4702,8 +4707,6 @@ provisional cluster EnergyEvse = 153 { readonly attribute optional amperage_ma maximumDischargeCurrent = 8; attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; - readonly attribute optional int8u numberOfWeeklyTargets = 33; - readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; @@ -4724,8 +4727,7 @@ provisional cluster EnergyEvse = 153 { readonly attribute int16u clusterRevision = 65533; response struct GetTargetsResponse = 0 { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } request struct EnableChargingRequest { @@ -4740,12 +4742,7 @@ provisional cluster EnergyEvse = 153 { } request struct SetTargetsRequest { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; - } - - request struct GetTargetsRequest { - TargetDayOfWeekBitmap daysToReturn = 0; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } /** Allows a client to disable the EVSE from charging and discharging. */ @@ -4759,7 +4756,7 @@ provisional cluster EnergyEvse = 153 { /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; /** Allows a client to retrieve the user specified charging targets. */ - timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6; + timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index f050f7e1428d6a..7209aeff02b6df 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -29842,8 +29842,6 @@ public static class EnergyEvseCluster extends BaseChipCluster { private static final long MAXIMUM_DISCHARGE_CURRENT_ATTRIBUTE_ID = 8L; private static final long USER_MAXIMUM_CHARGE_CURRENT_ATTRIBUTE_ID = 9L; private static final long RANDOMIZATION_DELAY_WINDOW_ATTRIBUTE_ID = 10L; - private static final long NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID = 33L; - private static final long NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID = 34L; private static final long NEXT_CHARGE_START_TIME_ATTRIBUTE_ID = 35L; private static final long NEXT_CHARGE_TARGET_TIME_ATTRIBUTE_ID = 36L; private static final long NEXT_CHARGE_REQUIRED_ENERGY_ATTRIBUTE_ID = 37L; @@ -29946,17 +29944,13 @@ public void onResponse(StructType invokeStructValue) { } - public void setTargets(DefaultClusterCallback callback, Integer dayOfWeekforSequence, ArrayList chargingTargets, int timedInvokeTimeoutMs) { + public void setTargets(DefaultClusterCallback callback, ArrayList chargingTargetSchedules, int timedInvokeTimeoutMs) { final long commandId = 5L; ArrayList elements = new ArrayList<>(); - final long dayOfWeekforSequenceFieldID = 0L; - BaseTLVType dayOfWeekforSequencetlvValue = new UIntType(dayOfWeekforSequence); - elements.add(new StructElement(dayOfWeekforSequenceFieldID, dayOfWeekforSequencetlvValue)); - - final long chargingTargetsFieldID = 1L; - BaseTLVType chargingTargetstlvValue = ArrayType.generateArrayType(chargingTargets, (elementchargingTargets) -> elementchargingTargets.encodeTlv()); - elements.add(new StructElement(chargingTargetsFieldID, chargingTargetstlvValue)); + final long chargingTargetSchedulesFieldID = 0L; + BaseTLVType chargingTargetSchedulestlvValue = ArrayType.generateArrayType(chargingTargetSchedules, (elementchargingTargetSchedules) -> elementchargingTargetSchedules.encodeTlv()); + elements.add(new StructElement(chargingTargetSchedulesFieldID, chargingTargetSchedulestlvValue)); StructType value = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @@ -29967,36 +29961,25 @@ public void onResponse(StructType invokeStructValue) { } - public void getTargets(GetTargetsResponseCallback callback, Integer daysToReturn, int timedInvokeTimeoutMs) { + public void getTargets(GetTargetsResponseCallback callback, int timedInvokeTimeoutMs) { final long commandId = 6L; ArrayList elements = new ArrayList<>(); - final long daysToReturnFieldID = 0L; - BaseTLVType daysToReturntlvValue = new UIntType(daysToReturn); - elements.add(new StructElement(daysToReturnFieldID, daysToReturntlvValue)); - StructType value = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - final long dayOfWeekforSequenceFieldID = 0L; - Integer dayOfWeekforSequence = null; - final long chargingTargetsFieldID = 1L; - ArrayList chargingTargets = null; + final long chargingTargetSchedulesFieldID = 0L; + ArrayList chargingTargetSchedules = null; for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == dayOfWeekforSequenceFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - dayOfWeekforSequence = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == chargingTargetsFieldID) { + if (element.contextTagNum() == chargingTargetSchedulesFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); - chargingTargets = castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue)); + chargingTargetSchedules = castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetScheduleStruct.decodeTlv(elementcastingValue)); } } } - callback.onSuccess(dayOfWeekforSequence, chargingTargets); + callback.onSuccess(chargingTargetSchedules); }}, commandId, value, timedInvokeTimeoutMs); } @@ -30014,7 +29997,7 @@ public void onResponse(StructType invokeStructValue) { } public interface GetTargetsResponseCallback extends BaseClusterCallback { - void onSuccess(Integer dayOfWeekforSequence, ArrayList chargingTargets); + void onSuccess(ArrayList chargingTargetSchedules); } public interface StateAttributeCallback extends BaseAttributeCallback { @@ -30386,56 +30369,6 @@ public void onSuccess(byte[] tlv) { }, RANDOMIZATION_DELAY_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readNumberOfWeeklyTargetsAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID, true); - } - - public void subscribeNumberOfWeeklyTargetsAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - } - }, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readNumberOfDailyTargetsAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID, true); - } - - public void subscribeNumberOfDailyTargetsAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - } - }, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readNextChargeStartTimeAttribute( NextChargeStartTimeAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_CHARGE_START_TIME_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 98bc3ca71303f5..2c8d1b63c311df 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7351,6 +7351,67 @@ public String toString() { return output.toString(); } } +public static class EnergyEvseClusterChargingTargetScheduleStruct { + public Optional dayOfWeekforSequence; + public Optional> chargingTargets; + private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; + private static final long CHARGING_TARGETS_ID = 1L; + + public EnergyEvseClusterChargingTargetScheduleStruct( + Optional dayOfWeekforSequence, + Optional> chargingTargets + ) { + this.dayOfWeekforSequence = dayOfWeekforSequence; + this.chargingTargets = chargingTargets; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); + values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional dayOfWeekforSequence = Optional.empty(); + Optional> chargingTargets = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + chargingTargets = Optional.of(castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue))); + } + } + } + return new EnergyEvseClusterChargingTargetScheduleStruct( + dayOfWeekforSequence, + chargingTargets + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); + output.append("\tdayOfWeekforSequence: "); + output.append(dayOfWeekforSequence); + output.append("\n"); + output.append("\tchargingTargets: "); + output.append(chargingTargets); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class EnergyPreferenceClusterBalanceStruct { public Integer step; public Optional label; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 2e712af09006a4..48a979486ad081 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -9561,8 +9561,6 @@ public enum Attribute { MaximumDischargeCurrent(8L), UserMaximumChargeCurrent(9L), RandomizationDelayWindow(10L), - NumberOfWeeklyTargets(33L), - NumberOfDailyTargets(34L), NextChargeStartTime(35L), NextChargeTargetTime(36L), NextChargeRequiredEnergy(37L), @@ -9685,7 +9683,7 @@ public static EnableDischargingCommandField value(int id) throws NoSuchFieldErro } throw new NoSuchFieldError(); } - }public enum SetTargetsCommandField {DayOfWeekforSequence(0),ChargingTargets(1),; + }public enum SetTargetsCommandField {ChargingTargetSchedules(0),; private final int id; SetTargetsCommandField(int id) { this.id = id; @@ -9702,23 +9700,6 @@ public static SetTargetsCommandField value(int id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } - }public enum GetTargetsCommandField {DaysToReturn(0),; - private final int id; - GetTargetsCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static GetTargetsCommandField value(int id) throws NoSuchFieldError { - for (GetTargetsCommandField field : GetTargetsCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 94cda4091ba5dc..8d82536cd878a5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -10479,12 +10479,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer dayOfWeekforSequence, ArrayList chargingTargets) { + public void onSuccess(ArrayList chargingTargetSchedules) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo dayOfWeekforSequenceResponseValue = new CommandResponseInfo("dayOfWeekforSequence", "Integer"); - responseValues.put(dayOfWeekforSequenceResponseValue, dayOfWeekforSequence); - // chargingTargets: ChargingTargetStruct + // chargingTargetSchedules: ChargingTargetScheduleStruct // Conversion from this type to Java is not properly implemented yet callback.onSuccess(responseValues); @@ -23303,17 +23301,12 @@ public Map> getCommandMap() { Map energyEvsesetTargetsCommandParams = new LinkedHashMap(); - CommandParameterInfo energyEvsesetTargetsdayOfWeekforSequenceCommandParameterInfo = new CommandParameterInfo("dayOfWeekforSequence", Integer.class, Integer.class); - energyEvsesetTargetsCommandParams.put("dayOfWeekforSequence",energyEvsesetTargetsdayOfWeekforSequenceCommandParameterInfo); - InteractionInfo energyEvsesetTargetsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.EnergyEvseCluster) cluster) .setTargets((DefaultClusterCallback) callback - , (Integer) - commandArguments.get("dayOfWeekforSequence") - , (ArrayList) - commandArguments.get("chargingTargets"), 10000 + , (ArrayList) + commandArguments.get("chargingTargetSchedules"), 10000 ); }, () -> new DelegatedDefaultClusterCallback(), @@ -23322,16 +23315,10 @@ public Map> getCommandMap() { energyEvseClusterInteractionInfoMap.put("setTargets", energyEvsesetTargetsInteractionInfo); Map energyEvsegetTargetsCommandParams = new LinkedHashMap(); - - CommandParameterInfo energyEvsegetTargetsdaysToReturnCommandParameterInfo = new CommandParameterInfo("daysToReturn", Integer.class, Integer.class); - energyEvsegetTargetsCommandParams.put("daysToReturn",energyEvsegetTargetsdaysToReturnCommandParameterInfo); InteractionInfo energyEvsegetTargetsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.EnergyEvseCluster) cluster) .getTargets((ChipClusters.EnergyEvseCluster.GetTargetsResponseCallback) callback - , (Integer) - commandArguments.get("daysToReturn") - , 10000); }, () -> new DelegatedEnergyEvseClusterGetTargetsResponseCallback(), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 16c71818bad11c..eb2711cd6fdde7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -9483,28 +9483,6 @@ private static Map readEnergyEvseInteractionInfo() { readEnergyEvseRandomizationDelayWindowCommandParams ); result.put("readRandomizationDelayWindowAttribute", readEnergyEvseRandomizationDelayWindowAttributeInteractionInfo); - Map readEnergyEvseNumberOfWeeklyTargetsCommandParams = new LinkedHashMap(); - InteractionInfo readEnergyEvseNumberOfWeeklyTargetsAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.EnergyEvseCluster) cluster).readNumberOfWeeklyTargetsAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readEnergyEvseNumberOfWeeklyTargetsCommandParams - ); - result.put("readNumberOfWeeklyTargetsAttribute", readEnergyEvseNumberOfWeeklyTargetsAttributeInteractionInfo); - Map readEnergyEvseNumberOfDailyTargetsCommandParams = new LinkedHashMap(); - InteractionInfo readEnergyEvseNumberOfDailyTargetsAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.EnergyEvseCluster) cluster).readNumberOfDailyTargetsAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readEnergyEvseNumberOfDailyTargetsCommandParams - ); - result.put("readNumberOfDailyTargetsAttribute", readEnergyEvseNumberOfDailyTargetsAttributeInteractionInfo); Map readEnergyEvseNextChargeStartTimeCommandParams = new LinkedHashMap(); InteractionInfo readEnergyEvseNextChargeStartTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { 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 41532a359802fa..701be9a7ebea52 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -56,6 +56,7 @@ structs_sources = [ "${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/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/EnergyPreferenceClusterBalanceStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt index c2a269e96018af..20363bff38ec5a 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt @@ -46,8 +46,7 @@ import matter.tlv.TlvWriter class EnergyEvseCluster(private val controller: MatterController, private val endpointId: UShort) { class GetTargetsResponse( - val dayOfWeekforSequence: UByte, - val chargingTargets: List + val chargingTargetSchedules: List ) class StateAttribute(val value: UByte?) @@ -345,8 +344,7 @@ class EnergyEvseCluster(private val controller: MatterController, private val en } suspend fun setTargets( - dayOfWeekforSequence: UByte, - chargingTargets: List, + chargingTargetSchedules: List, timedInvokeTimeout: Duration ) { val commandId: UInt = 5u @@ -354,12 +352,9 @@ class EnergyEvseCluster(private val controller: MatterController, private val en val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_DAY_OF_WEEKFOR_SEQUENCE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE_REQ), dayOfWeekforSequence) - - val TAG_CHARGING_TARGETS_REQ: Int = 1 - tlvWriter.startArray(ContextSpecificTag(TAG_CHARGING_TARGETS_REQ)) - for (item in chargingTargets.iterator()) { + val TAG_CHARGING_TARGET_SCHEDULES_REQ: Int = 0 + tlvWriter.startArray(ContextSpecificTag(TAG_CHARGING_TARGET_SCHEDULES_REQ)) + for (item in chargingTargetSchedules.iterator()) { item.toTlv(AnonymousTag, tlvWriter) } tlvWriter.endArray() @@ -376,14 +371,11 @@ class EnergyEvseCluster(private val controller: MatterController, private val en logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun getTargets(daysToReturn: UByte, timedInvokeTimeout: Duration): GetTargetsResponse { + suspend fun getTargets(timedInvokeTimeout: Duration): GetTargetsResponse { val commandId: UInt = 6u val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - - val TAG_DAYS_TO_RETURN_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_DAYS_TO_RETURN_REQ), daysToReturn) tlvWriter.endStructure() val request: InvokeRequest = @@ -398,25 +390,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en val tlvReader = TlvReader(response.payload) tlvReader.enterStructure(AnonymousTag) - val TAG_DAY_OF_WEEKFOR_SEQUENCE: Int = 0 - var dayOfWeekforSequence_decoded: UByte? = null - - val TAG_CHARGING_TARGETS: Int = 1 - var chargingTargets_decoded: List? = null + val TAG_CHARGING_TARGET_SCHEDULES: Int = 0 + var chargingTargetSchedules_decoded: List? = null while (!tlvReader.isEndOfContainer()) { val tag = tlvReader.peekElement().tag - if (tag == ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE)) { - dayOfWeekforSequence_decoded = tlvReader.getUByte(tag) - } - - if (tag == ContextSpecificTag(TAG_CHARGING_TARGETS)) { - chargingTargets_decoded = - buildList { + if (tag == ContextSpecificTag(TAG_CHARGING_TARGET_SCHEDULES)) { + chargingTargetSchedules_decoded = + buildList { tlvReader.enterArray(tag) while (!tlvReader.isEndOfContainer()) { - add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + add(EnergyEvseClusterChargingTargetScheduleStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } @@ -425,17 +410,13 @@ class EnergyEvseCluster(private val controller: MatterController, private val en } } - if (dayOfWeekforSequence_decoded == null) { - throw IllegalStateException("dayOfWeekforSequence not found in TLV") - } - - if (chargingTargets_decoded == null) { - throw IllegalStateException("chargingTargets not found in TLV") + if (chargingTargetSchedules_decoded == null) { + throw IllegalStateException("chargingTargetSchedules not found in TLV") } tlvReader.exitContainer() - return GetTargetsResponse(dayOfWeekforSequence_decoded, chargingTargets_decoded) + return GetTargetsResponse(chargingTargetSchedules_decoded) } suspend fun clearTargets(timedInvokeTimeout: Duration) { @@ -1523,192 +1504,6 @@ class EnergyEvseCluster(private val controller: MatterController, private val en } } - suspend fun readNumberOfWeeklyTargetsAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 33u - - 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) { "Numberofweeklytargets attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun subscribeNumberOfWeeklyTargetsAttribute( - minInterval: Int, - maxInterval: Int - ): Flow { - val ATTRIBUTE_ID: UInt = 33u - 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) { - "Numberofweeklytargets attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) - } - } - } - } - - suspend fun readNumberOfDailyTargetsAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 34u - - 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) { "Numberofdailytargets attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun subscribeNumberOfDailyTargetsAttribute( - minInterval: Int, - maxInterval: Int - ): Flow { - val ATTRIBUTE_ID: UInt = 34u - 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) { - "Numberofdailytargets attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) - } - } - } - } - suspend fun readNextChargeStartTimeAttribute(): NextChargeStartTimeAttribute { val ATTRIBUTE_ID: UInt = 35u 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 2ebed3b24f6c2c..7474e5ba2f1e8f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -56,6 +56,7 @@ matter_structs_sources = [ "${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/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/EnergyPreferenceClusterBalanceStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/FixedLabelClusterLabelStruct.kt", diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 58fb6a4bdd6646..fb6c29eead7d36 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -22811,38 +22811,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jnivalue, value); return value; } - case Attributes::NumberOfWeeklyTargets::Id: { - using TypeInfo = Attributes::NumberOfWeeklyTargets::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::NumberOfDailyTargets::Id: { - using TypeInfo = Attributes::NumberOfDailyTargets::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::NextChargeStartTime::Id: { using TypeInfo = Attributes::NextChargeStartTime::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 0611659ab41f0d..5bf21dd5f16bba 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3970,92 +3970,149 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;Ljava/util/ArrayList;)V", - &javaMethod); + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/ArrayList;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); - jobject DayOfWeekforSequence; - std::string DayOfWeekforSequenceClassName = "java/lang/Integer"; - std::string DayOfWeekforSequenceCtorSignature = "(I)V"; - jint jniDayOfWeekforSequence = static_cast(dataResponse.dayOfWeekforSequence.Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject(DayOfWeekforSequenceClassName.c_str(), - DayOfWeekforSequenceCtorSignature.c_str(), jniDayOfWeekforSequence, - DayOfWeekforSequence); - jobject ChargingTargets; - chip::JniReferences::GetInstance().CreateArrayList(ChargingTargets); + jobject ChargingTargetSchedules; + chip::JniReferences::GetInstance().CreateArrayList(ChargingTargetSchedules); - auto iter_ChargingTargets_0 = dataResponse.chargingTargets.begin(); - while (iter_ChargingTargets_0.Next()) + auto iter_ChargingTargetSchedules_0 = dataResponse.chargingTargetSchedules.begin(); + while (iter_ChargingTargetSchedules_0.Next()) { - auto & entry_0 = iter_ChargingTargets_0.GetValue(); + auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_targetTimeMinutesPastMidnight; - std::string newElement_0_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; - std::string newElement_0_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; - jint jninewElement_0_targetTimeMinutesPastMidnight = static_cast(entry_0.targetTimeMinutesPastMidnight); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_targetTimeMinutesPastMidnightClassName.c_str(), - newElement_0_targetTimeMinutesPastMidnightCtorSignature.c_str(), - jninewElement_0_targetTimeMinutesPastMidnight, - newElement_0_targetTimeMinutesPastMidnight); - jobject newElement_0_targetSoC; - if (!entry_0.targetSoC.HasValue()) + jobject newElement_0_dayOfWeekforSequence; + if (!entry_0.dayOfWeekforSequence.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_targetSoC); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); } else { - jobject newElement_0_targetSoCInsideOptional; - std::string newElement_0_targetSoCInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_targetSoCInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_targetSoCInsideOptional = static_cast(entry_0.targetSoC.Value()); + jobject newElement_0_dayOfWeekforSequenceInsideOptional; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_targetSoCInsideOptionalClassName.c_str(), newElement_0_targetSoCInsideOptionalCtorSignature.c_str(), - jninewElement_0_targetSoCInsideOptional, newElement_0_targetSoCInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_targetSoCInsideOptional, newElement_0_targetSoC); + newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), + newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), + jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, + newElement_0_dayOfWeekforSequence); } - jobject newElement_0_addedEnergy; - if (!entry_0.addedEnergy.HasValue()) + jobject newElement_0_chargingTargets; + if (!entry_0.chargingTargets.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_addedEnergy); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_chargingTargets); } else { - jobject newElement_0_addedEnergyInsideOptional; - std::string newElement_0_addedEnergyInsideOptionalClassName = "java/lang/Long"; - std::string newElement_0_addedEnergyInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_0_addedEnergyInsideOptional = static_cast(entry_0.addedEnergy.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_addedEnergyInsideOptionalClassName.c_str(), - newElement_0_addedEnergyInsideOptionalCtorSignature.c_str(), - jninewElement_0_addedEnergyInsideOptional, - newElement_0_addedEnergyInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_addedEnergyInsideOptional, newElement_0_addedEnergy); + jobject newElement_0_chargingTargetsInsideOptional; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_chargingTargetsInsideOptional); + + auto iter_newElement_0_chargingTargetsInsideOptional_3 = entry_0.chargingTargets.Value().begin(); + while (iter_newElement_0_chargingTargetsInsideOptional_3.Next()) + { + auto & entry_3 = iter_newElement_0_chargingTargetsInsideOptional_3.GetValue(); + jobject newElement_3; + jobject newElement_3_targetTimeMinutesPastMidnight; + std::string newElement_3_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; + std::string newElement_3_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; + jint jninewElement_3_targetTimeMinutesPastMidnight = static_cast(entry_3.targetTimeMinutesPastMidnight); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_targetTimeMinutesPastMidnightClassName.c_str(), + newElement_3_targetTimeMinutesPastMidnightCtorSignature.c_str(), jninewElement_3_targetTimeMinutesPastMidnight, + newElement_3_targetTimeMinutesPastMidnight); + jobject newElement_3_targetSoC; + if (!entry_3.targetSoC.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_targetSoC); + } + else + { + jobject newElement_3_targetSoCInsideOptional; + std::string newElement_3_targetSoCInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_3_targetSoCInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_3_targetSoCInsideOptional = static_cast(entry_3.targetSoC.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_targetSoCInsideOptionalClassName.c_str(), + newElement_3_targetSoCInsideOptionalCtorSignature.c_str(), jninewElement_3_targetSoCInsideOptional, + newElement_3_targetSoCInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_targetSoCInsideOptional, newElement_3_targetSoC); + } + jobject newElement_3_addedEnergy; + if (!entry_3.addedEnergy.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_addedEnergy); + } + else + { + jobject newElement_3_addedEnergyInsideOptional; + std::string newElement_3_addedEnergyInsideOptionalClassName = "java/lang/Long"; + std::string newElement_3_addedEnergyInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_3_addedEnergyInsideOptional = static_cast(entry_3.addedEnergy.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_addedEnergyInsideOptionalClassName.c_str(), + newElement_3_addedEnergyInsideOptionalCtorSignature.c_str(), jninewElement_3_addedEnergyInsideOptional, + newElement_3_addedEnergyInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_addedEnergyInsideOptional, + newElement_3_addedEnergy); + } + + jclass chargingTargetStructStructClass_4; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", + chargingTargetStructStructClass_4); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); + return; + } + + jmethodID chargingTargetStructStructCtor_4; + err = chip::JniReferences::GetInstance().FindMethod( + env, chargingTargetStructStructClass_4, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", &chargingTargetStructStructCtor_4); + if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_4 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); + return; + } + + newElement_3 = + env->NewObject(chargingTargetStructStructClass_4, chargingTargetStructStructCtor_4, + newElement_3_targetTimeMinutesPastMidnight, newElement_3_targetSoC, newElement_3_addedEnergy); + chip::JniReferences::GetInstance().AddToList(newElement_0_chargingTargetsInsideOptional, newElement_3); + } + chip::JniReferences::GetInstance().CreateOptional(newElement_0_chargingTargetsInsideOptional, + newElement_0_chargingTargets); } - jclass chargingTargetStructStructClass_1; + jclass chargingTargetScheduleStructStructClass_1; err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", chargingTargetStructStructClass_1); + env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetScheduleStruct", + chargingTargetScheduleStructStructClass_1); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetScheduleStruct"); return; } - jmethodID chargingTargetStructStructCtor_1; - err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetStructStructClass_1, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", - &chargingTargetStructStructCtor_1); - if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_1 == nullptr) + jmethodID chargingTargetScheduleStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetScheduleStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;)V", + &chargingTargetScheduleStructStructCtor_1); + if (err != CHIP_NO_ERROR || chargingTargetScheduleStructStructCtor_1 == nullptr) { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); + ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetScheduleStruct constructor"); return; } - newElement_0 = env->NewObject(chargingTargetStructStructClass_1, chargingTargetStructStructCtor_1, - newElement_0_targetTimeMinutesPastMidnight, newElement_0_targetSoC, newElement_0_addedEnergy); - chip::JniReferences::GetInstance().AddToList(ChargingTargets, newElement_0); + newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, + newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); + chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } - env->CallVoidMethod(javaCallbackRef, javaMethod, DayOfWeekforSequence, ChargingTargets); + env->CallVoidMethod(javaCallbackRef, javaMethod, ChargingTargetSchedules); } CHIPDoorLockClusterGetWeekDayScheduleResponseCallback::CHIPDoorLockClusterGetWeekDayScheduleResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 7954593df97171..33f0a722a13d97 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -6749,15 +6749,13 @@ class ChipClusters: "commandId": 0x00000005, "commandName": "SetTargets", "args": { - "dayOfWeekforSequence": "int", - "chargingTargets": "ChargingTargetStruct", + "chargingTargetSchedules": "ChargingTargetScheduleStruct", }, }, 0x00000006: { "commandId": 0x00000006, "commandName": "GetTargets", "args": { - "daysToReturn": "int", }, }, 0x00000007: { @@ -6836,18 +6834,6 @@ class ChipClusters: "reportable": True, "writable": True, }, - 0x00000021: { - "attributeName": "NumberOfWeeklyTargets", - "attributeId": 0x00000021, - "type": "int", - "reportable": True, - }, - 0x00000022: { - "attributeName": "NumberOfDailyTargets", - "attributeId": 0x00000022, - "type": "int", - "reportable": True, - }, 0x00000023: { "attributeName": "NextChargeStartTime", "attributeId": 0x00000023, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index ecc9b63039e8bc..622fc30523abf3 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -23913,8 +23913,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="maximumDischargeCurrent", Tag=0x00000008, Type=typing.Optional[int]), ClusterObjectFieldDescriptor(Label="userMaximumChargeCurrent", Tag=0x00000009, Type=typing.Optional[int]), ClusterObjectFieldDescriptor(Label="randomizationDelayWindow", Tag=0x0000000A, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="numberOfWeeklyTargets", Tag=0x00000021, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="numberOfDailyTargets", Tag=0x00000022, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="nextChargeStartTime", Tag=0x00000023, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="nextChargeTargetTime", Tag=0x00000024, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="nextChargeRequiredEnergy", Tag=0x00000025, Type=typing.Union[None, Nullable, int]), @@ -23946,8 +23944,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: maximumDischargeCurrent: 'typing.Optional[int]' = None userMaximumChargeCurrent: 'typing.Optional[int]' = None randomizationDelayWindow: 'typing.Optional[uint]' = None - numberOfWeeklyTargets: 'typing.Optional[uint]' = None - numberOfDailyTargets: 'typing.Optional[uint]' = None nextChargeStartTime: 'typing.Union[None, Nullable, uint]' = None nextChargeTargetTime: 'typing.Union[None, Nullable, uint]' = None nextChargeRequiredEnergy: 'typing.Union[None, Nullable, int]' = None @@ -24061,6 +24057,19 @@ def descriptor(cls) -> ClusterObjectDescriptor: targetSoC: 'typing.Optional[uint]' = None addedEnergy: 'typing.Optional[int]' = None + @dataclass + class ChargingTargetScheduleStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), + ]) + + dayOfWeekforSequence: 'typing.Optional[uint]' = None + chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None + class Commands: @dataclass class GetTargetsResponse(ClusterCommand): @@ -24073,12 +24082,10 @@ class GetTargetsResponse(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.List[EnergyEvse.Structs.ChargingTargetStruct]), + ClusterObjectFieldDescriptor(Label="chargingTargetSchedules", Tag=0, Type=typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]), ]) - dayOfWeekforSequence: 'uint' = 0 - chargingTargets: 'typing.List[EnergyEvse.Structs.ChargingTargetStruct]' = field(default_factory=lambda: []) + chargingTargetSchedules: 'typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]' = field(default_factory=lambda: []) @dataclass class Disable(ClusterCommand): @@ -24171,16 +24178,14 @@ class SetTargets(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.List[EnergyEvse.Structs.ChargingTargetStruct]), + ClusterObjectFieldDescriptor(Label="chargingTargetSchedules", Tag=0, Type=typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]), ]) @ChipUtility.classproperty def must_use_timed_invoke(cls) -> bool: return True - dayOfWeekforSequence: 'uint' = 0 - chargingTargets: 'typing.List[EnergyEvse.Structs.ChargingTargetStruct]' = field(default_factory=lambda: []) + chargingTargetSchedules: 'typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]' = field(default_factory=lambda: []) @dataclass class GetTargets(ClusterCommand): @@ -24193,15 +24198,12 @@ class GetTargets(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="daysToReturn", Tag=0, Type=uint), ]) @ChipUtility.classproperty def must_use_timed_invoke(cls) -> bool: return True - daysToReturn: 'uint' = 0 - @dataclass class ClearTargets(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000099 @@ -24396,38 +24398,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[uint]' = None - @dataclass - class NumberOfWeeklyTargets(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000099 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000021 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - - value: 'typing.Optional[uint]' = None - - @dataclass - class NumberOfDailyTargets(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000099 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000022 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - - value: 'typing.Optional[uint]' = None - @dataclass class NextChargeStartTime(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index b8c6f1a59ac4bb..24bc13b1a4698a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -3111,12 +3111,6 @@ static BOOL AttributeIsSpecifiedInEnergyEVSECluster(AttributeId aAttributeId) case Attributes::RandomizationDelayWindow::Id: { return YES; } - case Attributes::NumberOfWeeklyTargets::Id: { - return YES; - } - case Attributes::NumberOfDailyTargets::Id: { - return YES; - } case Attributes::NextChargeStartTime::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 20633dafe53b0c..5825f1d904acbb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -8620,28 +8620,6 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib value = [NSNumber numberWithUnsignedInt:cppValue]; return value; } - case Attributes::NumberOfWeeklyTargets::Id: { - using TypeInfo = Attributes::NumberOfWeeklyTargets::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::NumberOfDailyTargets::Id: { - using TypeInfo = Attributes::NumberOfDailyTargets::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::NextChargeStartTime::Id: { using TypeInfo = Attributes::NextChargeStartTime::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 7271543d1242db..ba967eb9bb5009 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -7702,7 +7702,9 @@ MTR_PROVISIONALLY_AVAILABLE * * Allows a client to retrieve the user specified charging targets. */ -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithCompletion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion + MTR_PROVISIONALLY_AVAILABLE; /** * Command ClearTargets * @@ -7782,18 +7784,6 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeRandomizationDelayWindowWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeNumberOfWeeklyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeNumberOfWeeklyTargetsWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeNumberOfWeeklyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - -- (void)readAttributeNumberOfDailyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeNumberOfDailyTargetsWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeNumberOfDailyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeNextChargeStartTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeNextChargeStartTimeWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index c91da32da25ad3..2614e0ef5d9090 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -52332,7 +52332,11 @@ - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params comp queue:self.callbackQueue completion:responseHandler]; } -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)getTargetsWithCompletion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self getTargetsWithParams:nil completion:completion]; +} +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { params = [[MTREnergyEVSEClusterGetTargetsParams @@ -52843,78 +52847,6 @@ + (void)readAttributeRandomizationDelayWindowWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeNumberOfWeeklyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfWeeklyTargets::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeNumberOfWeeklyTargetsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfWeeklyTargets::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeNumberOfWeeklyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfWeeklyTargets::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeNumberOfDailyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfDailyTargets::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeNumberOfDailyTargetsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfDailyTargets::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeNumberOfDailyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfDailyTargets::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - - (void)readAttributeNextChargeStartTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 7c46f6315692cb..159a0f0a14b267 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -2669,8 +2669,6 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterEnergyEVSEAttributeMaximumDischargeCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, MTRAttributeIDTypeClusterEnergyEVSEAttributeUserMaximumChargeCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, MTRAttributeIDTypeClusterEnergyEVSEAttributeRandomizationDelayWindowID MTR_PROVISIONALLY_AVAILABLE = 0x0000000A, - MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfWeeklyTargetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000021, - MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfDailyTargetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000022, MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeStartTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000023, MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeTargetTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000024, MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeRequiredEnergyID MTR_PROVISIONALLY_AVAILABLE = 0x00000025, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 605c522bb489c1..a4900af82bb2fa 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3632,7 +3632,9 @@ MTR_PROVISIONALLY_AVAILABLE - (void)startDiagnosticsWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion + MTR_PROVISIONALLY_AVAILABLE; - (void)clearTargetsWithParams:(MTREnergyEVSEClusterClearTargetsParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)clearTargetsWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; @@ -3663,10 +3665,6 @@ MTR_PROVISIONALLY_AVAILABLE - (void)writeAttributeRandomizationDelayWindowWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeRandomizationDelayWindowWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeNumberOfWeeklyTargetsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - -- (NSDictionary * _Nullable)readAttributeNumberOfDailyTargetsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeNextChargeStartTimeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeNextChargeTargetTimeWithParams:(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 ae9159d82900a2..2976a21948aa6c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -9997,7 +9997,11 @@ - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params expe completion:responseHandler]; } -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)getTargetsWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self getTargetsWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { params = [[MTREnergyEVSEClusterGetTargetsParams @@ -10138,16 +10142,6 @@ - (void)writeAttributeRandomizationDelayWindowWithValue:(NSDictionary * _Nullable)readAttributeNumberOfWeeklyTargetsWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeEnergyEVSEID) attributeID:@(MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfWeeklyTargetsID) params:params]; -} - -- (NSDictionary * _Nullable)readAttributeNumberOfDailyTargetsWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeEnergyEVSEID) attributeID:@(MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfDailyTargetsID) params:params]; -} - - (NSDictionary * _Nullable)readAttributeNextChargeStartTimeWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeEnergyEVSEID) attributeID:@(MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeStartTimeID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 5f90f0d869be60..a98329f02b5a38 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -6078,9 +6078,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterGetTargetsResponseParams : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; - -@property (nonatomic, copy) NSArray * _Nonnull chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull chargingTargetSchedules MTR_PROVISIONALLY_AVAILABLE; /** * Initialize an MTREnergyEVSEClusterGetTargetsResponseParams with a response-value dictionary @@ -6221,9 +6219,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterSetTargetsParams : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; - -@property (nonatomic, copy) NSArray * _Nonnull chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull chargingTargetSchedules MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -6252,8 +6248,6 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterGetTargetsParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull daysToReturn MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 4090cfe1b4ed09..6994220b206bfd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16835,9 +16835,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = @(0); - - _chargingTargets = [NSArray array]; + _chargingTargetSchedules = [NSArray array]; } return self; } @@ -16846,15 +16844,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTREnergyEVSEClusterGetTargetsResponseParams alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; - other.chargingTargets = self.chargingTargets; + other.chargingTargetSchedules = self.chargingTargetSchedules; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: chargingTargetSchedules:%@; >", NSStringFromClass([self class]), _chargingTargetSchedules]; return descriptionString; } @@ -16904,27 +16901,48 @@ @implementation MTREnergyEVSEClusterGetTargetsResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEvse::Commands::GetTargetsResponse::DecodableType &)decodableStruct { - { - self.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:decodableStruct.dayOfWeekforSequence.Raw()]; - } { { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; - auto iter_0 = decodableStruct.chargingTargets.begin(); + auto iter_0 = decodableStruct.chargingTargetSchedules.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTREnergyEVSEClusterChargingTargetStruct * newElement_0; - newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight]; - if (entry_0.targetSoC.HasValue()) { - newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()]; + MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; + newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.targetSoC = nil; + newElement_0.dayOfWeekforSequence = nil; } - if (entry_0.addedEnergy.HasValue()) { - newElement_0.addedEnergy = [NSNumber numberWithLongLong:entry_0.addedEnergy.Value()]; + if (entry_0.chargingTargets.HasValue()) { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_0.chargingTargets.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + MTREnergyEVSEClusterChargingTargetStruct * newElement_3; + newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; + if (entry_3.targetSoC.HasValue()) { + newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; + } else { + newElement_3.targetSoC = nil; + } + if (entry_3.addedEnergy.HasValue()) { + newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; + } else { + newElement_3.addedEnergy = nil; + } + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + return err; + } + newElement_0.chargingTargets = array_3; + } } else { - newElement_0.addedEnergy = nil; + newElement_0.chargingTargets = nil; } [array_0 addObject:newElement_0]; } @@ -16932,7 +16950,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv if (err != CHIP_NO_ERROR) { return err; } - self.chargingTargets = array_0; + self.chargingTargetSchedules = array_0; } } return CHIP_NO_ERROR; @@ -17277,9 +17295,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = @(0); - - _chargingTargets = [NSArray array]; + _chargingTargetSchedules = [NSArray array]; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -17290,8 +17306,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTREnergyEVSEClusterSetTargetsParams alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; - other.chargingTargets = self.chargingTargets; + other.chargingTargetSchedules = self.chargingTargetSchedules; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -17300,7 +17315,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: chargingTargetSchedules:%@; >", NSStringFromClass([self class]), _chargingTargetSchedules]; return descriptionString; } @@ -17312,38 +17327,63 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { chip::app::Clusters::EnergyEvse::Commands::SetTargets::Type encodableStruct; ListFreer listFreer; - { - encodableStruct.dayOfWeekforSequence = static_cast>(self.dayOfWeekforSequence.unsignedCharValue); - } { { - using ListType_0 = std::remove_reference_t; + using ListType_0 = std::remove_reference_t; using ListMemberType_0 = ListMemberTypeGetter::Type; - if (self.chargingTargets.count != 0) { - auto * listHolder_0 = new ListHolder(self.chargingTargets.count); + if (self.chargingTargetSchedules.count != 0) { + auto * listHolder_0 = new ListHolder(self.chargingTargetSchedules.count); if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { return CHIP_ERROR_INVALID_ARGUMENT; } listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < self.chargingTargets.count; ++i_0) { - if (![self.chargingTargets[i_0] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { + for (size_t i_0 = 0; i_0 < self.chargingTargetSchedules.count; ++i_0) { + if (![self.chargingTargetSchedules[i_0] isKindOfClass:[MTREnergyEVSEClusterChargingTargetScheduleStruct class]]) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_0 = (MTREnergyEVSEClusterChargingTargetStruct *) self.chargingTargets[i_0]; - listHolder_0->mList[i_0].targetTimeMinutesPastMidnight = element_0.targetTimeMinutesPastMidnight.unsignedShortValue; - if (element_0.targetSoC != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].targetSoC.Emplace(); - definedValue_2 = element_0.targetSoC.unsignedCharValue; + auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; + if (element_0.dayOfWeekforSequence != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); + definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); } - if (element_0.addedEnergy != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].addedEnergy.Emplace(); - definedValue_2 = element_0.addedEnergy.longLongValue; + if (element_0.chargingTargets != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); + { + using ListType_3 = std::remove_reference_t; + using ListMemberType_3 = ListMemberTypeGetter::Type; + if (element_0.chargingTargets.count != 0) { + auto * listHolder_3 = new ListHolder(element_0.chargingTargets.count); + if (listHolder_3 == nullptr || listHolder_3->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_3); + for (size_t i_3 = 0; i_3 < element_0.chargingTargets.count; ++i_3) { + if (![element_0.chargingTargets[i_3] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_3 = (MTREnergyEVSEClusterChargingTargetStruct *) element_0.chargingTargets[i_3]; + listHolder_3->mList[i_3].targetTimeMinutesPastMidnight = element_3.targetTimeMinutesPastMidnight.unsignedShortValue; + if (element_3.targetSoC != nil) { + auto & definedValue_5 = listHolder_3->mList[i_3].targetSoC.Emplace(); + definedValue_5 = element_3.targetSoC.unsignedCharValue; + } + if (element_3.addedEnergy != nil) { + auto & definedValue_5 = listHolder_3->mList[i_3].addedEnergy.Emplace(); + definedValue_5 = element_3.addedEnergy.longLongValue; + } + } + definedValue_2 = ListType_3(listHolder_3->mList, element_0.chargingTargets.count); + } else { + definedValue_2 = ListType_3(); + } + } } } - encodableStruct.chargingTargets = ListType_0(listHolder_0->mList, self.chargingTargets.count); + encodableStruct.chargingTargetSchedules = ListType_0(listHolder_0->mList, self.chargingTargetSchedules.count); } else { - encodableStruct.chargingTargets = ListType_0(); + encodableStruct.chargingTargetSchedules = ListType_0(); } } } @@ -17390,8 +17430,6 @@ @implementation MTREnergyEVSEClusterGetTargetsParams - (instancetype)init { if (self = [super init]) { - - _daysToReturn = @(0); _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -17402,7 +17440,6 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTREnergyEVSEClusterGetTargetsParams alloc] init]; - other.daysToReturn = self.daysToReturn; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -17411,7 +17448,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: daysToReturn:%@; >", NSStringFromClass([self class]), _daysToReturn]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; return descriptionString; } @@ -17423,9 +17460,6 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { chip::app::Clusters::EnergyEvse::Commands::GetTargets::Type encodableStruct; ListFreer listFreer; - { - encodableStruct.daysToReturn = static_cast>(self.daysToReturn.unsignedCharValue); - } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); if (buffer.IsNull()) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index c952dc3da5faa2..1d155ecd860e9c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1285,6 +1285,12 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable addedEnergy MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterEVConnectedEvent : NSObject @property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 9324a04d612704..817b54dd8ad33c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5261,6 +5261,36 @@ - (NSString *)description @end +@implementation MTREnergyEVSEClusterChargingTargetScheduleStruct +- (instancetype)init +{ + if (self = [super init]) { + + _dayOfWeekforSequence = nil; + + _chargingTargets = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; + + other.dayOfWeekforSequence = self.dayOfWeekforSequence; + other.chargingTargets = self.chargingTargets; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + return descriptionString; +} + +@end + @implementation MTREnergyEVSEClusterEVConnectedEvent - (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 bb8bea1d96e7f9..2b6fd6141b5888 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 @@ -11146,68 +11146,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { - -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace NumberOfWeeklyTargets - -namespace NumberOfDailyTargets { - -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace NumberOfDailyTargets - namespace NextChargeStartTime { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) 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 8eac5af1be7ff0..47d04b2b2df1ae 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 @@ -2142,16 +2142,6 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // elapsed_s EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); -} // namespace NumberOfWeeklyTargets - -namespace NumberOfDailyTargets { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); -} // namespace NumberOfDailyTargets - namespace NextChargeStartTime { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); 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 834f1faa123612..9e5a7b34497209 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 @@ -15857,10 +15857,8 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace ChargingTargetStruct -} // namespace Structs -namespace Commands { -namespace GetTargetsResponse { +namespace ChargingTargetScheduleStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; @@ -15898,6 +15896,44 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } + +} // namespace ChargingTargetScheduleStruct +} // namespace Structs + +namespace Commands { +namespace GetTargetsResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kChargingTargetSchedules), chargingTargetSchedules); + 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::kChargingTargetSchedules)) + { + err = DataModel::Decode(reader, chargingTargetSchedules); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} } // namespace GetTargetsResponse. namespace Disable { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const @@ -16026,8 +16062,7 @@ namespace SetTargets { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kDayOfWeekforSequence), dayOfWeekforSequence); - encoder.Encode(to_underlying(Fields::kChargingTargets), chargingTargets); + encoder.Encode(to_underlying(Fields::kChargingTargetSchedules), chargingTargetSchedules); return encoder.Finalize(); } @@ -16045,13 +16080,9 @@ 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::kDayOfWeekforSequence)) + if (__context_tag == to_underlying(Fields::kChargingTargetSchedules)) { - err = DataModel::Decode(reader, dayOfWeekforSequence); - } - else if (__context_tag == to_underlying(Fields::kChargingTargets)) - { - err = DataModel::Decode(reader, chargingTargets); + err = DataModel::Decode(reader, chargingTargetSchedules); } else { @@ -16065,7 +16096,6 @@ namespace GetTargets { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kDaysToReturn), daysToReturn); return encoder.Finalize(); } @@ -16079,19 +16109,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kDaysToReturn)) - { - err = DataModel::Decode(reader, daysToReturn); - } - else - { - } - - ReturnErrorOnFailure(err); } } } // namespace GetTargets. @@ -16144,10 +16161,6 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, userMaximumChargeCurrent); case Attributes::RandomizationDelayWindow::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, randomizationDelayWindow); - case Attributes::NumberOfWeeklyTargets::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, numberOfWeeklyTargets); - case Attributes::NumberOfDailyTargets::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, numberOfDailyTargets); case Attributes::NextChargeStartTime::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, nextChargeStartTime); case Attributes::NextChargeTargetTime::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 c4fc5f675fae30..cad9c6d003855e 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 @@ -22004,6 +22004,36 @@ struct Type using DecodableType = Type; } // namespace ChargingTargetStruct +namespace ChargingTargetScheduleStruct { +enum class Fields : uint8_t +{ + kDayOfWeekforSequence = 0, + kChargingTargets = 1, +}; + +struct Type +{ +public: + Optional> dayOfWeekforSequence; + Optional> chargingTargets; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + Optional> dayOfWeekforSequence; + Optional> chargingTargets; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace ChargingTargetScheduleStruct } // namespace Structs namespace Commands { @@ -22055,8 +22085,7 @@ namespace Commands { namespace GetTargetsResponse { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, - kChargingTargets = 1, + kChargingTargetSchedules = 0, }; struct Type @@ -22066,8 +22095,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetTargetsResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::List chargingTargets; + DataModel::List chargingTargetSchedules; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -22082,8 +22110,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetTargetsResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::DecodableList chargingTargets; + DataModel::DecodableList chargingTargetSchedules; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetTargetsResponse @@ -22219,8 +22246,7 @@ struct DecodableType namespace SetTargets { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, - kChargingTargets = 1, + kChargingTargetSchedules = 0, }; struct Type @@ -22230,8 +22256,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::SetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::List chargingTargets; + DataModel::List chargingTargetSchedules; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -22246,15 +22271,13 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::SetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::DecodableList chargingTargets; + DataModel::DecodableList chargingTargetSchedules; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetTargets namespace GetTargets { enum class Fields : uint8_t { - kDaysToReturn = 0, }; struct Type @@ -22264,8 +22287,6 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask daysToReturn = static_cast>(0); - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; using ResponseType = Clusters::EnergyEvse::Commands::GetTargetsResponse::DecodableType; @@ -22279,7 +22300,6 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask daysToReturn = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetTargets @@ -22447,30 +22467,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { -struct TypeInfo -{ - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; - - static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfWeeklyTargets::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace NumberOfWeeklyTargets -namespace NumberOfDailyTargets { -struct TypeInfo -{ - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; - - static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfDailyTargets::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace NumberOfDailyTargets namespace NextChargeStartTime { struct TypeInfo { @@ -22674,8 +22670,6 @@ struct TypeInfo Attributes::MaximumDischargeCurrent::TypeInfo::DecodableType maximumDischargeCurrent = static_cast(0); Attributes::UserMaximumChargeCurrent::TypeInfo::DecodableType userMaximumChargeCurrent = static_cast(0); Attributes::RandomizationDelayWindow::TypeInfo::DecodableType randomizationDelayWindow = static_cast(0); - Attributes::NumberOfWeeklyTargets::TypeInfo::DecodableType numberOfWeeklyTargets = static_cast(0); - Attributes::NumberOfDailyTargets::TypeInfo::DecodableType numberOfDailyTargets = static_cast(0); Attributes::NextChargeStartTime::TypeInfo::DecodableType nextChargeStartTime; Attributes::NextChargeTargetTime::TypeInfo::DecodableType nextChargeTargetTime; Attributes::NextChargeRequiredEnergy::TypeInfo::DecodableType nextChargeRequiredEnergy; 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 4038c9c9c41723..10c5cc365f632f 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 @@ -3870,14 +3870,6 @@ namespace RandomizationDelayWindow { static constexpr AttributeId Id = 0x0000000A; } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { -static constexpr AttributeId Id = 0x00000021; -} // namespace NumberOfWeeklyTargets - -namespace NumberOfDailyTargets { -static constexpr AttributeId Id = 0x00000022; -} // namespace NumberOfDailyTargets - namespace NextChargeStartTime { static constexpr AttributeId Id = 0x00000023; } // namespace NextChargeStartTime diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index a7645ac8f0c77f..9a522434590c2b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -7172,8 +7172,6 @@ class DeviceEnergyManagementRequestConstraintBasedForecast : public ClusterComma | * MaximumDischargeCurrent | 0x0008 | | * UserMaximumChargeCurrent | 0x0009 | | * RandomizationDelayWindow | 0x000A | -| * NumberOfWeeklyTargets | 0x0021 | -| * NumberOfDailyTargets | 0x0022 | | * NextChargeStartTime | 0x0023 | | * NextChargeTargetTime | 0x0024 | | * NextChargeRequiredEnergy | 0x0025 | @@ -7360,10 +7358,9 @@ class EnergyEvseSetTargets : public ClusterCommand { public: EnergyEvseSetTargets(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-targets", credsIssuerConfig), mComplex_ChargingTargets(&mRequest.chargingTargets) + ClusterCommand("set-targets", credsIssuerConfig), mComplex_ChargingTargetSchedules(&mRequest.chargingTargetSchedules) { - AddArgument("DayOfWeekforSequence", 0, UINT8_MAX, &mRequest.dayOfWeekforSequence); - AddArgument("ChargingTargets", &mComplex_ChargingTargets); + AddArgument("ChargingTargetSchedules", &mComplex_ChargingTargetSchedules); ClusterCommand::AddArguments(); } @@ -7390,8 +7387,9 @@ class EnergyEvseSetTargets : public ClusterCommand private: chip::app::Clusters::EnergyEvse::Commands::SetTargets::Type mRequest; - TypedComplexArgument> - mComplex_ChargingTargets; + TypedComplexArgument< + chip::app::DataModel::List> + mComplex_ChargingTargetSchedules; }; /* @@ -7402,7 +7400,6 @@ class EnergyEvseGetTargets : public ClusterCommand public: EnergyEvseGetTargets(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("get-targets", credsIssuerConfig) { - AddArgument("DaysToReturn", 0, UINT8_MAX, &mRequest.daysToReturn); ClusterCommand::AddArguments(); } @@ -19906,11 +19903,9 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "user-maximum-charge-current", Attributes::UserMaximumChargeCurrent::Id, credsIssuerConfig), // make_unique(Id, "randomization-delay-window", Attributes::RandomizationDelayWindow::Id, - credsIssuerConfig), // - make_unique(Id, "number-of-weekly-targets", Attributes::NumberOfWeeklyTargets::Id, credsIssuerConfig), // - make_unique(Id, "number-of-daily-targets", Attributes::NumberOfDailyTargets::Id, credsIssuerConfig), // - make_unique(Id, "next-charge-start-time", Attributes::NextChargeStartTime::Id, credsIssuerConfig), // - make_unique(Id, "next-charge-target-time", Attributes::NextChargeTargetTime::Id, credsIssuerConfig), // + credsIssuerConfig), // + make_unique(Id, "next-charge-start-time", Attributes::NextChargeStartTime::Id, credsIssuerConfig), // + make_unique(Id, "next-charge-target-time", Attributes::NextChargeTargetTime::Id, credsIssuerConfig), // make_unique(Id, "next-charge-required-energy", Attributes::NextChargeRequiredEnergy::Id, credsIssuerConfig), // make_unique(Id, "next-charge-target-so-c", Attributes::NextChargeTargetSoC::Id, credsIssuerConfig), // @@ -19958,10 +19953,6 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>(Id, "randomization-delay-window", 0, UINT32_MAX, Attributes::RandomizationDelayWindow::Id, WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>(Id, "number-of-weekly-targets", 0, UINT8_MAX, Attributes::NumberOfWeeklyTargets::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "number-of-daily-targets", 0, UINT8_MAX, Attributes::NumberOfDailyTargets::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>(Id, "next-charge-start-time", 0, UINT32_MAX, Attributes::NextChargeStartTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -20024,10 +20015,7 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "user-maximum-charge-current", Attributes::UserMaximumChargeCurrent::Id, credsIssuerConfig), // make_unique(Id, "randomization-delay-window", Attributes::RandomizationDelayWindow::Id, - credsIssuerConfig), // - make_unique(Id, "number-of-weekly-targets", Attributes::NumberOfWeeklyTargets::Id, credsIssuerConfig), // - make_unique(Id, "number-of-daily-targets", Attributes::NumberOfDailyTargets::Id, credsIssuerConfig), // make_unique(Id, "next-charge-start-time", Attributes::NextChargeStartTime::Id, credsIssuerConfig), // make_unique(Id, "next-charge-target-time", Attributes::NextChargeTargetTime::Id, credsIssuerConfig), // make_unique(Id, "next-charge-required-energy", Attributes::NextChargeRequiredEnergy::Id, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index acbd349dc09dfc..ea06951314b7dd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3249,6 +3249,40 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::C ComplexArgumentParser::Finalize(request.addedEnergy); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("dayOfWeekforSequence")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); + } + valueCopy.removeMember("dayOfWeekforSequence"); + + if (value.isMember("chargingTargets")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "chargingTargets"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.chargingTargets, value["chargingTargets"])); + } + valueCopy.removeMember("chargingTargets"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); + ComplexArgumentParser::Finalize(request.chargingTargets); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 445524c97f85e4..a97d35e2ac7f0b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -378,6 +378,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyEvse::Str static void Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 2da87471d0a3c0..446d77b0aee60f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -2890,6 +2890,32 @@ 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::EnergyEvse::Structs::ChargingTargetScheduleStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("DayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekforSequence'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ChargingTargets", indent + 1, value.chargingTargets); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ChargingTargets'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::DecodableType & value) { @@ -6964,8 +6990,7 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const EnergyEvse::Commands::GetTargetsResponse::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); - ReturnErrorOnFailure(DataModelLogger::LogValue("dayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence)); - ReturnErrorOnFailure(DataModelLogger::LogValue("chargingTargets", indent + 1, value.chargingTargets)); + ReturnErrorOnFailure(DataModelLogger::LogValue("chargingTargetSchedules", indent + 1, value.chargingTargetSchedules)); DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } @@ -12062,16 +12087,6 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("RandomizationDelayWindow", 1, value); } - case EnergyEvse::Attributes::NumberOfWeeklyTargets::Id: { - uint8_t value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("NumberOfWeeklyTargets", 1, value); - } - case EnergyEvse::Attributes::NumberOfDailyTargets::Id: { - uint8_t value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("NumberOfDailyTargets", 1, value); - } case EnergyEvse::Attributes::NextChargeStartTime::Id: { chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); 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 2880226ecb9d14..89b8e51c0d0799 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -238,6 +238,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyEvse::Structs::ChargingTargetStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::DecodableType & value); 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 8b7c3cfbf53724..6e4ec40955e85b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80633,8 +80633,6 @@ class SubscribeAttributeDeviceEnergyManagementClusterRevision : public Subscribe | * MaximumDischargeCurrent | 0x0008 | | * UserMaximumChargeCurrent | 0x0009 | | * RandomizationDelayWindow | 0x000A | -| * NumberOfWeeklyTargets | 0x0021 | -| * NumberOfDailyTargets | 0x0022 | | * NextChargeStartTime | 0x0023 | | * NextChargeTargetTime | 0x0024 | | * NextChargeRequiredEnergy | 0x0025 | @@ -80895,13 +80893,10 @@ class EnergyEvseSetTargets : public ClusterCommand { public: EnergyEvseSetTargets() : ClusterCommand("set-targets") - , mComplex_ChargingTargets(&mRequest.chargingTargets) + , mComplex_ChargingTargetSchedules(&mRequest.chargingTargetSchedules) { #if MTR_ENABLE_PROVISIONAL - AddArgument("DayOfWeekforSequence", 0, UINT8_MAX, &mRequest.dayOfWeekforSequence); -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - AddArgument("ChargingTargets", &mComplex_ChargingTargets); + AddArgument("ChargingTargetSchedules", &mComplex_ChargingTargetSchedules); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -80917,29 +80912,44 @@ class EnergyEvseSetTargets : public ClusterCommand { __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterSetTargetsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:mRequest.dayOfWeekforSequence.Raw()]; -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.chargingTargets) { - MTREnergyEVSEClusterChargingTargetStruct * newElement_0; - newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight]; - if (entry_0.targetSoC.HasValue()) { - newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()]; + for (auto & entry_0 : mRequest.chargingTargetSchedules) { + MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; + newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.targetSoC = nil; + newElement_0.dayOfWeekforSequence = nil; } - if (entry_0.addedEnergy.HasValue()) { - newElement_0.addedEnergy = [NSNumber numberWithLongLong:entry_0.addedEnergy.Value()]; + if (entry_0.chargingTargets.HasValue()) { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + for (auto & entry_3 : entry_0.chargingTargets.Value()) { + MTREnergyEVSEClusterChargingTargetStruct * newElement_3; + newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; + if (entry_3.targetSoC.HasValue()) { + newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; + } else { + newElement_3.targetSoC = nil; + } + if (entry_3.addedEnergy.HasValue()) { + newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; + } else { + newElement_3.addedEnergy = nil; + } + [array_3 addObject:newElement_3]; + } + newElement_0.chargingTargets = array_3; + } } else { - newElement_0.addedEnergy = nil; + newElement_0.chargingTargets = nil; } [array_0 addObject:newElement_0]; } - params.chargingTargets = array_0; + params.chargingTargetSchedules = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); @@ -80963,7 +80973,7 @@ class EnergyEvseSetTargets : public ClusterCommand { private: chip::app::Clusters::EnergyEvse::Commands::SetTargets::Type mRequest; - TypedComplexArgument> mComplex_ChargingTargets; + TypedComplexArgument> mComplex_ChargingTargetSchedules; }; #endif // MTR_ENABLE_PROVISIONAL @@ -80976,9 +80986,6 @@ class EnergyEvseGetTargets : public ClusterCommand { EnergyEvseGetTargets() : ClusterCommand("get-targets") { -#if MTR_ENABLE_PROVISIONAL - AddArgument("DaysToReturn", 0, UINT8_MAX, &mRequest.daysToReturn); -#endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -80993,9 +81000,6 @@ class EnergyEvseGetTargets : public ClusterCommand { __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterGetTargetsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.daysToReturn = [NSNumber numberWithUnsignedChar:mRequest.daysToReturn.Raw()]; -#endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -81022,7 +81026,6 @@ class EnergyEvseGetTargets : public ClusterCommand { } private: - chip::app::Clusters::EnergyEvse::Commands::GetTargets::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL @@ -82092,176 +82095,6 @@ class SubscribeAttributeEnergyEvseRandomizationDelayWindow : public SubscribeAtt #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Attribute NumberOfWeeklyTargets - */ -class ReadEnergyEvseNumberOfWeeklyTargets : public ReadAttribute { -public: - ReadEnergyEvseNumberOfWeeklyTargets() - : ReadAttribute("number-of-weekly-targets") - { - } - - ~ReadEnergyEvseNumberOfWeeklyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfWeeklyTargets::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 = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfWeeklyTargetsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfWeeklyTargets response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("EnergyEVSE NumberOfWeeklyTargets read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeEnergyEvseNumberOfWeeklyTargets : public SubscribeAttribute { -public: - SubscribeAttributeEnergyEvseNumberOfWeeklyTargets() - : SubscribeAttribute("number-of-weekly-targets") - { - } - - ~SubscribeAttributeEnergyEvseNumberOfWeeklyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfWeeklyTargets::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 = [[MTRBaseClusterEnergyEVSE 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 subscribeAttributeNumberOfWeeklyTargetsWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfWeeklyTargets 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 NumberOfDailyTargets - */ -class ReadEnergyEvseNumberOfDailyTargets : public ReadAttribute { -public: - ReadEnergyEvseNumberOfDailyTargets() - : ReadAttribute("number-of-daily-targets") - { - } - - ~ReadEnergyEvseNumberOfDailyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfDailyTargets::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 = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfDailyTargetsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfDailyTargets response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("EnergyEVSE NumberOfDailyTargets read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeEnergyEvseNumberOfDailyTargets : public SubscribeAttribute { -public: - SubscribeAttributeEnergyEvseNumberOfDailyTargets() - : SubscribeAttribute("number-of-daily-targets") - { - } - - ~SubscribeAttributeEnergyEvseNumberOfDailyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfDailyTargets::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 = [[MTRBaseClusterEnergyEVSE 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 subscribeAttributeNumberOfDailyTargetsWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfDailyTargets 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 NextChargeStartTime */ @@ -179242,14 +179075,6 @@ void registerClusterEnergyEvse(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(), // -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // From 4fde8f8cc6f04f25d1872e7097bf4d0a2e401000 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 00:37:17 +0000 Subject: [PATCH 111/143] Removed min/max for Randomisation window due to ZAP bug that doesn't allow more than 2 bytes. --- .../zap-templates/zcl/data-model/chip/energy-evse-cluster.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 048f217abb7db4..3f955d28876944 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -115,7 +115,7 @@ limitations under the License. UserMaximumChargeCurrent
- + RandomizationDelayWindow From 97176e03fd7748c7711578068ffd69eea06e2934 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 01:05:34 +0000 Subject: [PATCH 112/143] Added missing new Java files --- ...EvseClusterChargingTargetScheduleStruct.kt | 89 +++++++++++++++++++ ...EvseClusterChargingTargetScheduleStruct.kt | 89 +++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt new file mode 100644 index 00000000000000..423672b1349bef --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyEvseClusterChargingTargetScheduleStruct( + val dayOfWeekforSequence: Optional, + val chargingTargets: Optional> +) { + override fun toString(): String = buildString { + append("EnergyEvseClusterChargingTargetScheduleStruct {\n") + append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tchargingTargets : $chargingTargets\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (dayOfWeekforSequence.isPresent) { + val optdayOfWeekforSequence = dayOfWeekforSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + } + if (chargingTargets.isPresent) { + val optchargingTargets = chargingTargets.get() + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in optchargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + } + endStructure() + } + } + + companion object { + private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_CHARGING_TARGETS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { + tlvReader.enterStructure(tlvTag) + val dayOfWeekforSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + } else { + Optional.empty() + } + val chargingTargets = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { + Optional.of( + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt new file mode 100644 index 00000000000000..b8aa1d7408f1c1 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import java.util.Optional +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 EnergyEvseClusterChargingTargetScheduleStruct( + val dayOfWeekforSequence: Optional, + val chargingTargets: Optional> +) { + override fun toString(): String = buildString { + append("EnergyEvseClusterChargingTargetScheduleStruct {\n") + append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tchargingTargets : $chargingTargets\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (dayOfWeekforSequence.isPresent) { + val optdayOfWeekforSequence = dayOfWeekforSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + } + if (chargingTargets.isPresent) { + val optchargingTargets = chargingTargets.get() + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in optchargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + } + endStructure() + } + } + + companion object { + private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_CHARGING_TARGETS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { + tlvReader.enterStructure(tlvTag) + val dayOfWeekforSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + } else { + Optional.empty() + } + val chargingTargets = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { + Optional.of( + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + } + } +} From 258c9cc8317ee4d506a7266701938b9925ea52ee Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 16:02:22 +0000 Subject: [PATCH 113/143] Changed DayOfWeekforSequence -> DayOfWeekForSequence in XML. Regen-all --- .../all-clusters-app.matter | 2 +- .../energy-management-app.matter | 2 +- .../data-model/chip/energy-evse-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../chip/devicecontroller/ChipStructs.java | 22 ++++++++-------- ...EvseClusterChargingTargetScheduleStruct.kt | 20 +++++++------- ...EvseClusterChargingTargetScheduleStruct.kt | 20 +++++++------- .../zap-generated/CHIPInvokeCallbacks.cpp | 26 +++++++++---------- .../python/chip/clusters/Objects.py | 4 +-- .../zap-generated/MTRCommandPayloadsObjc.mm | 12 ++++----- .../CHIP/zap-generated/MTRStructsObjc.h | 2 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 6 ++--- .../zap-generated/cluster-objects.cpp | 6 ++--- .../zap-generated/cluster-objects.h | 6 ++--- .../cluster/ComplexArgumentParser.cpp | 10 +++---- .../cluster/logging/DataModelLogger.cpp | 4 +-- .../zap-generated/cluster/Commands.h | 6 ++--- 17 files changed, 76 insertions(+), 76 deletions(-) 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 132a5533a14ce4..ddb40edf33ef8d 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 @@ -3868,7 +3868,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } 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 79b2a2b46894b1..255901812b0f19 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 @@ -973,7 +973,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 3f955d28876944..634c8d6e1b3698 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -82,7 +82,7 @@ limitations under the License. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9fe728a6497994..cdaea6617d3bc9 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4656,7 +4656,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 2c8d1b63c311df..8561046c058366 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7352,22 +7352,22 @@ public String toString() { } } public static class EnergyEvseClusterChargingTargetScheduleStruct { - public Optional dayOfWeekforSequence; + public Optional dayOfWeekForSequence; public Optional> chargingTargets; - private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; + private static final long DAY_OF_WEEK_FOR_SEQUENCE_ID = 0L; private static final long CHARGING_TARGETS_ID = 1L; public EnergyEvseClusterChargingTargetScheduleStruct( - Optional dayOfWeekforSequence, + Optional dayOfWeekForSequence, Optional> chargingTargets ) { - this.dayOfWeekforSequence = dayOfWeekforSequence; + this.dayOfWeekForSequence = dayOfWeekForSequence; this.chargingTargets = chargingTargets; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); + values.add(new StructElement(DAY_OF_WEEK_FOR_SEQUENCE_ID, dayOfWeekForSequence.map((nonOptionaldayOfWeekForSequence) -> new UIntType(nonOptionaldayOfWeekForSequence)).orElse(new EmptyType()))); values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); return new StructType(values); @@ -7377,13 +7377,13 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional dayOfWeekforSequence = Optional.empty(); + Optional dayOfWeekForSequence = Optional.empty(); Optional> chargingTargets = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { + if (element.contextTagNum() == DAY_OF_WEEK_FOR_SEQUENCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); + dayOfWeekForSequence = Optional.of(castingValue.value(Integer.class)); } } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { @@ -7393,7 +7393,7 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp } } return new EnergyEvseClusterChargingTargetScheduleStruct( - dayOfWeekforSequence, + dayOfWeekForSequence, chargingTargets ); } @@ -7402,8 +7402,8 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp public String toString() { StringBuilder output = new StringBuilder(); output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); - output.append("\tdayOfWeekforSequence: "); - output.append(dayOfWeekforSequence); + output.append("\tdayOfWeekForSequence: "); + output.append(dayOfWeekForSequence); output.append("\n"); output.append("\tchargingTargets: "); output.append(chargingTargets); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index 423672b1349bef..2cff1004099c89 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -25,12 +25,12 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekforSequence: Optional, + val dayOfWeekForSequence: Optional, val chargingTargets: Optional> ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") - append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tdayOfWeekForSequence : $dayOfWeekForSequence\n") append("\tchargingTargets : $chargingTargets\n") append("}\n") } @@ -38,9 +38,9 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekforSequence.isPresent) { - val optdayOfWeekforSequence = dayOfWeekforSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + if (dayOfWeekForSequence.isPresent) { + val optdayOfWeekForSequence = dayOfWeekForSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) } if (chargingTargets.isPresent) { val optchargingTargets = chargingTargets.get() @@ -55,14 +55,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( } companion object { - private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_DAY_OF_WEEK_FOR_SEQUENCE = 0 private const val TAG_CHARGING_TARGETS = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) - val dayOfWeekforSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + val dayOfWeekForSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) } else { Optional.empty() } @@ -83,7 +83,7 @@ class EnergyEvseClusterChargingTargetScheduleStruct( tlvReader.exitContainer() - return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekForSequence, chargingTargets) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index b8aa1d7408f1c1..417b0657103494 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -25,12 +25,12 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekforSequence: Optional, + val dayOfWeekForSequence: Optional, val chargingTargets: Optional> ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") - append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tdayOfWeekForSequence : $dayOfWeekForSequence\n") append("\tchargingTargets : $chargingTargets\n") append("}\n") } @@ -38,9 +38,9 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekforSequence.isPresent) { - val optdayOfWeekforSequence = dayOfWeekforSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + if (dayOfWeekForSequence.isPresent) { + val optdayOfWeekForSequence = dayOfWeekForSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) } if (chargingTargets.isPresent) { val optchargingTargets = chargingTargets.get() @@ -55,14 +55,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( } companion object { - private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_DAY_OF_WEEK_FOR_SEQUENCE = 0 private const val TAG_CHARGING_TARGETS = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) - val dayOfWeekforSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + val dayOfWeekForSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) } else { Optional.empty() } @@ -83,7 +83,7 @@ class EnergyEvseClusterChargingTargetScheduleStruct( tlvReader.exitContainer() - return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekForSequence, chargingTargets) } } } diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 5bf21dd5f16bba..571cf5c9140c81 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3981,23 +3981,23 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( { auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_dayOfWeekforSequence; - if (!entry_0.dayOfWeekforSequence.HasValue()) + jobject newElement_0_dayOfWeekForSequence; + if (!entry_0.dayOfWeekForSequence.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekForSequence); } else { - jobject newElement_0_dayOfWeekforSequenceInsideOptional; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); + jobject newElement_0_dayOfWeekForSequenceInsideOptional; + std::string newElement_0_dayOfWeekForSequenceInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekForSequenceInsideOptional = static_cast(entry_0.dayOfWeekForSequence.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), - newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), - jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, - newElement_0_dayOfWeekforSequence); + newElement_0_dayOfWeekForSequenceInsideOptionalClassName.c_str(), + newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature.c_str(), + jninewElement_0_dayOfWeekForSequenceInsideOptional, newElement_0_dayOfWeekForSequenceInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekForSequenceInsideOptional, + newElement_0_dayOfWeekForSequence); } jobject newElement_0_chargingTargets; if (!entry_0.chargingTargets.HasValue()) @@ -4108,7 +4108,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( } newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, - newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); + newElement_0_dayOfWeekForSequence, newElement_0_chargingTargets); chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 622fc30523abf3..8fc7cbbc3429b6 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -24063,11 +24063,11 @@ class ChargingTargetScheduleStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="dayOfWeekForSequence", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), ]) - dayOfWeekforSequence: 'typing.Optional[uint]' = None + dayOfWeekForSequence: 'typing.Optional[uint]' = None chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None class Commands: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 6994220b206bfd..aa401393f60882 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16909,10 +16909,10 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv auto & entry_0 = iter_0.GetValue(); MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; + if (entry_0.dayOfWeekForSequence.HasValue()) { + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekforSequence = nil; + newElement_0.dayOfWeekForSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables @@ -17343,9 +17343,9 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; - if (element_0.dayOfWeekforSequence != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); - definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); + if (element_0.dayOfWeekForSequence != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekForSequence.Emplace(); + definedValue_2 = static_cast>(element_0.dayOfWeekForSequence.unsignedCharValue); } if (element_0.chargingTargets != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 1d155ecd860e9c..03c458487ac190 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1287,7 +1287,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekForSequence MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 817b54dd8ad33c..ea434a6affb49e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5266,7 +5266,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = nil; + _dayOfWeekForSequence = nil; _chargingTargets = nil; } @@ -5277,7 +5277,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; + other.dayOfWeekForSequence = self.dayOfWeekForSequence; other.chargingTargets = self.chargingTargets; return other; @@ -5285,7 +5285,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekForSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekForSequence, _chargingTargets]; return descriptionString; } 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 9e5a7b34497209..5efe6b63375543 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 @@ -15862,7 +15862,7 @@ namespace ChargingTargetScheduleStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kDayOfWeekforSequence), dayOfWeekforSequence); + encoder.Encode(to_underlying(Fields::kDayOfWeekForSequence), dayOfWeekForSequence); encoder.Encode(to_underlying(Fields::kChargingTargets), chargingTargets); return encoder.Finalize(); } @@ -15881,9 +15881,9 @@ 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::kDayOfWeekforSequence)) + if (__context_tag == to_underlying(Fields::kDayOfWeekForSequence)) { - err = DataModel::Decode(reader, dayOfWeekforSequence); + err = DataModel::Decode(reader, dayOfWeekForSequence); } else if (__context_tag == to_underlying(Fields::kChargingTargets)) { 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 cad9c6d003855e..46f2792ace7d16 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 @@ -22007,14 +22007,14 @@ using DecodableType = Type; namespace ChargingTargetScheduleStruct { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, + kDayOfWeekForSequence = 0, kChargingTargets = 1, }; struct Type { public: - Optional> dayOfWeekforSequence; + Optional> dayOfWeekForSequence; Optional> chargingTargets; static constexpr bool kIsFabricScoped = false; @@ -22025,7 +22025,7 @@ struct Type struct DecodableType { public: - Optional> dayOfWeekforSequence; + Optional> dayOfWeekForSequence; Optional> chargingTargets; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index ea06951314b7dd..2deb5c5f7303ae 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3259,13 +3259,13 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, Json::Value valueCopy(value); char labelWithMember[kMaxLabelLength]; - if (value.isMember("dayOfWeekforSequence")) + if (value.isMember("dayOfWeekForSequence")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekForSequence"); ReturnErrorOnFailure( - ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekForSequence, value["dayOfWeekForSequence"])); } - valueCopy.removeMember("dayOfWeekforSequence"); + valueCopy.removeMember("dayOfWeekForSequence"); if (value.isMember("chargingTargets")) { @@ -3279,7 +3279,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) { - ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); + ComplexArgumentParser::Finalize(request.dayOfWeekForSequence); ComplexArgumentParser::Finalize(request.chargingTargets); } 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 446d77b0aee60f..8bf5953b30fdf2 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -2896,10 +2896,10 @@ DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("DayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence); + CHIP_ERROR err = LogValue("DayOfWeekForSequence", indent + 1, value.dayOfWeekForSequence); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekforSequence'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekForSequence'"); return err; } } 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 6e4ec40955e85b..f7d45eb602da6a 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80918,10 +80918,10 @@ class EnergyEvseSetTargets : public ClusterCommand { for (auto & entry_0 : mRequest.chargingTargetSchedules) { MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; + if (entry_0.dayOfWeekForSequence.HasValue()) { + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekforSequence = nil; + newElement_0.dayOfWeekForSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables From b662d0958c02ffed8294e11fc03573a0c0b7be8d Mon Sep 17 00:00:00 2001 From: C Freeman Date: Mon, 15 Jan 2024 03:35:29 -0500 Subject: [PATCH 114/143] Python testing: Add helper functions for marking steps as skipped in the TH (#31373) * Add two new helper functions for marking steps skipped * python testing: Add helper functions for skipped steps --- src/python_testing/hello_test.py | 7 +++- src/python_testing/matter_testing_support.py | 40 ++++++++++++-------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/python_testing/hello_test.py b/src/python_testing/hello_test.py index 8d92feb7ce3d80..8084edcc75a014 100644 --- a/src/python_testing/hello_test.py +++ b/src/python_testing/hello_test.py @@ -70,8 +70,9 @@ async def test_failure_on_wrong_endpoint(self): def steps_pics(self) -> list[TestStep]: steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), - TestStep(2, "Skip this step"), - TestStep(3, "Run this step") + TestStep(2, "Skip this step based on pics"), + TestStep(3, "Run this step"), + TestStep(4, "Always skip this step") ] return steps @@ -90,6 +91,8 @@ async def test_pics(self): self.step(3) print('This should also be run') + self.skip_step(4) + if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index b0a3450f47a496..306ddb89a4a2c1 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -862,23 +862,33 @@ def on_pass(self, record): def pics_guard(self, pics_condition: bool): if not pics_condition: - try: - steps = self.get_test_steps() - num = steps[self.current_step_index].test_plan_number - except KeyError: - num = self.current_step_index - - if self.runner_hook: - # TODO: what does name represent here? The wordy test name? The test plan number? The number and name? - # TODO: I very much do not want to have people passing in strings here. Do we really need the expression - # as a string? Does it get used by the TH? - self.runner_hook.step_skipped(name=str(num), expression="") - else: - logging.info(f'**** Skipping: {num}') - self.step_skipped = True + self.mark_current_step_skipped() + + def mark_current_step_skipped(self): + try: + steps = self.get_test_steps(self.current_test_info.name) + if self.current_step_index == 0: + asserts.fail("Script error: mark_current_step_skipped cannot be called before step()") + print(self.current_step_index-1) + num = steps[self.current_step_index-1].test_plan_number + except KeyError: + num = self.current_step_index + + if self.runner_hook: + # TODO: what does name represent here? The wordy test name? The test plan number? The number and name? + # TODO: I very much do not want to have people passing in strings here. Do we really need the expression + # as a string? Does it get used by the TH? + self.runner_hook.step_skipped(name=str(num), expression="") + else: + logging.info(f'**** Skipping: {num}') + self.step_skipped = True + + def skip_step(self, step): + self.step(step) + self.mark_current_step_skipped() def step(self, step: typing.Union[int, str]): - test_name = sys._getframe().f_back.f_code.co_name + test_name = self.current_test_info.name steps = self.get_test_steps(test_name) # TODO: this might be annoying during dev. Remove? Flag? From 5c9eb431d2333cf8ecb805d1f53af9fdb2892553 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Mon, 15 Jan 2024 04:19:21 -0500 Subject: [PATCH 115/143] Do not use gen_config.h directly. (#31401) * Do not use gen_config.h directly. Apparently the right file is config.h, which includes the gen file. * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../include/static-supported-temperature-levels.h | 2 +- .../src/static-supported-temperature-levels.cpp | 2 +- .../placeholder/linux/static-supported-temperature-levels.cpp | 1 - .../include/static-supported-temperature-levels.h | 2 +- .../src/static-supported-temperature-levels.cpp | 2 +- .../general-diagnostics-server/general-diagnostics-server.cpp | 2 +- src/app/clusters/power-source-server/power-source-server.cpp | 2 +- src/app/clusters/scenes-server/SceneTableImpl.h | 2 +- 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h b/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h index 1ef9f1db0c56ab..50739de0201628 100644 --- a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h +++ b/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h @@ -20,7 +20,7 @@ #include #include -#include +#include namespace chip { namespace app { diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp index d5352eed7b6367..0a830480fb188c 100644 --- a/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp @@ -16,8 +16,8 @@ * limitations under the License. */ +#include #include -#include using namespace std; using namespace chip; diff --git a/examples/placeholder/linux/static-supported-temperature-levels.cpp b/examples/placeholder/linux/static-supported-temperature-levels.cpp index 14a1087d230a4d..ed80f5490df821 100644 --- a/examples/placeholder/linux/static-supported-temperature-levels.cpp +++ b/examples/placeholder/linux/static-supported-temperature-levels.cpp @@ -18,7 +18,6 @@ #include #include -#include using namespace std; using namespace chip; diff --git a/examples/refrigerator-app/refrigerator-common/include/static-supported-temperature-levels.h b/examples/refrigerator-app/refrigerator-common/include/static-supported-temperature-levels.h index 1ef9f1db0c56ab..50739de0201628 100644 --- a/examples/refrigerator-app/refrigerator-common/include/static-supported-temperature-levels.h +++ b/examples/refrigerator-app/refrigerator-common/include/static-supported-temperature-levels.h @@ -20,7 +20,7 @@ #include #include -#include +#include namespace chip { namespace app { diff --git a/examples/refrigerator-app/refrigerator-common/src/static-supported-temperature-levels.cpp b/examples/refrigerator-app/refrigerator-common/src/static-supported-temperature-levels.cpp index ae7a7dfa72c9ea..a03a98d89feb1f 100644 --- a/examples/refrigerator-app/refrigerator-common/src/static-supported-temperature-levels.cpp +++ b/examples/refrigerator-app/refrigerator-common/src/static-supported-temperature-levels.cpp @@ -16,8 +16,8 @@ * limitations under the License. */ +#include #include -#include using namespace std; using namespace chip; diff --git a/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp b/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp index 0c5cf641268ad9..6f4a5c3e74f5b4 100644 --- a/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp +++ b/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp @@ -17,7 +17,7 @@ #include "general-diagnostics-server.h" -#include +#include #ifdef ZCL_USING_TIME_SYNCHRONIZATION_CLUSTER_SERVER // Need the `nogncheck` because it's inter-cluster dependency and this diff --git a/src/app/clusters/power-source-server/power-source-server.cpp b/src/app/clusters/power-source-server/power-source-server.cpp index 3baf2df84949f4..037a182dd7a0d6 100644 --- a/src/app/clusters/power-source-server/power-source-server.cpp +++ b/src/app/clusters/power-source-server/power-source-server.cpp @@ -25,9 +25,9 @@ #include #include #include +#include #include #include -#include using namespace chip; using namespace app; diff --git a/src/app/clusters/scenes-server/SceneTableImpl.h b/src/app/clusters/scenes-server/SceneTableImpl.h index 753799ec70c68e..01801fd2dd1310 100644 --- a/src/app/clusters/scenes-server/SceneTableImpl.h +++ b/src/app/clusters/scenes-server/SceneTableImpl.h @@ -20,11 +20,11 @@ #include #include #include +#include #include #include #include #include -#include namespace chip { namespace scenes { From cc23af71402a86730e98441487c501f2f0c78dfa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:05:25 +0000 Subject: [PATCH 116/143] Bump third_party/ot-br-posix/repo from `657e775` to `58822dc` (#31420) Bumps [third_party/ot-br-posix/repo](https://github.com/openthread/ot-br-posix) from `657e775` to `58822dc`. - [Release notes](https://github.com/openthread/ot-br-posix/releases) - [Commits](https://github.com/openthread/ot-br-posix/compare/657e775cd9ca757af7487da2fb039aee645c3d65...58822dce1934568523bf1389c039f249e1d979ad) --- updated-dependencies: - dependency-name: third_party/ot-br-posix/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/ot-br-posix/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/ot-br-posix/repo b/third_party/ot-br-posix/repo index 657e775cd9ca75..58822dce193456 160000 --- a/third_party/ot-br-posix/repo +++ b/third_party/ot-br-posix/repo @@ -1 +1 @@ -Subproject commit 657e775cd9ca757af7487da2fb039aee645c3d65 +Subproject commit 58822dce1934568523bf1389c039f249e1d979ad From ba56dffb533117eb92eec9a493d900e8581aef11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:06:15 +0000 Subject: [PATCH 117/143] Bump third_party/imgui/repo from `240ab58` to `6228c2e` (#31418) Bumps [third_party/imgui/repo](https://github.com/ocornut/imgui) from `240ab58` to `6228c2e`. - [Release notes](https://github.com/ocornut/imgui/releases) - [Commits](https://github.com/ocornut/imgui/compare/240ab5890b2e8da294937a1710b021ac3f271472...6228c2e1ec7ef21ca1809579c055ed34540dedb0) --- updated-dependencies: - dependency-name: third_party/imgui/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/imgui/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/imgui/repo b/third_party/imgui/repo index 240ab5890b2e8d..6228c2e1ec7ef2 160000 --- a/third_party/imgui/repo +++ b/third_party/imgui/repo @@ -1 +1 @@ -Subproject commit 240ab5890b2e8da294937a1710b021ac3f271472 +Subproject commit 6228c2e1ec7ef21ca1809579c055ed34540dedb0 From 091073cc98b9b5221cf2acf19764e1289c06edd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:06:28 +0000 Subject: [PATCH 118/143] Bump third_party/pigweed/repo from `cbbc73d` to `9640cde` (#31414) Bumps [third_party/pigweed/repo](https://github.com/google/pigweed) from `cbbc73d` to `9640cde`. - [Commits](https://github.com/google/pigweed/compare/cbbc73dc4d56bc201e9d50c4b10db974aff82754...9640cdef100f87d7987875d3a418931d6500e5b2) --- updated-dependencies: - dependency-name: third_party/pigweed/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/pigweed/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index cbbc73dc4d56bc..9640cdef100f87 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit cbbc73dc4d56bc201e9d50c4b10db974aff82754 +Subproject commit 9640cdef100f87d7987875d3a418931d6500e5b2 From 1d23f54b88017e2d97f8b485cf2bfaa6cb1fd07c Mon Sep 17 00:00:00 2001 From: Erwin Pan Date: Mon, 15 Jan 2024 22:51:43 +0800 Subject: [PATCH 119/143] [Chef] Fix variable may be used without initialization (#31413) * Fix variable may be used without initialization * Restyled by clang-format --------- Co-authored-by: Restyled.io --- examples/chef/common/chef-fan-control-manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/common/chef-fan-control-manager.cpp b/examples/chef/common/chef-fan-control-manager.cpp index 3be024c33d4d5b..56576febd693d4 100644 --- a/examples/chef/common/chef-fan-control-manager.cpp +++ b/examples/chef/common/chef-fan-control-manager.cpp @@ -96,7 +96,7 @@ Status ChefFanControlManager::HandleStep(StepDirectionEnum aDirection, bool aWra status = SpeedSetting::Get(mEndpoint, speedSetting); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, Status::InvalidCommand); - uint8_t newSpeedSetting; + uint8_t newSpeedSetting = speedSetting.ValueOr(0); uint8_t speedValue = speedSetting.ValueOr(speedCurrent); const uint8_t kLowestSpeed = aLowestOff ? 0 : 1; From 6562a8042962c2043f35b05e1b7cb25b8a098fc0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 15:02:59 +0000 Subject: [PATCH 120/143] Bump third_party/nanopb/repo from `cf26d28` to `423c03b` (#31421) Bumps [third_party/nanopb/repo](https://github.com/nanopb/nanopb) from `cf26d28` to `423c03b`. - [Commits](https://github.com/nanopb/nanopb/compare/cf26d28b88010dd3ac94e0cba64d4a71522154bc...423c03b626a861a7b3a08a2d411e23aefd58827b) --- updated-dependencies: - dependency-name: third_party/nanopb/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/nanopb/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/nanopb/repo b/third_party/nanopb/repo index cf26d28b88010d..423c03b626a861 160000 --- a/third_party/nanopb/repo +++ b/third_party/nanopb/repo @@ -1 +1 @@ -Subproject commit cf26d28b88010dd3ac94e0cba64d4a71522154bc +Subproject commit 423c03b626a861a7b3a08a2d411e23aefd58827b From f30524e26ef36bc033e5020d50dae9a942f7793b Mon Sep 17 00:00:00 2001 From: simonhmorris1 <112178216+simonhmorris1@users.noreply.github.com> Date: Mon, 15 Jan 2024 15:21:58 +0000 Subject: [PATCH 121/143] Test_TC_DGWIFI_2_1 WiFiVersion enum8 maxValue should be 6 (#31364) * WiFiVersion enum8 maxValue should be 6 Matter Spec 1.2 Section 11.14.5.2. WiFiVersionEnum Type ranges from 0 (802.11a) to 6 (802.11ah) * Update command.h darwin zap-genersated WiFiVersion --- src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml | 2 +- .../darwin-framework-tool/zap-generated/test/Commands.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml b/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml index a95db84e1785fb..7ed81db6ac7c94 100644 --- a/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml @@ -56,7 +56,7 @@ tests: constraints: type: enum8 minValue: 0 - maxValue: 5 + maxValue: 6 - label: "Step 5: TH reads ChannelNumber attribute constraints" PICS: DGWIFI.S.A0003 diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 4ba0ce8966b107..a69442a3e058a9 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -112151,7 +112151,7 @@ class Test_TC_DGWIFI_2_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("wiFiVersion", "enum8", "enum8")); VerifyOrReturn(CheckConstraintMinValue("wiFiVersion", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("wiFiVersion", [value unsignedCharValue], 5U)); + VerifyOrReturn(CheckConstraintMaxValue("wiFiVersion", [value unsignedCharValue], 6U)); } NextTest(); From d6f1134bda9d846a58468b048c9d14c80cfebc0c Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 15 Jan 2024 10:31:21 -0500 Subject: [PATCH 122/143] Handle energy type naming in data model xml handlers (#31344) * Correct case names for enerty types in data model handlers. * Add unit test * restyle --- .../data_model_xml/handlers/parsing.py | 10 ++++++++++ .../matter_idl/test_data_model_xml.py | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py b/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py index 624bcb56b9dc01..608e526f619cc0 100644 --- a/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py +++ b/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py @@ -102,6 +102,13 @@ def NormalizeDataType(t: str) -> str: } +# Handle odd casing and naming +_CASE_RENAMES_MAPPING = { + "power_mW": "power_mw", + "energy_mWh": "energy_mwh" +} + + def ParseType(t: str) -> ParsedType: """Parse a data type entry. @@ -123,6 +130,9 @@ def ParseType(t: str) -> ParsedType: if t in _REF_NAME_MAPPING: t = _REF_NAME_MAPPING[t] + if t in _CASE_RENAMES_MAPPING: + t = _CASE_RENAMES_MAPPING[t] + return ParsedType(name=NormalizeDataType(t), is_list=is_list) diff --git a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py index 647a275ea8d547..6bdb530f7cc9fc 100755 --- a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py +++ b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py @@ -415,6 +415,19 @@ def testXmlNameWorkarounds(self): + + + + + + + + + + + + + @@ -443,11 +456,14 @@ def testXmlNameWorkarounds(self): char_string id = 0; int8u items[] = 1; endpoint_no endpoints[] = 2; + optional power_mw nominalPower = 3; + optional energy_mwh maximumEnergy = 4; } readonly attribute OutputInfoStruct outputList[] = 0; readonly attribute optional enum8 testConform = 1; + readonly attribute attrib_id attributeList[] = 65531; readonly attribute event_id eventList[] = 65530; readonly attribute command_id acceptedCommandList[] = 65529; From c3f73e9d793c24c7aa0cde6782ede544e72e8bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:46:57 +0100 Subject: [PATCH 123/143] [nrfconnect] Switch unit tests to PSA crypto (#31408) * [nrfconnect] Switch unit tests to PSA crypto Switch nRF Connect unit tests to PSA crypto backend since legacy mbedTLS is already tested on many platforms. Additionally, clean the configuration of nRF Connect test runner by removing some redundant configurations and better grouping the items. * Restyled by gn --------- Co-authored-by: Restyled.io --- src/app/tests/BUILD.gn | 7 ++- src/crypto/tests/CHIPCryptoPALTest.cpp | 10 ++-- .../main/include/app_mbedtls_config.h | 17 ------ src/test_driver/nrfconnect/prj.conf | 54 +++++++------------ 4 files changed, 30 insertions(+), 58 deletions(-) diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 1c48851aa07b95..d0f9a73178ccb0 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -18,6 +18,7 @@ import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/app/icd/icd.gni") +import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/platform/device.gni") static_library("helpers") { @@ -162,7 +163,11 @@ chip_test_suite_using_nltest("tests") { } test_sources += [ "TestAclAttribute.cpp" ] - test_sources += [ "TestDefaultICDClientStorage.cpp" ] + + # DefaultICDClientStorage assumes that raw AES key is used by the application + if (chip_crypto != "psa") { + test_sources += [ "TestDefaultICDClientStorage.cpp" ] + } # # On NRF platforms, the allocation of a large number of pbufs in this test diff --git a/src/crypto/tests/CHIPCryptoPALTest.cpp b/src/crypto/tests/CHIPCryptoPALTest.cpp index 74b339abad9877..4a3af662853172 100644 --- a/src/crypto/tests/CHIPCryptoPALTest.cpp +++ b/src/crypto/tests/CHIPCryptoPALTest.cpp @@ -52,10 +52,6 @@ #include -#if CHIP_CRYPTO_MBEDTLS -#include -#endif - #include #include #include @@ -71,6 +67,10 @@ #include #include +#if CHIP_CRYPTO_MBEDTLS || CHIP_CRYPTO_PSA +#include +#endif + #if CHIP_CRYPTO_PSA #include #endif @@ -88,7 +88,7 @@ using TestHKDF_sha = HKDF_sha; using TestHMAC_sha = HMAC_sha; // Helper class to verify that all mbedTLS heap objects are released at the end of a test. -#if CHIP_CRYPTO_MBEDTLS && defined(MBEDTLS_MEMORY_DEBUG) +#if defined(MBEDTLS_MEMORY_DEBUG) class HeapChecker { public: diff --git a/src/test_driver/nrfconnect/main/include/app_mbedtls_config.h b/src/test_driver/nrfconnect/main/include/app_mbedtls_config.h index c676d725837aea..b28420c41828e8 100644 --- a/src/test_driver/nrfconnect/main/include/app_mbedtls_config.h +++ b/src/test_driver/nrfconnect/main/include/app_mbedtls_config.h @@ -17,24 +17,7 @@ */ // Enable cryptographic functions needed by CHIP which can't be enabled via Kconfig -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDH_C #define MBEDTLS_HKDF_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_WRITE_C #define MBEDTLS_X509_CREATE_C #define MBEDTLS_X509_CSR_PARSE_C #define MBEDTLS_X509_CSR_WRITE_C -#define MBEDTLS_BASE64_C -#define MBEDTLS_PEM_WRITE_C - -// Define mbedtls_error() -#define MBEDTLS_ERROR_C - -// Use /dev/urandom as entropy generator -#undef MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES -#undef MBEDTLS_NO_PLATFORM_ENTROPY - -// Configure heap usage monitoring -#define MBEDTLS_MEMORY_DEBUG diff --git a/src/test_driver/nrfconnect/prj.conf b/src/test_driver/nrfconnect/prj.conf index 4a49d837a1d56a..8c9c4433d56086 100644 --- a/src/test_driver/nrfconnect/prj.conf +++ b/src/test_driver/nrfconnect/prj.conf @@ -17,60 +17,46 @@ # Application stack size CONFIG_MAIN_STACK_SIZE=8704 -# Turn on the logger +# Logging configuration CONFIG_LOG=y CONFIG_LOG_MODE_IMMEDIATE=y -# Set up IPv4/6 networking over BSD socket API -CONFIG_NETWORKING=y -CONFIG_NET_IPV6=y -CONFIG_NET_UDP=y -CONFIG_NET_SOCKETS=y +# Zephyr networking configuration CONFIG_NET_SOCKETS_POSIX_NAMES=n - CONFIG_NET_IPV4=y -CONFIG_NET_CONFIG_NEED_IPV6=y -CONFIG_NET_CONFIG_NEED_IPV4=y - CONFIG_ETH_NATIVE_POSIX=y - -# disable certain parts of Zephyr IPv6 stack -CONFIG_NET_IPV6_NBR_CACHE=n -CONFIG_NET_IPV6_MLD=n - -# Configure settings -CONFIG_FLASH_SIMULATOR=y - -# Network buffers CONFIG_NET_PKT_RX_COUNT=16 CONFIG_NET_PKT_TX_COUNT=16 CONFIG_NET_BUF_RX_COUNT=80 CONFIG_NET_BUF_TX_COUNT=80 CONFIG_NET_CONTEXT_NET_PKT_POOL=y - -# Thread by default registers quite a lot addresses. CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=6 CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=8 -CONFIG_NET_MAX_CONTEXTS=10 -# mbedTLS tweaks +# Configure settings +CONFIG_FLASH_SIMULATOR=y + +# mbedTLS configuration CONFIG_MBEDTLS=y CONFIG_MBEDTLS_ENABLE_HEAP=y -CONFIG_MBEDTLS_BUILTIN=y -CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=768 CONFIG_MBEDTLS_HEAP_SIZE=65536 +CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=768 +CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y +CONFIG_MBEDTLS_USER_CONFIG_FILE="app_mbedtls_config.h" +CONFIG_MBEDTLS_ZEPHYR_ENTROPY=y CONFIG_MBEDTLS_ENTROPY_ENABLED=y CONFIG_MBEDTLS_CTR_DRBG_ENABLED=y -CONFIG_MBEDTLS_CIPHER_MODE_CTR_ENABLED=y +CONFIG_MBEDTLS_CIPHER_CCM_ENABLED=y CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h" -CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y -CONFIG_MBEDTLS_USER_CONFIG_FILE="app_mbedtls_config.h" CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_CIPHER_CCM_ENABLED=y +CONFIG_MBEDTLS_PK_WRITE_C=y +CONFIG_MBEDTLS_PKCS5_C=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_MBEDTLS_MEMORY_DEBUG=y +CONFIG_MBEDTLS_DEBUG=y # Enable entropy CONFIG_ENTROPY_GENERATOR=y @@ -83,16 +69,14 @@ CONFIG_THREAD_NAME=y CONFIG_INIT_STACKS=y CONFIG_REBOOT=n -# Build as C++14 +# Build as C++17 CONFIG_STD_CPP17=y # CHIP configuration CONFIG_CHIP=y +CONFIG_CHIP_CRYPTO_PSA=y CONFIG_CHIP_BUILD_TESTS=y -CONFIG_CHIP_ENABLE_DNSSD_SRP=n +CONFIG_CHIP_ENABLE_READ_CLIENT=y CONFIG_CHIP_DEVICE_VENDOR_ID=65521 CONFIG_CHIP_DEVICE_PRODUCT_ID=32768 CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" - -# Enable the Read Client -CONFIG_CHIP_ENABLE_READ_CLIENT=y From 1ec39b76d27d5c47145c5a80df7479ee4a2323e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:09:56 +0000 Subject: [PATCH 124/143] Bump third_party/libwebsockets/repo from `f18fc23` to `49bfef2` (#31417) Bumps [third_party/libwebsockets/repo](https://github.com/warmcat/libwebsockets) from `f18fc23` to `49bfef2`. - [Commits](https://github.com/warmcat/libwebsockets/compare/f18fc2316f9743624ced9ba934595f7b9ba8cd05...49bfef2ecd51b854b63e35d913849b6bb518a7f6) --- updated-dependencies: - dependency-name: third_party/libwebsockets/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/libwebsockets/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/libwebsockets/repo b/third_party/libwebsockets/repo index f18fc2316f9743..49bfef2ecd51b8 160000 --- a/third_party/libwebsockets/repo +++ b/third_party/libwebsockets/repo @@ -1 +1 @@ -Subproject commit f18fc2316f9743624ced9ba934595f7b9ba8cd05 +Subproject commit 49bfef2ecd51b854b63e35d913849b6bb518a7f6 From 82fe24969b6148acc33e9bf361f86c039f27eef1 Mon Sep 17 00:00:00 2001 From: fesseha-eve <88329315+fessehaeve@users.noreply.github.com> Date: Mon, 15 Jan 2024 17:18:59 +0100 Subject: [PATCH 125/143] Add initial valve cluster implementation (#30562) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added first version of valve configuration and control cluster * added first version of boolean sensor configuration cluster XML and updated event descriptions for valve config and control cluster * fixed wrong attribute name Co-authored-by: Boris Zbarsky * fixed typo Co-authored-by: Boris Zbarsky * removed StartUpLevel attribute and added optional OpenDuration command args * use allocated cluster ID * added code generating bits * added new device types * restyle * added BooleanSensorConfiguration and ValveConfigurationAndControl clusters to all-clusters-app * - fixed wrong attribute name caused by copy paste - min/max is not allowed for attributes with size larger than 2 bytes * regenerate all * added initial implementation for the new clusters * apply provisional property to new clusters * fixed typo Co-authored-by: Boris Zbarsky * removed empty implementation, removed clusters from all-clusters-app * added a skeleton implementation * fixed typo Co-authored-by: Boris Zbarsky * fixed typos and regen all * fixes based on PR comments * added descriptor cluster to valve device type * updated zap and idl files to fixed typo in command name * close to final implementation, needs careful going through * activate alarms if enabled, added API for sensor fault event, clean-up * WIP * Implemented open command * finalize initial implementation * added all-clusters-app example for valve device * added null checking * added attribute changed callback and fixed some bugs after testing * did a regen and fixed rebase issue * restyle * added missed generated code by previous commits * attempt to fix failing CI * restyle * add a missed zap gen output * removed redundant return * update valve configuration and control cluster according to latest spec * remove boolean sensor config cluster implementation and into a separate PR * DefaultOpenDuration is writable and updated device type name to Water Valve * updated code to latest spec * changed RemainingDuration to be handled by AttributeAccessInterface * WIP RemainingDuration * moved domain to be the first element * update to the latest spec changes, removed attribute changed callback, handle remainingduration in AAI * added LevelStep attribute in all-clusters-app * removed unused code * set default null values in ZAP * Added transition handling in Delegate * Reworked AutoTimeClose handling in SetValveLevel * Changed include * added mechanism to signal UTCTime change in timesync cluster --------- Co-authored-by: Boris Zbarsky Co-authored-by: fessehat Co-authored-by: René Josefsen Co-authored-by: René Josefsen <69624991+ReneJosefsen@users.noreply.github.com> --- .../all-clusters-app.matter | 91 +++ .../all-clusters-common/all-clusters-app.zap | 317 +++++++++++ .../esp32/main/CMakeLists.txt | 1 + examples/all-clusters-app/linux/BUILD.gn | 1 + .../linux/ValveControlDelegate.cpp | 76 +++ .../linux/ValveControlDelegate.h | 49 ++ .../all-clusters-app/linux/main-common.cpp | 8 + .../DefaultTimeSyncDelegate.cpp | 5 + .../DefaultTimeSyncDelegate.h | 1 + .../time-synchronization-delegate.h | 5 + .../time-synchronization-server.cpp | 1 + .../time-synchronization-server.h | 3 + ...valve-configuration-and-control-delegate.h | 50 ++ ...valve-configuration-and-control-server.cpp | 521 ++++++++++++++++++ .../valve-configuration-and-control-server.h | 59 ++ src/app/util/util.cpp | 1 - .../zcl/zcl-with-test-extensions.json | 3 +- src/app/zap-templates/zcl/zcl.json | 3 +- src/app/zap_cluster_list.json | 4 +- .../zap-generated/attributes/Accessors.cpp | 53 -- .../zap-generated/attributes/Accessors.h | 7 - 21 files changed, 1195 insertions(+), 64 deletions(-) create mode 100644 examples/all-clusters-app/linux/ValveControlDelegate.cpp create mode 100644 examples/all-clusters-app/linux/ValveControlDelegate.h create mode 100644 src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-delegate.h create mode 100644 src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp create mode 100644 src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h 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 ddb40edf33ef8d..68230e374e0c29 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 @@ -3716,6 +3716,72 @@ cluster ActivatedCarbonFilterMonitoring = 114 { command ResetCondition(): DefaultSuccess = 0; } +/** This cluster is used to configure a valve. */ +provisional cluster ValveConfigurationAndControl = 129 { + revision 1; + + enum StatusCodeEnum : enum8 { + kFailureDueToFault = 2; + } + + enum ValveStateEnum : enum8 { + kClosed = 0; + kOpen = 1; + kTransitioning = 2; + } + + bitmap Feature : bitmap32 { + kTimeSync = 0x1; + kLevel = 0x2; + } + + bitmap ValveFaultBitmap : bitmap16 { + kGeneralFault = 0x1; + kBlocked = 0x2; + kLeaking = 0x4; + kNotConnected = 0x8; + kShortCircuit = 0x10; + kCurrentExceeded = 0x20; + } + + info event ValveStateChanged = 0 { + ValveStateEnum valveState = 0; + optional percent valveLevel = 1; + } + + info event ValveFault = 1 { + ValveFaultBitmap valveFault = 0; + } + + readonly attribute nullable elapsed_s openDuration = 0; + attribute nullable elapsed_s defaultOpenDuration = 1; + readonly attribute optional nullable epoch_us autoCloseTime = 2; + readonly attribute nullable elapsed_s remainingDuration = 3; + readonly attribute nullable ValveStateEnum currentState = 4; + readonly attribute nullable ValveStateEnum targetState = 5; + readonly attribute optional nullable percent currentLevel = 6; + readonly attribute optional nullable percent targetLevel = 7; + attribute optional percent defaultOpenLevel = 8; + readonly attribute optional ValveFaultBitmap valveFault = 9; + readonly attribute optional int8u levelStep = 10; + 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; + + request struct OpenRequest { + optional nullable elapsed_s openDuration = 0; + optional percent targetLevel = 1; + } + + /** This command is used to set the valve to its open position. */ + command Open(OpenRequest): DefaultSuccess = 0; + /** This command is used to set the valve to its closed position. */ + command Close(): DefaultSuccess = 1; +} + /** This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. */ provisional cluster ElectricalEnergyMeasurement = 145 { revision 1; @@ -7423,6 +7489,31 @@ endpoint 1 { handle command ResetCondition; } + server cluster ValveConfigurationAndControl { + emits event ValveStateChanged; + emits event ValveFault; + ram attribute openDuration; + persist attribute defaultOpenDuration; + ram attribute autoCloseTime; + callback attribute remainingDuration; + ram attribute currentState; + ram attribute targetState; + ram attribute currentLevel; + ram attribute targetLevel; + persist attribute defaultOpenLevel default = 100; + ram attribute valveFault default = 0; + ram attribute levelStep default = 1; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 3; + ram attribute clusterRevision default = 1; + + handle command Open; + handle command Close; + } + server cluster ElectricalEnergyMeasurement { emits event CumulativeEnergyMeasured; emits event PeriodicEnergyMeasured; 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 71be89cecc77ae..44c739fd60be7e 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 @@ -11803,6 +11803,323 @@ } ] }, + { + "name": "Valve Configuration and Control", + "code": 129, + "mfgCode": null, + "define": "VALVE_CONFIGURATION_AND_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "Open", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "Close", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "OpenDuration", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DefaultOpenDuration", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AutoCloseTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "epoch_us", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemainingDuration", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentState", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "ValveStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetState", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "ValveStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentLevel", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "percent", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetLevel", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "percent", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DefaultOpenLevel", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "percent", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "100", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ValveFault", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "ValveFaultBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LevelStep", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "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": "ValveStateChanged", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "ValveFault", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, { "name": "Electrical Energy Measurement", "code": 145, diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index c5d40048308c2d..08f0673223b34a 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -86,6 +86,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/resource-monitoring-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/valve-configuration-and-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-dryer-controls-server" diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 343372676bd8fc..43a3e94506784a 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -45,6 +45,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", "AllClustersCommandDelegate.cpp", "AppOptions.cpp", + "ValveControlDelegate.cpp", "WindowCoveringManager.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", diff --git a/examples/all-clusters-app/linux/ValveControlDelegate.cpp b/examples/all-clusters-app/linux/ValveControlDelegate.cpp new file mode 100644 index 00000000000000..9c51aff63101f5 --- /dev/null +++ b/examples/all-clusters-app/linux/ValveControlDelegate.cpp @@ -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. + */ + +#include "ValveControlDelegate.h" +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::ValveConfigurationAndControl; +using namespace chip::app::Clusters::TimeSynchronization; + +static chip::Percent sLevel = 1; +static uint32_t sLastOpenDuration = 0; +static constexpr EndpointId kValveEndpoint = 1; + +DataModel::Nullable ValveControlDelegate::HandleOpenValve(DataModel::Nullable level) +{ + chip::Percent currentLevel = sLevel; + sLevel = level.IsNull() ? 100 : level.Value(); + sLastOpenDuration = 0; + ChipLogProgress(NotSpecified, "Valve openinig from level: %d to %d", currentLevel, sLevel); + + // In this demo application, the trasition is considered instant, + // so current level is set to the requested level and current state is set to kOpen. + currentLevel = sLevel; + Attributes::CurrentState::Set(kValveEndpoint, ValveConfigurationAndControl::ValveStateEnum::kOpen); + + return DataModel::Nullable(currentLevel); +} + +CHIP_ERROR ValveControlDelegate::HandleCloseValve() +{ + sLastOpenDuration = 0; + sLevel = 0; + ReturnErrorOnFailure(ValveConfigurationAndControl::UpdateCurrentLevel(kValveEndpoint, sLevel)); + ReturnErrorOnFailure( + ValveConfigurationAndControl::UpdateCurrentState(kValveEndpoint, ValveConfigurationAndControl::ValveStateEnum::kClosed)); + ChipLogProgress(NotSpecified, "Valve closed"); + return CHIP_NO_ERROR; +} + +void ValveControlDelegate::HandleRemainingDurationTick(uint32_t duration) +{ + ChipLogProgress(NotSpecified, "Valve remaining duration ticking: %dsec level: %d duration %d", duration, sLevel, + sLastOpenDuration); + if (sLastOpenDuration == 0) + { + VerifyOrReturn(CHIP_NO_ERROR == ValveConfigurationAndControl::UpdateCurrentLevel(kValveEndpoint, sLevel), + ChipLogError(NotSpecified, "Updating current level failed")); + VerifyOrReturn(CHIP_NO_ERROR == + ValveConfigurationAndControl::UpdateCurrentState(kValveEndpoint, + ValveConfigurationAndControl::ValveStateEnum::kOpen), + ChipLogError(NotSpecified, "Updating current state failed")); + } + sLastOpenDuration = duration; +} + +void ExtendedTimeSyncDelegate::UTCTimeChanged(uint64_t time) +{ + ValveConfigurationAndControl::UpdateAutoCloseTime(time); +} diff --git a/examples/all-clusters-app/linux/ValveControlDelegate.h b/examples/all-clusters-app/linux/ValveControlDelegate.h new file mode 100644 index 00000000000000..76f0f17a8fdfd1 --- /dev/null +++ b/examples/all-clusters-app/linux/ValveControlDelegate.h @@ -0,0 +1,49 @@ +/** + * + * 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. + */ + +#pragma once + +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ValveConfigurationAndControl { + +class ValveControlDelegate : public Delegate +{ +public: + DataModel::Nullable HandleOpenValve(DataModel::Nullable level) override; + CHIP_ERROR HandleCloseValve() override; + void HandleRemainingDurationTick(uint32_t duration) override; +}; + +} // namespace ValveConfigurationAndControl + +namespace TimeSynchronization { + +class ExtendedTimeSyncDelegate : public DefaultTimeSyncDelegate +{ +public: + void UTCTimeChanged(uint64_t time) override; +}; + +} // namespace TimeSynchronization +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index 05435df44e81b8..49ee513ca33f95 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -17,6 +17,7 @@ */ #include "AllClustersCommandDelegate.h" +#include "ValveControlDelegate.h" #include "WindowCoveringManager.h" #include "air-quality-instance.h" #include "dishwasher-mode.h" @@ -38,6 +39,8 @@ #include #include #include +#include +#include #include #include #include @@ -64,6 +67,8 @@ AllClustersCommandDelegate sAllClustersCommandDelegate; Clusters::WindowCovering::WindowCoveringManager sWindowCoveringManager; Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +Clusters::ValveConfigurationAndControl::ValveControlDelegate sValveDelegate; +Clusters::TimeSynchronization::ExtendedTimeSyncDelegate sTimeSyncDelegate; // Please refer to https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/namespaces constexpr const uint8_t kNamespaceCommon = 7; @@ -218,6 +223,9 @@ void ApplicationInit() #endif Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); + Clusters::ValveConfigurationAndControl::SetDefaultDelegate(chip::EndpointId(1), &sValveDelegate); + Clusters::TimeSynchronization::SetDefaultDelegate(&sTimeSyncDelegate); + SetTagList(/* endpoint= */ 0, Span(gEp0TagList)); SetTagList(/* endpoint= */ 1, Span(gEp1TagList)); SetTagList(/* endpoint= */ 2, Span(gEp2TagList)); diff --git a/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.cpp b/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.cpp index 82164afc2427b2..3f97c57a7171fe 100644 --- a/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.cpp +++ b/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.cpp @@ -73,3 +73,8 @@ CHIP_ERROR DefaultTimeSyncDelegate::UpdateTimeUsingNTPFallback(const CharSpan & { return CHIP_ERROR_NOT_IMPLEMENTED; } + +void DefaultTimeSyncDelegate::UTCTimeChanged(uint64_t time) +{ + // placeholder implementation +} diff --git a/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.h b/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.h index a954f51954cb3c..826f1d22d82707 100644 --- a/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.h +++ b/src/app/clusters/time-synchronization-server/DefaultTimeSyncDelegate.h @@ -36,6 +36,7 @@ class DefaultTimeSyncDelegate : public Delegate CHIP_ERROR UpdateTimeFromPlatformSource(chip::Callback::Callback * callback) override; CHIP_ERROR UpdateTimeUsingNTPFallback(const CharSpan & fallbackNTP, chip::Callback::Callback * callback) override; + void UTCTimeChanged(uint64_t time) override; }; } // namespace TimeSynchronization diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h b/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h index a80b3207aff992..1f424e31798c44 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h +++ b/src/app/clusters/time-synchronization-server/time-synchronization-delegate.h @@ -105,6 +105,11 @@ class Delegate virtual CHIP_ERROR UpdateTimeUsingNTPFallback(const CharSpan & fallbackNTP, chip::Callback::Callback * callback) = 0; + /** + * @brief Signals application that UTCTime has changed through the timesync cluster. + */ + virtual void UTCTimeChanged(uint64_t time) = 0; + virtual ~Delegate() = default; private: diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp index 8b285c4a1ad402..fae9565ef21599 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp +++ b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp @@ -776,6 +776,7 @@ CHIP_ERROR TimeSynchronizationServer::SetUTCTime(EndpointId ep, uint64_t utcTime ChipLogError(Zcl, "Error setting UTC time on the device"); return err; } + GetDelegate()->UTCTimeChanged(utcTime); mGranularity = granularity; EmberAfStatus status = TimeSource::Set(ep, source); if (!(status == EMBER_ZCL_STATUS_SUCCESS || status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)) diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-server.h b/src/app/clusters/time-synchronization-server/time-synchronization-server.h index 200714d3cf7def..5eee8e52b000b8 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-server.h +++ b/src/app/clusters/time-synchronization-server/time-synchronization-server.h @@ -69,6 +69,9 @@ enum class TimeSyncEventFlag : uint8_t kMissingTTSource = 16, }; +void SetDefaultDelegate(Delegate * delegate); +Delegate * GetDefaultDelegate(); + class TimeSynchronizationServer : public FabricTable::Delegate #if TIME_SYNC_ENABLE_TSC_FEATURE , diff --git a/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-delegate.h b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-delegate.h new file mode 100644 index 00000000000000..b0d3e5fd14a90d --- /dev/null +++ b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-delegate.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ValveConfigurationAndControl { + +/** @brief + * Defines methods for implementing application-specific logic for the Valve Configuration and Control Cluster. + */ +class Delegate +{ +public: + Delegate(){}; + + // shall return current level if supported, otherwise null + virtual DataModel::Nullable HandleOpenValve(DataModel::Nullable level) = 0; + virtual CHIP_ERROR HandleCloseValve() = 0; + virtual void HandleRemainingDurationTick(uint32_t duration) = 0; + + virtual ~Delegate() = default; +}; + +} // namespace ValveConfigurationAndControl +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp new file mode 100644 index 00000000000000..0f6968f98e5826 --- /dev/null +++ b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.cpp @@ -0,0 +1,521 @@ +/** + * + * 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. + * + */ + +#include "valve-configuration-and-control-server.h" + +#include +#ifdef ZCL_USING_TIME_SYNCHRONIZATION_CLUSTER_SERVER +// Need the `nogncheck` because it's inter-cluster dependency and this +// breaks GN deps checks since that doesn't know how to deal with #ifdef'd includes :(. +#include "app/clusters/time-synchronization-server/time-synchronization-server.h" // nogncheck + +#endif // ZCL_USING_TIME_SYNCHRONIZATION_CLUSTER_SERVER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ValveConfigurationAndControl::Attributes; +using chip::app::Clusters::ValveConfigurationAndControl::Delegate; +using chip::Protocols::InteractionModel::Status; + +static constexpr size_t kValveConfigurationAndControlDelegateTableSize = + EMBER_AF_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; + +static_assert(kValveConfigurationAndControlDelegateTableSize <= kEmberInvalidEndpointIndex, + "ValveConfigurationAndControl Delegate table size error"); + +namespace { + +struct RemainingDurationTable +{ + EndpointId endpoint; + DataModel::Nullable remainingDuration; +}; + +RemainingDurationTable gRemainingDuration[kValveConfigurationAndControlDelegateTableSize]; +Delegate * gDelegateTable[kValveConfigurationAndControlDelegateTableSize] = { nullptr }; + +bool GetRemainingDuration(EndpointId endpoint, DataModel::Nullable & duration) +{ + uint16_t epIdx = emberAfGetClusterServerEndpointIndex(endpoint, ValveConfigurationAndControl::Id, + EMBER_AF_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + VerifyOrReturnValue(epIdx < kValveConfigurationAndControlDelegateTableSize, false); + duration = gRemainingDuration[epIdx].remainingDuration; + return true; +} + +void SetRemainingDuration(EndpointId endpoint, DataModel::Nullable duration) +{ + uint16_t epIdx = emberAfGetClusterServerEndpointIndex(endpoint, ValveConfigurationAndControl::Id, + EMBER_AF_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + if (epIdx < kValveConfigurationAndControlDelegateTableSize) + { + gRemainingDuration[epIdx].endpoint = endpoint; + gRemainingDuration[epIdx].remainingDuration = duration; + } +} + +void SetRemainingDurationNull(EndpointId endpoint) +{ + uint16_t epIdx = emberAfGetClusterServerEndpointIndex(endpoint, ValveConfigurationAndControl::Id, + EMBER_AF_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + if (epIdx < kValveConfigurationAndControlDelegateTableSize) + { + if (!gRemainingDuration[epIdx].remainingDuration.IsNull()) + { + MatterReportingAttributeChangeCallback(endpoint, ValveConfigurationAndControl::Id, RemainingDuration::Id); + } + gRemainingDuration[epIdx].remainingDuration.SetNull(); + } +} + +RemainingDurationTable * GetRemainingDurationItem(EndpointId endpoint) +{ + uint16_t epIdx = emberAfGetClusterServerEndpointIndex(endpoint, ValveConfigurationAndControl::Id, + EMBER_AF_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + if (epIdx < kValveConfigurationAndControlDelegateTableSize) + { + return &gRemainingDuration[epIdx]; + } + return nullptr; +} + +Delegate * GetDelegate(EndpointId endpoint) +{ + uint16_t epIdx = emberAfGetClusterServerEndpointIndex(endpoint, ValveConfigurationAndControl::Id, + EMBER_AF_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + return (epIdx >= kValveConfigurationAndControlDelegateTableSize ? nullptr : gDelegateTable[epIdx]); +} + +bool isDelegateNull(Delegate * delegate) +{ + if (delegate == nullptr) + { + return true; + } + return false; +} + +class ValveConfigAndControlAttrAccess : public AttributeAccessInterface +{ +public: + ValveConfigAndControlAttrAccess() : AttributeAccessInterface(Optional::Missing(), ValveConfigurationAndControl::Id) + {} + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + +private: + CHIP_ERROR ReadRemainingDuration(EndpointId endpoint, AttributeValueEncoder & aEncoder); +}; + +ValveConfigAndControlAttrAccess gAttrAccess; + +CHIP_ERROR ValveConfigAndControlAttrAccess::ReadRemainingDuration(EndpointId endpoint, AttributeValueEncoder & aEncoder) +{ + DataModel::Nullable rDuration; + VerifyOrReturnError(GetRemainingDuration(endpoint, rDuration), CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute)); + + return aEncoder.Encode(rDuration); +} + +CHIP_ERROR ValveConfigAndControlAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + if (aPath.mClusterId != ValveConfigurationAndControl::Id) + { + return CHIP_ERROR_INVALID_PATH_LIST; + } + + switch (aPath.mAttributeId) + { + case RemainingDuration::Id: { + return ReadRemainingDuration(aPath.mEndpointId, aEncoder); + } + default: { + break; + } + } + + return err; +} +} // namespace + +static void startRemainingDurationTick(EndpointId ep); + +static bool emitValveStateChangedEvent(EndpointId ep, ValveConfigurationAndControl::ValveStateEnum state) +{ + ValveConfigurationAndControl::Events::ValveStateChanged::Type event; + EventNumber eventNumber; + event.valveState = state; + + CHIP_ERROR error = LogEvent(event, ep, eventNumber); + + if (CHIP_NO_ERROR != error) + { + ChipLogError(Zcl, "Unable to emit ValveStateChanged event [ep=%d]", ep); + return false; + } + + ChipLogProgress(Zcl, "Emit ValveStateChanged event [ep=%d] %d", ep, to_underlying(state)); + return true; +} + +static CHIP_ERROR emitValveFaultEvent(EndpointId ep, BitMask fault) +{ + ValveConfigurationAndControl::Events::ValveFault::Type event; + EventNumber eventNumber; + event.valveFault = fault; + + CHIP_ERROR error = LogEvent(event, ep, eventNumber); + + if (CHIP_NO_ERROR != error) + { + ChipLogError(Zcl, "Unable to emit ValveFault event [ep=%d]", ep); + return error; + } + + ChipLogProgress(Zcl, "Emit ValveFault event [ep=%d]", ep); + return CHIP_NO_ERROR; +} + +static void onValveConfigurationAndControlTick(System::Layer * systemLayer, void * data) +{ + RemainingDurationTable * item = reinterpret_cast(data); + VerifyOrReturn(item != nullptr, ChipLogError(Zcl, "Error retrieving RemainingDuration item")); + + DataModel::Nullable rDuration = item->remainingDuration; + VerifyOrReturn(!rDuration.IsNull()); + + EndpointId ep = item->endpoint; + + if (rDuration.Value() > 0) + { + SetRemainingDuration(ep, DataModel::MakeNullable(--rDuration.Value())); + startRemainingDurationTick(ep); + } + else + { + SetRemainingDurationNull(ep); + } +} + +void startRemainingDurationTick(EndpointId ep) +{ + RemainingDurationTable * item = GetRemainingDurationItem(ep); + VerifyOrReturn(item != nullptr, ChipLogError(Zcl, "Error retrieving RemainingDuration item")); + + DataModel::Nullable rDuration = item->remainingDuration; + VerifyOrReturn(!rDuration.IsNull()); + Delegate * delegate = GetDelegate(item->endpoint); + VerifyOrReturn(!isDelegateNull(delegate)); + + delegate->HandleRemainingDurationTick(rDuration.Value()); + if (rDuration.Value() > 0) + { + (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onValveConfigurationAndControlTick, item); + } + else + { + ValveConfigurationAndControl::CloseValve(ep); + (void) DeviceLayer::SystemLayer().CancelTimer(onValveConfigurationAndControlTick, item); + } +} + +namespace chip { +namespace app { +namespace Clusters { +namespace ValveConfigurationAndControl { + +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) +{ + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, ValveConfigurationAndControl::Id, + EMBER_AF_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found + if (ep < kValveConfigurationAndControlDelegateTableSize) + { + gDelegateTable[ep] = delegate; + } +} + +Delegate * GetDefaultDelegate(EndpointId endpoint) +{ + return GetDelegate(endpoint); +} + +CHIP_ERROR CloseValve(EndpointId ep) +{ + Delegate * delegate = GetDelegate(ep); + DataModel::Nullable rDuration; + CHIP_ERROR attribute_error = CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kClosed), + attribute_error); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == + CurrentState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning), + attribute_error); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == OpenDuration::SetNull(ep), attribute_error); + if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) + { + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetLevel::Set(ep, 0), attribute_error); + } + if (HasFeature(ep, ValveConfigurationAndControl::Feature::kTimeSync)) + { + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AutoCloseTime::SetNull(ep), attribute_error); + } + SetRemainingDurationNull(ep); + RemainingDurationTable * item = GetRemainingDurationItem(ep); + (void) DeviceLayer::SystemLayer().CancelTimer(onValveConfigurationAndControlTick, item); + + emitValveStateChangedEvent(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning); + if (!isDelegateNull(delegate)) + { + delegate->HandleCloseValve(); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR SetValveLevel(EndpointId ep, DataModel::Nullable level, DataModel::Nullable openDuration) +{ + Delegate * delegate = GetDelegate(ep); + Optional status = Optional::Missing(); + DataModel::Nullable openLevel; + DataModel::Nullable autoCloseTime; + CHIP_ERROR attribute_error = CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + + if (HasFeature(ep, ValveConfigurationAndControl::Feature::kTimeSync)) + { +#ifdef ZCL_USING_TIME_SYNCHRONIZATION_CLUSTER_SERVER + if (!openDuration.IsNull() && + TimeSynchronization::TimeSynchronizationServer::Instance().GetGranularity() != + TimeSynchronization::GranularityEnum::kNoTimeGranularity) + { + System::Clock::Microseconds64 utcTime; + uint64_t chipEpochTime; + ReturnErrorOnFailure(System::SystemClock().GetClock_RealTime(utcTime)); + VerifyOrReturnError(UnixEpochToChipEpochMicros(utcTime.count(), chipEpochTime), CHIP_ERROR_INVALID_TIME); + + uint64_t time = openDuration.Value() * chip::kMicrosecondsPerSecond; + autoCloseTime.SetNonNull(chipEpochTime + time); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AutoCloseTime::Set(ep, autoCloseTime), attribute_error); + } + else + { + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == AutoCloseTime::SetNull(ep), attribute_error); + } +#else + return CHIP_FAILURE; +#endif // ZCL_USING_TIME_SYNCHRONIZATION_CLUSTER_SERVER + } + + // level can only be null if LVL feature is not supported + if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel) && !level.IsNull()) + { + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetLevel::Set(ep, level), attribute_error); + } + + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == OpenDuration::Set(ep, openDuration), attribute_error); + + SetRemainingDuration(ep, openDuration); + // Trigger report for remainingduration + MatterReportingAttributeChangeCallback(ep, ValveConfigurationAndControl::Id, RemainingDuration::Id); + // set targetstate to open + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == TargetState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kOpen), + attribute_error); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == + CurrentState::Set(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning), + attribute_error); + + // start movement towards target + emitValveStateChangedEvent(ep, ValveConfigurationAndControl::ValveStateEnum::kTransitioning); + if (!isDelegateNull(delegate)) + { + DataModel::Nullable cLevel = delegate->HandleOpenValve(level); + if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) + { + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == CurrentLevel::Set(ep, cLevel), attribute_error); + } + } + // start countdown + startRemainingDurationTick(ep); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR UpdateCurrentLevel(EndpointId ep, Percent currentLevel) +{ + if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) + { + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == CurrentLevel::Set(ep, currentLevel), + CHIP_IM_GLOBAL_STATUS(ConstraintError)); + return CHIP_NO_ERROR; + } + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); +} + +CHIP_ERROR UpdateCurrentState(EndpointId ep, ValveConfigurationAndControl::ValveStateEnum currentState) +{ + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == CurrentState::Set(ep, currentState), CHIP_IM_GLOBAL_STATUS(ConstraintError)); + emitValveStateChangedEvent(ep, currentState); + return CHIP_NO_ERROR; +} + +CHIP_ERROR EmitValveFault(EndpointId ep, BitMask fault) +{ + ReturnErrorOnFailure(emitValveFaultEvent(ep, fault)); + return CHIP_NO_ERROR; +} + +void UpdateAutoCloseTime(uint64_t time) +{ + for (auto & t : gRemainingDuration) + { + const auto & d = t.remainingDuration; + if (!d.IsNull() && d.Value() != 0) + { + uint64_t closingTime = d.Value() * chip::kMicrosecondsPerSecond + time; + if (EMBER_ZCL_STATUS_SUCCESS != AutoCloseTime::Set(t.endpoint, closingTime)) + { + ChipLogError(Zcl, "Unable to update AutoCloseTime"); + } + } + } +} +} // namespace ValveConfigurationAndControl +} // namespace Clusters +} // namespace app +} // namespace chip + +bool emberAfValveConfigurationAndControlClusterOpenCallback( + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const ValveConfigurationAndControl::Commands::Open::DecodableType & commandData) +{ + const auto & openDuration = commandData.openDuration; + const auto & targetLevel = commandData.targetLevel; + const auto & ep = commandPath.mEndpointId; + DataModel::Nullable level; + DataModel::Nullable duration; + BitMask fault(0); + Optional status = Optional::Missing(); + + // if fault is registered return FailureDueToFault + if (EMBER_ZCL_STATUS_SUCCESS == ValveFault::Get(ep, &fault) && fault.HasAny()) + { + commandObj->AddClusterSpecificFailure(commandPath, + to_underlying(ValveConfigurationAndControl::StatusCodeEnum::kFailureDueToFault)); + return true; + } + + // verify min 1 requirement + VerifyOrExit(targetLevel.HasValue() ? targetLevel.Value() > 0 : true, status.Emplace(Status::ConstraintError)); + if (openDuration.HasValue()) + { + bool validOpenDuration = openDuration.Value().IsNull() ? true : openDuration.Value().Value() > 0; + // verify min 1 requirement + VerifyOrExit(validOpenDuration, status.Emplace(Status::ConstraintError)); + + duration = openDuration.Value(); + } + else + { + VerifyOrExit(EMBER_ZCL_STATUS_SUCCESS == DefaultOpenDuration::Get(ep, duration), status.Emplace(Status::Failure)); + } + + if (HasFeature(ep, ValveConfigurationAndControl::Feature::kLevel)) + { + Percent defOpenLevel; + if (targetLevel.HasValue()) + { + level.SetNonNull(targetLevel.Value()); + } + else if (EMBER_ZCL_STATUS_SUCCESS == DefaultOpenLevel::Get(ep, &defOpenLevel)) + { + level.SetNonNull(defOpenLevel); + } + else + { + level.SetNonNull(Percent(100)); + } + } + + VerifyOrExit(CHIP_NO_ERROR == ValveConfigurationAndControl::SetValveLevel(ep, level, duration), + status.Emplace(Status::Failure)); + +exit: + if (status.HasValue()) + { + BitMask gFault( + ValveConfigurationAndControl::ValveFaultBitmap::kGeneralFault); + emitValveFaultEvent(ep, gFault); + commandObj->AddStatus(commandPath, status.Value()); + } + else + { + commandObj->AddStatus(commandPath, Status::Success); + } + + return true; +} + +bool emberAfValveConfigurationAndControlClusterCloseCallback( + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const ValveConfigurationAndControl::Commands::Close::DecodableType & commandData) +{ + const auto & ep = commandPath.mEndpointId; + BitMask fault(0); + + // if fault is registered return FailureDueToFault + if (EMBER_ZCL_STATUS_SUCCESS == ValveFault::Get(ep, &fault) && fault.HasAny()) + { + commandObj->AddClusterSpecificFailure(commandPath, + to_underlying(ValveConfigurationAndControl::StatusCodeEnum::kFailureDueToFault)); + return true; + } + + if (CHIP_NO_ERROR == ValveConfigurationAndControl::CloseValve(ep)) + { + commandObj->AddStatus(commandPath, Status::Success); + } + else + { + commandObj->AddStatus(commandPath, Status::Failure); + } + + return true; +} + +void MatterValveConfigurationAndControlPluginServerInitCallback() +{ + registerAttributeAccessOverride(&gAttrAccess); +} diff --git a/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h new file mode 100644 index 00000000000000..6f46e8cc6356e4 --- /dev/null +++ b/src/app/clusters/valve-configuration-and-control-server/valve-configuration-and-control-server.h @@ -0,0 +1,59 @@ +/** + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file API declarations for valve configuration and control cluster. + */ + +#pragma once + +#include "valve-configuration-and-control-delegate.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ValveConfigurationAndControl { + +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate); +Delegate * GetDefaultDelegate(EndpointId endpoint); + +CHIP_ERROR CloseValve(chip::EndpointId ep); +CHIP_ERROR SetValveLevel(chip::EndpointId ep, chip::Percent level, DataModel::Nullable openDuration); +CHIP_ERROR UpdateCurrentLevel(chip::EndpointId ep, chip::Percent currentLevel); +CHIP_ERROR UpdateCurrentState(chip::EndpointId ep, ValveConfigurationAndControl::ValveStateEnum currentState); +CHIP_ERROR EmitValveFault(chip::EndpointId ep, chip::BitMask fault); +void UpdateAutoCloseTime(uint64_t time); + +inline bool HasFeature(EndpointId ep, Feature feature) +{ + uint32_t map; + bool success = (Attributes::FeatureMap::Get(ep, &map) == EMBER_ZCL_STATUS_SUCCESS); + return success ? (map & to_underlying(feature)) : false; +} + +} // namespace ValveConfigurationAndControl +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 98c475d608864e..2f43df991a345c 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -160,7 +160,6 @@ void MatterRvcOperationalStatePluginServerInitCallback() {} void MatterOvenModePluginServerInitCallback() {} void MatterDishwasherAlarmPluginServerInitCallback() {} void MatterBooleanStateConfigurationPluginServerInitCallback() {} -void MatterValveConfigurationAndControlPluginServerInitCallback() {} void MatterMicrowaveOvenModePluginServerInitCallback() {} // **************************************** // Print out information about each cluster 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 634f66606f6a60..83b541897d7abc 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -559,7 +559,8 @@ "CumulativeEnergyExported", "PeriodicEnergyImported", "PeriodicEnergyExported" - ] + ], + "Valve Configuration and Control": ["RemainingDuration"] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index a0556e6da7ebb2..0e0e0f925f7885 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -557,7 +557,8 @@ "CumulativeEnergyExported", "PeriodicEnergyImported", "PeriodicEnergyExported" - ] + ], + "Valve Configuration and Control": ["RemainingDuration"] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index a7f1c8e58dca6f..021cc8aa466f4d 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -285,7 +285,9 @@ "UNIT_LOCALIZATION_CLUSTER": [], "UNIT_TESTING_CLUSTER": ["test-cluster-server"], "USER_LABEL_CLUSTER": ["user-label-server"], - "VALVE_CONFIGURATION_AND_CONTROL_CLUSTER": [], + "VALVE_CONFIGURATION_AND_CONTROL_CLUSTER": [ + "valve-configuration-and-control-server" + ], "WAKE_ON_LAN_CLUSTER": ["wake-on-lan-server"], "LAUNDRY_WASHER_CONTROLS_CLUSTER": ["laundry-washer-controls-server"], "LAUNDRY_DRYER_CONTROLS_CLUSTER": ["laundry-dryer-controls-server"], 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 2b6fd6141b5888..7aa3b7083e4241 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 @@ -9792,59 +9792,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullabl } // namespace AutoCloseTime -namespace RemainingDuration { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::ValveConfigurationAndControl::Id, Id, writable, ZCL_ELAPSED_S_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace RemainingDuration - namespace CurrentState { EmberAfStatus Get(chip::EndpointId endpoint, 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 47d04b2b2df1ae..e85f61f4be3882 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 @@ -1910,13 +1910,6 @@ EmberAfStatus SetNull(chip::EndpointId endpoint); EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace AutoCloseTime -namespace RemainingDuration { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // elapsed_s -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace RemainingDuration - namespace CurrentState { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // ValveStateEnum From 5c83c591a84b67481a71e7c09e8f4736a09585fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:28:29 +0000 Subject: [PATCH 126/143] Bump third_party/mbedtls/repo from `ffb18d2` to `56fd26c` (#31422) Bumps [third_party/mbedtls/repo](https://github.com/ARMmbed/mbedtls) from `ffb18d2` to `56fd26c`. - [Release notes](https://github.com/ARMmbed/mbedtls/releases) - [Commits](https://github.com/ARMmbed/mbedtls/compare/ffb18d2012909c05277a1e16dc6ba23dc8ba2854...56fd26cee97531f223071b91ed108dc1e22e7a85) --- updated-dependencies: - dependency-name: third_party/mbedtls/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/mbedtls/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/mbedtls/repo b/third_party/mbedtls/repo index ffb18d2012909c..56fd26cee97531 160000 --- a/third_party/mbedtls/repo +++ b/third_party/mbedtls/repo @@ -1 +1 @@ -Subproject commit ffb18d2012909c05277a1e16dc6ba23dc8ba2854 +Subproject commit 56fd26cee97531f223071b91ed108dc1e22e7a85 From 44998bacb5a73cd57065239411cf38590ce2b75c Mon Sep 17 00:00:00 2001 From: Marius Tache <102153746+marius-alex-tache@users.noreply.github.com> Date: Mon, 15 Jan 2024 18:52:54 +0200 Subject: [PATCH 127/143] [K32W0] SDK 2.6.13 additional changes (#31382) * [K32W] Fix a corner case when switching the TLV processors After the current block is processed, if the block size is 0, it means that the processed data was a multiple of received BDX block size (e.g. 8 blocks of 1024 bytes were transferred). After state for selecting next processor is reset, a request for fetching next data must be sent. Signed-off-by: marius-alex-tache * [K32W] Make Validate public Change access modifier of Validate to public, to be used by K32W0 for factory data validation after factory data OTA. Signed-off-by: marius-alex-tache * [K32W0] Add CRC validation during factory data OTA After factory data is copied into internal flash, call Validate to ensure the CRC of factory data matches the CRC in the header. If the check fails, then OTA is aborted and factory data is restored to previous version. Signed-off-by: marius-alex-tache * [K32W0] Add additional check for provider pointer Signed-off-by: marius-alex-tache * [K32W0] Change root node revision to 2 Signed-off-by: marius-alex-tache * [K32W] Expose SearchForId in factory data provider public API Removed additional checks on tags with the assumption that factory data is strictly checked at manufacturing time. Applications can now use the public API to search the factory data section for an id, e.g. in the case of custom factory data provider, where the app has additional factory data information besides the default one. Signed-off-by: marius-alex-tache * [K32W0] Refactor custom factory data provider The example now leverages the actual factory data provider API to search the factory data section for some custom ids. Signed-off-by: marius-alex-tache * [K32W] Add platform support for Product Appearance Implement GetProductFinish and GetProductPrimaryColor defined in DeviceInstanceInfoProvider. Signed-off-by: marius-alex-tache * [K32W] Remove maxLengths array This array was used to store the maximum length of factory data fields. It's no longer used, with the assumption that the factory data is strictly checked in manufacturing. Signed-off-by: marius-alex-tache * [K32W0] Remove usage of maxLength array Signed-off-by: marius-alex-tache * [K32W0] remove unused code in LowPowerHook.cpp file * [K32W0] use Encoding::HexToBytes to parse the ota encryption key * [K32W0] remove extra PWR_DisallowDeviceToSleep() which will cause unsleep after commissioning * [K32W] Revert removal of disallow to sleep and enclose it in specific tag Only call disallow to sleep when the platform is K32W1. Signed-off-by: marius-alex-tache * [K32W0] Update reference app readme files This is a minor improvement to the building instructions. It aims to clarify the usage of west SDK or package SDK. Signed-off-by: marius-alex-tache * [K32W0] Fix ICD parameters Name of the ICD parameters were updated according with the latest stack updates. Signed-off-by: Andrei Menzopol * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * [K32W0] Fix gn check error Signed-off-by: marius-alex-tache * Restyled by gn * [K32W1] Fix gn check errors Signed-off-by: marius-alex-tache * Restyled by gn * [K32W1] Fix another gn error Signed-off-by: marius-alex-tache * Restyled by gn * [K32W] Send a report before resetting the device during OTA State-transition event from Downloading to Applying was not successfully sent to a subscriber during OTA because the device would reset before actually sending the ReportData message. Added an explicit call to handle server shutting down, which will sync send all events. Signed-off-by: marius-alex-tache * Restyled by clang-format * [K32W0] Remove deprecated dependency Signed-off-by: marius-alex-tache * [K32W1] Remove deprecated dependency Signed-off-by: marius-alex-tache * Restyled by gn --------- Signed-off-by: marius-alex-tache Signed-off-by: Andrei Menzopol Co-authored-by: Damien Vagner Co-authored-by: tanyue518 Co-authored-by: Ethan Tan Co-authored-by: Andrei Menzopol Co-authored-by: Restyled.io --- .../contact-sensor-app.matter | 2 +- .../contact-sensor-app.zap | 4 +- .../nxp/k32w/k32w0/BUILD.gn | 5 +- .../nxp/k32w/k32w0/README.md | 56 ++++++++------- .../k32w/k32w0/include/CHIPProjectConfig.h | 7 -- .../nxp/k32w/k32w0/main/AppTask.cpp | 8 ++- .../nxp/k32w/k32w0/main/include/AppTask.h | 9 --- examples/lighting-app/nxp/k32w/k32w0/BUILD.gn | 5 +- .../lighting-app/nxp/k32w/k32w0/README.md | 66 ++++++++--------- .../k32w/k32w0/include/CHIPProjectConfig.h | 7 -- .../nxp/k32w/k32w0/main/AppTask.cpp | 8 ++- .../nxp/k32w/k32w0/main/include/AppTask.h | 9 --- examples/lighting-app/nxp/k32w/k32w1/BUILD.gn | 2 + examples/lock-app/nxp/k32w/k32w0/BUILD.gn | 5 +- examples/lock-app/nxp/k32w/k32w0/README.md | 72 ++++++++++--------- .../k32w/k32w0/include/CHIPProjectConfig.h | 7 -- .../lock-app/nxp/k32w/k32w0/main/AppTask.cpp | 8 ++- .../nxp/k32w/k32w0/main/include/AppTask.h | 9 --- .../common/CustomFactoryDataProvider.cpp | 21 ++---- .../k32w0/common/CustomFactoryDataProvider.h | 13 ++-- .../platform/nxp/k32w/k32w0/common/README.md | 36 ++++------ .../nxp/k32w/common/BLEManagerCommon.cpp | 5 ++ .../nxp/k32w/common/FactoryDataProvider.cpp | 55 +++++++------- .../nxp/k32w/common/FactoryDataProvider.h | 20 ++---- .../nxp/k32w/common/OTAImageProcessorImpl.cpp | 16 ++++- .../nxp/k32w/common/OTATlvProcessor.cpp | 17 ++--- .../nxp/k32w/common/OTATlvProcessor.h | 2 + .../nxp/k32w/k32w0/CHIPPlatformConfig.h | 12 ++-- .../k32w/k32w0/FactoryDataProviderImpl.cpp | 16 ----- .../nxp/k32w/k32w0/FactoryDataProviderImpl.h | 8 --- src/platform/nxp/k32w/k32w0/LowPowerHooks.cpp | 19 ----- .../k32w/k32w0/OTAFactoryDataProcessor.cpp | 14 +++- src/platform/nxp/k32w/k32w1/BUILD.gn | 4 ++ 33 files changed, 234 insertions(+), 313 deletions(-) diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter index 6065ce3b36efc0..6023f53fa18bba 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter @@ -1631,7 +1631,7 @@ cluster OccupancySensing = 1030 { } endpoint 0 { - device type ma_rootdevice = 22, version 1; + device type ma_rootdevice = 22, version 2; binding cluster OtaSoftwareUpdateProvider; diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap index b37968d2d15978..8c58d93a8a6b41 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap @@ -51,7 +51,7 @@ } ], "deviceVersions": [ - 1 + 2 ], "deviceIdentifiers": [ 22 @@ -4748,4 +4748,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn index 36f52d917f22db..cc87b4fc1532d6 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn @@ -93,10 +93,7 @@ k32w0_executable("contact_sensor_app") { "${k32w0_platform_dir}/common/CustomFactoryDataProvider.h", ] - defines = [ - "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1", - "CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS=3", - ] + defines = [ "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1" ] } deps = [ diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md index f616ddfeeca4f9..27ae15b672eb05 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md @@ -177,56 +177,58 @@ contact status. In order to build the Project CHIP example, we recommend using a Linux distribution (the demo-application was compiled on Ubuntu 20.04). -- Start building the application either with Secure Element or without, SDK is - downloaded with west tool. +Activate the Matter environment: - - without Secure Element +```bash +user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh +``` - ``` - user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh +To bring the SDK in the environment, the user can: + +- download it with west tool, in which case it will be handled automatically + by gn: + + ```bash user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update ``` - In case there are local modification to the already installed git NXP SDK: - Use the below west `forall` command instead of the west init command to - reset the west workspace. Warning: all local changes will be lost after + In case there are local modification to the already installed github NXP + SDK, use the below `west forall` command instead of the `west init` command + to reset the west workspace. Warning: all local changes will be lost after running this command. ```bash user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo - user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$west forall -c "git reset --hard && git clean -xdf" -a + user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west forall -c "git reset --hard && git clean -xdf" -a ``` - Build the application - - Prior to building, the user can specify a custom `SDK` path by setting - `NXP_K32W0_SDK_ROOT`: +- set up a custom path to the SDK, in which case + `k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\"` must be added to the `gn gen` + command: ``` - user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=$(pwd)/third_party/nxp/k32w0_sdk/repo/core + user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/custom/path/to/SDK ``` - If the environment variable `NXP_K32W0_SDK_ROOT` is not set, it will default - to the `SDK` found in `third_party/nxp/k32w0_sdk/repo/core`. +Start building the application: - ``` - user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/contact-sensor-app/nxp/k32w/k32w0 - user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w0$ gn gen out/debug --args="chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"platform\" chip_with_se05x=0 chip_pw_tokenizer_logging=true" - user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w0$ ninja -C out/debug - ``` +```bash +user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/contact-sensor-app/nxp/k32w/k32w0 +user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w0$ gn gen out/debug --args="chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"platform\" chip_with_se05x=0 chip_pw_tokenizer_logging=true" +user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w0$ ninja -C out/debug +``` - - with Secure element Exactly the same steps as above but set - chip_with_se05x=1 in the gn command and add argument - chip_enable_ota_requestor=false +To build with Secure Element, follow the same steps as above but set +`chip_with_se05x=1 chip_enable_ota_requestor=false` in the `gn gen` command. -Note that option chip_enable_ota_requestor=false are required for building with -Secure Element. These can be changed if building without Secure Element +Note that option `chip_enable_ota_requestor=false` is required for building with +Secure Element due to flash constraints. - K32W041AM flavor - Exactly the same steps as above but set argument build_for_k32w041am=1 in + Exactly the same steps as above but set argument `build_for_k32w041am=1` in the gn command. Also, in case the OM15082 Expansion Board is not attached to the DK6 board, the diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index b48b97c55e6f94..72f94878cf328f 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -48,13 +48,6 @@ #define CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER 0 #endif -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER -#ifndef CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS -// Set to 3: default number of custom Ids from CustomFactoryDataProvider example -#define CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS 3 -#endif -#endif - // VID/PID for product => will be used by Basic Information Cluster #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037 #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA220 diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp index 484ddce1b7ce1b..5c942db19b3af5 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -85,7 +85,10 @@ using namespace chip::app; AppTask AppTask::sAppTask; #if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -static AppTask::FactoryDataProvider sFactoryDataProvider; +static chip::DeviceLayer::FactoryDataProviderImpl sFactoryDataProvider; +#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER +static chip::DeviceLayer::CustomFactoryDataProvider sCustomFactoryDataProvider; +#endif #endif static Identify gIdentify = { chip::EndpointId{ 1 }, AppTask::OnIdentifyStart, AppTask::OnIdentifyStop, @@ -199,6 +202,9 @@ CHIP_ERROR AppTask::Init() SetDeviceInstanceInfoProvider(&sFactoryDataProvider); SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); SetCommissionableDataProvider(&sFactoryDataProvider); +#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER + sCustomFactoryDataProvider.ParseFunctionExample(); +#endif #else #ifdef ENABLE_HSM_DEVICE_ATTESTATION SetDeviceAttestationCredentialsProvider(Examples::GetExampleSe05xDACProvider()); diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h b/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h index 58effbdba14162..867a496de1e56d 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h @@ -49,15 +49,6 @@ class AppTask { -public: -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER - using FactoryDataProvider = chip::DeviceLayer::CustomFactoryDataProvider; -#else - using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl; -#endif -#endif - public: CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); diff --git a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn index a71bf63dc6d4e0..93bf1dc363f9dd 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn @@ -95,10 +95,7 @@ k32w0_executable("light_app") { "${k32w0_platform_dir}/common/CustomFactoryDataProvider.h", ] - defines = [ - "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1", - "CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS=3", - ] + defines = [ "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1" ] } deps = [ diff --git a/examples/lighting-app/nxp/k32w/k32w0/README.md b/examples/lighting-app/nxp/k32w/k32w0/README.md index b43a08622eb330..3194d71b39b889 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/README.md +++ b/examples/lighting-app/nxp/k32w/k32w0/README.md @@ -192,58 +192,58 @@ effects: In order to build the Project CHIP example, we recommend using a Linux distribution (the demo-application was compiled on Ubuntu 20.04). -- Start building the application either with Secure Element or without, SDK is - downloaded with west tool. - - without Secure Element +Activate the Matter environment: -``` +```bash user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh -user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo -user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml -user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update ``` -In case there are local modification to the already installed git NXP SDK: Use -the below west `forall` command instead of the west init command to reset the -west workspace. Warning: all local changes will be lost after running this -command. +To bring the SDK in the environment, the user can: -```bash -user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo -user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$west forall -c "git reset --hard && git clean -xdf" -a -``` +- download it with west tool, in which case it will be handled automatically + by gn: -Build the application + ```bash + user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo + user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml + user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update + ``` -Prior to building, the user can specify a custom `SDK` path by setting -`NXP_K32W0_SDK_ROOT`: + In case there are local modification to the already installed github NXP + SDK, use the below `west forall` command instead of the `west init` command + to reset the west workspace. Warning: all local changes will be lost after + running this command. -``` -user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=$(pwd)/third_party/nxp/k32w0_sdk/repo/core -``` + ```bash + user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo + user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west forall -c "git reset --hard && git clean -xdf" -a + ``` + +- set up a custom path to the SDK, in which case + `k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\"` must be added to the `gn gen` + command: -If the environment variable `NXP_K32W0_SDK_ROOT` is not set, it will default to -the `SDK` found in `third_party/nxp/k32w0_sdk/repo/core`. + ``` + user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/custom/path/to/SDK + ``` -``` +Start building the application: + +```bash user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/nxp/k32w/k32w0 user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w0$ gn gen out/debug --args="chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"platform\" chip_with_se05x=0 chip_pw_tokenizer_logging=true" user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w0$ ninja -C out/debug ``` - - with Secure element - -``` - Exactly the same steps as above but set chip_with_se05x=1 in the gn command - and add argument chip_enable_ota_requestor=false -``` +To build with Secure Element, follow the same steps as above but set +`chip_with_se05x=1 chip_enable_ota_requestor=false` in the `gn gen` command. -Note that option chip_enable_ota_requestor=false are required for building with -Secure Element. These can be changed if building without Secure Element +Note that option `chip_enable_ota_requestor=false` is required for building with +Secure Element due to flash constraints. - K32W041AM flavor - Exactly the same steps as above but set argument build_for_k32w041am=1 in + Exactly the same steps as above but set argument `build_for_k32w041am=1` in the gn command. Also, in case the OM15082 Expansion Board is not attached to the DK6 board, the diff --git a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 10019a4268cad2..946d457622e467 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -48,13 +48,6 @@ #define CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER 0 #endif -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER -#ifndef CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS -// Set to 3: default number of custom Ids from CustomFactoryDataProvider example -#define CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS 3 -#endif -#endif - // VID/PID for product => will be used by Basic Information Cluster #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037 #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA220 diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index e63c35a1489ee0..557293f6bac2aa 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -85,7 +85,10 @@ using namespace chip::app; AppTask AppTask::sAppTask; #if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -static AppTask::FactoryDataProvider sFactoryDataProvider; +static chip::DeviceLayer::FactoryDataProviderImpl sFactoryDataProvider; +#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER +static chip::DeviceLayer::CustomFactoryDataProvider sCustomFactoryDataProvider; +#endif #endif // This key is for testing/certification only and should not be used in production devices. @@ -190,6 +193,9 @@ CHIP_ERROR AppTask::Init() SetDeviceInstanceInfoProvider(&sFactoryDataProvider); SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); SetCommissionableDataProvider(&sFactoryDataProvider); +#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER + sCustomFactoryDataProvider.ParseFunctionExample(); +#endif #else #ifdef ENABLE_HSM_DEVICE_ATTESTATION SetDeviceAttestationCredentialsProvider(Examples::GetExampleSe05xDACProvider()); diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h b/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h index 83dfd33da2abd9..9590734521d5e1 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h +++ b/examples/lighting-app/nxp/k32w/k32w0/main/include/AppTask.h @@ -49,15 +49,6 @@ class AppTask { -public: -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER - using FactoryDataProvider = chip::DeviceLayer::CustomFactoryDataProvider; -#else - using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl; -#endif -#endif - public: CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); diff --git a/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn index fd095a2cb197c5..a7643a9f847931 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn @@ -82,6 +82,8 @@ k32w1_executable("light_app") { "main/main.cpp", ] + public = [ "${chip_root}/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h" ] + deps = [ ":sdk", "${chip_root}/examples/common/QRCode", diff --git a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn index 0b752583604a89..c755514d66a175 100644 --- a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn @@ -92,10 +92,7 @@ k32w0_executable("lock_app") { "${k32w0_platform_dir}/common/CustomFactoryDataProvider.h", ] - defines = [ - "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1", - "CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS=3", - ] + defines = [ "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1" ] } deps = [ diff --git a/examples/lock-app/nxp/k32w/k32w0/README.md b/examples/lock-app/nxp/k32w/k32w0/README.md index b5fec55268371c..49920906819b0f 100644 --- a/examples/lock-app/nxp/k32w/k32w0/README.md +++ b/examples/lock-app/nxp/k32w/k32w0/README.md @@ -173,59 +173,67 @@ will be initiated. In order to build the Project CHIP example, we recommend using a Linux distribution (the demo-application was compiled on Ubuntu 20.04). -- Start building the application either with Secure Element or without, SDK is - downloaded with west tool. +Activate the Matter environment: - - without Secure Element - -``` +```bash user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh -user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo -user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml -user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update ``` -In case there are local modification to the already installed git NXP SDK: Use -the below west `forall` command instead of the west init command to reset the -west workspace. Warning: all local changes will be lost after running this -command. +To bring the SDK in the environment, the user can: -```bash -user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo -user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$west forall -c "git reset --hard && git clean -xdf" -a -``` +- download it with west tool, in which case it will be handled automatically + by gn: -Build the application + ```bash + user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo + user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml + user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update + ``` -Prior to building, the user can specify a custom `SDK` path by setting -`NXP_K32W0_SDK_ROOT`: + In case there are local modification to the already installed github NXP + SDK, use the below `west forall` command instead of the `west init` command + to reset the west workspace. Warning: all local changes will be lost after + running this command. -``` -user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=$(pwd)/third_party/nxp/k32w0_sdk/repo/core -``` + ```bash + user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo + user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west forall -c "git reset --hard && git clean -xdf" -a + ``` -If the environment variable `NXP_K32W0_SDK_ROOT` is not set, it will default to -the `SDK` found in `third_party/nxp/k32w0_sdk/repo/core`. +- set up a custom path to the SDK, in which case + `k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\"` must be added to the `gn gen` + command: -``` + ``` + user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/custom/path/to/SDK + ``` + +Start building the application: + +```bash user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lock-app/nxp/k32w/k32w0 user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/nxp/k32w/k32w0$ gn gen out/debug --args="chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"platform\" chip_with_se05x=0 chip_pw_tokenizer_logging=true" user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/nxp/k32w/k32w0$ ninja -C out/debug ``` - - with Secure element - Exactly the same steps as above but set chip_with_se05x=1 in the gn command. +To build with Secure Element, follow the same steps as above but set +`chip_with_se05x=1` in the `gn gen` command. + +- K32W041AM flavor + + Exactly the same steps as above but set argument `build_for_k32w041am=1` in + the gn command. Also, in case the OM15082 Expansion Board is not attached to the DK6 board, the -build argument (chip_with_OM15082) inside the gn build instruction should be set -to zero. The argument chip_with_OM15082 is set to zero by default. +build argument (`chip_with_OM15082`) inside the gn build instruction should be +set to zero. The argument `chip_with_OM15082` is set to zero by default. -In case that Openthread CLI is needed, chip_with_ot_cli build argument must be +In case that Openthread CLI is needed, `chip_with_ot_cli` build argument must be set to 1. In case the board doesn't have 32KHz crystal fitted, one can use the 32KHz free -running oscillator as a clock source. In this case one must set the use_fro_32k -argument to 1. +running oscillator as a clock source. In this case one must set the +`use_fro_32k` argument to 1. In case signing errors are encountered when running the "sign_images.sh" script (run automatically) install the recommanded packages (python version > 3, pip3, diff --git a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index c74714bded920f..43598870fb7533 100644 --- a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -48,13 +48,6 @@ #define CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER 0 #endif -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER -#ifndef CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS -// Set to 3: default number of custom Ids from CustomFactoryDataProvider example -#define CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS 3 -#endif -#endif - // VID/PID for product => will be used by Basic Information Cluster #define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x1037 #define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xA220 diff --git a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp index fff749b311678e..130569791e2e8e 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -71,7 +71,10 @@ using namespace ::chip::DeviceLayer; AppTask AppTask::sAppTask; #if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -static AppTask::FactoryDataProvider sFactoryDataProvider; +static chip::DeviceLayer::FactoryDataProviderImpl sFactoryDataProvider; +#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER +static chip::DeviceLayer::CustomFactoryDataProvider sCustomFactoryDataProvider; +#endif #endif CHIP_ERROR AppTask::StartAppTask() @@ -102,6 +105,9 @@ CHIP_ERROR AppTask::Init() SetDeviceInstanceInfoProvider(&sFactoryDataProvider); SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); SetCommissionableDataProvider(&sFactoryDataProvider); +#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER + sCustomFactoryDataProvider.ParseFunctionExample(); +#endif #else #ifdef ENABLE_HSM_DEVICE_ATTESTATION SetDeviceAttestationCredentialsProvider(Examples::GetExampleSe05xDACProvider()); diff --git a/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h b/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h index cbaa5757374497..1addd9236c4bcf 100644 --- a/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h +++ b/examples/lock-app/nxp/k32w/k32w0/main/include/AppTask.h @@ -40,15 +40,6 @@ class AppTask { -public: -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER - using FactoryDataProvider = chip::DeviceLayer::CustomFactoryDataProvider; -#else - using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl; -#endif -#endif - public: CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); diff --git a/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.cpp b/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.cpp index 18e809509fc803..7f2f6d9bc0cad0 100644 --- a/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.cpp +++ b/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.cpp @@ -24,21 +24,10 @@ static constexpr size_t kMaxLengthCustomId1 = 10; static constexpr size_t kMaxLengthCustomId2 = 50; static constexpr size_t kMaxLengthCustomId3 = 100; -CustomFactoryDataProvider & CustomFactoryDataProvider::GetDefaultInstance() +CustomFactoryDataProvider::CustomFactoryDataProvider() { - static CustomFactoryDataProvider sInstance; - return sInstance; -} - -CHIP_ERROR CustomFactoryDataProvider::SetCustomIds() -{ - static_assert(CustomFactoryIds::kCustomMaxId == FactoryDataProvider::kNumberOfIds, - "kNumberOfIds is computed based on CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS."); - maxLengths[CustomFactoryIds::kCustomId1] = kMaxLengthCustomId1; - maxLengths[CustomFactoryIds::kCustomId2] = kMaxLengthCustomId2; - maxLengths[CustomFactoryIds::kCustomId3] = kMaxLengthCustomId3; - - return CHIP_NO_ERROR; + // Custom ids should be from a range that does not overlap with the standard factory data range. + static_assert((uint16_t) CustomFactoryIds::kCustomId1 >= (uint16_t) FactoryDataProvider::FactoryDataId::kMaxId); } CHIP_ERROR CustomFactoryDataProvider::ParseFunctionExample() @@ -49,7 +38,9 @@ CHIP_ERROR CustomFactoryDataProvider::ParseFunctionExample() uint16_t userDataSize = 0; // A user can use FactoryDataProvider::SearchForId to read an id from internal // flash factory data section. - ReturnErrorOnFailure(SearchForId(CustomFactoryIds::kCustomId1, buffer.data(), buffer.size(), userDataSize)); + auto * provider = static_cast(DeviceLayer::GetDeviceInstanceInfoProvider()); + ReturnErrorOnFailure((provider != nullptr) ? CHIP_NO_ERROR : CHIP_ERROR_INVALID_ADDRESS); + ReturnErrorOnFailure(provider->SearchForId(CustomFactoryIds::kCustomId1, buffer.data(), buffer.size(), userDataSize)); // Data should now be ready for custom parsing. diff --git a/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.h b/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.h index 9edd603b4677c8..dfb722d67fdc11 100644 --- a/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.h +++ b/examples/platform/nxp/k32w/k32w0/common/CustomFactoryDataProvider.h @@ -27,26 +27,21 @@ namespace DeviceLayer { * provider based on this example. */ -class CustomFactoryDataProvider : public FactoryDataProviderImpl +class CustomFactoryDataProvider { public: - /* Custom IDs should start from FactoryDataId::kMaxId, which is + /* Custom IDs should start from at least FactoryDataId::kMaxId, which is * the next available valid ID. Last default ID is kMaxId - 1. */ enum CustomFactoryIds { - kCustomId1 = FactoryDataId::kMaxId, + kCustomId1 = 200, // Random id that is greater than FactoryDataId::kMaxId. kCustomId2, kCustomId3, kCustomMaxId }; - static CustomFactoryDataProvider & GetDefaultInstance(); - - CustomFactoryDataProvider() {} - - /* SetCustomIds() must be implemented in order to define custom IDs. */ - CHIP_ERROR SetCustomIds() override; + CustomFactoryDataProvider(); /* Declare here custom functions to be implemented. */ CHIP_ERROR ParseFunctionExample(); diff --git a/examples/platform/nxp/k32w/k32w0/common/README.md b/examples/platform/nxp/k32w/k32w0/common/README.md index 459f62f049e337..59347d6bfd205d 100644 --- a/examples/platform/nxp/k32w/k32w0/common/README.md +++ b/examples/platform/nxp/k32w/k32w0/common/README.md @@ -12,10 +12,11 @@ following interfaces: - DeviceAttestationCredentialsProvider - DeviceInstanceInfoProvider -A user can inherit `FactoryDataProviderImpl` to provide additional functionality -(such as parsing custom factory data fields) that is customer specific. +A user can use `FactoryDataProvider::SearchForId` API to extract information +about custom factory data ids. -What **shall** be done to enable usage of a custom factory provider: +What **shall** be done to enable usage of a custom factory provider in the +reference app: - Set `use_custom_factory_provider=1`. This option is only available when factory data is used (`chip_with_factory_data=1`). An assert will be raised @@ -33,28 +34,15 @@ What **shall** be done to enable usage of a custom factory provider: defines = [ "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1", - "CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS=3" ] } ``` - Note that new flags were introduced: - - - `CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER`: select between using - `FactoryDataProviderImpl` or `CustomFactoryDataProvider` when - registering the provider. - - `CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS`: set the number of - custom IDs (which are different than the default IDs). If this macro is - not correctly set, compilation should fail. - -- The default IDs are validated directly in `SearchForId`, but custom IDs - should set their maximum lengths through `SetCustomIds` method. -- `FactoryDataProvider::kNumberOfIds` is computed at compile time and should - represent the number of IDs (custom + default). Custom IDs should start from - `FactoryDataId::kMaxId`, which is the next valid ID. IDs - `[1, FactoryDataId::kMaxId - 1]` are reserved for default factory data IDs. - -Please refer to `CustomFactoryDataProvider` for a minimal example of a custom -factory data provider and note that its implementation is just an example of how -to integrate a custom provider into the application, while still using the -default implementation provided by `FactoryDataProviderImpl`. +Note that new flags were introduced: + +- `CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER`: add custom factory data related + code in reference app. + +Please refer to `CustomFactoryDataProvider` for a minimal example of leveraging +the standard factory data provider to parse custom factory data information. +Real applications could use the public API of `FactoryDataProvider` directly. diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp index 5d20035aa99940..d6aa5f2e939251 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp @@ -1174,9 +1174,14 @@ void BLEManagerCommon::blekw_gap_connection_cb(deviceId_t deviceId, gapConnectio if (pConnectionEvent->eventType == gConnEvtConnected_c) { +#if CHIP_DEVICE_K32W1 #if defined(chip_with_low_power) && (chip_with_low_power == 1) + /* Disallow must be called here for K32W1, otherwise an assert will be reached. + * Disclaimer: this is a workaround until a better cross platform solution is found. */ PWR_DisallowDeviceToSleep(); #endif +#endif + #if CHIP_DEVICE_CONFIG_BLE_SET_PHY_2M_REQ ChipLogProgress(DeviceLayer, "BLE K32W: Trying to set the PHY to 2M"); diff --git a/src/platform/nxp/k32w/common/FactoryDataProvider.cpp b/src/platform/nxp/k32w/common/FactoryDataProvider.cpp index 315811cbf32442..1770cf22c659f0 100644 --- a/src/platform/nxp/k32w/common/FactoryDataProvider.cpp +++ b/src/platform/nxp/k32w/common/FactoryDataProvider.cpp @@ -44,31 +44,6 @@ uint32_t FactoryDataProvider::kFactoryDataStart = (uint32_t) __MATTER_FAC uint32_t FactoryDataProvider::kFactoryDataSize = (uint32_t) __MATTER_FACTORY_DATA_SIZE; uint32_t FactoryDataProvider::kFactoryDataPayloadStart = kFactoryDataStart + sizeof(FactoryDataProvider::Header); -FactoryDataProvider::FactoryDataProvider() -{ - maxLengths[FactoryDataId::kVerifierId] = kSpake2pSerializedVerifier_MaxBase64Len; - maxLengths[FactoryDataId::kSaltId] = kSpake2pSalt_MaxBase64Len; - maxLengths[FactoryDataId::kIcId] = sizeof(uint32_t); - maxLengths[FactoryDataId::kDacPrivateKeyId] = Crypto::kP256_PrivateKey_Length; - maxLengths[FactoryDataId::kDacCertificateId] = Credentials::kMaxDERCertLength; - maxLengths[FactoryDataId::kPaiCertificateId] = Credentials::kMaxDERCertLength; - maxLengths[FactoryDataId::kDiscriminatorId] = sizeof(uint32_t); - maxLengths[FactoryDataId::kSetupPasscodeId] = sizeof(uint32_t); - maxLengths[FactoryDataId::kVidId] = sizeof(uint16_t); - maxLengths[FactoryDataId::kPidId] = sizeof(uint16_t); - maxLengths[FactoryDataId::kCertDeclarationId] = Credentials::kMaxCMSSignedCDMessage; - maxLengths[FactoryDataId::kVendorNameId] = ConfigurationManager::kMaxVendorNameLength; - maxLengths[FactoryDataId::kProductNameId] = ConfigurationManager::kMaxProductNameLength; - maxLengths[FactoryDataId::kSerialNumberId] = ConfigurationManager::kMaxSerialNumberLength; - maxLengths[FactoryDataId::kManufacturingDateId] = ConfigurationManager::kMaxManufacturingDateLength; - maxLengths[FactoryDataId::kHardwareVersionId] = sizeof(uint16_t); - maxLengths[FactoryDataId::kHardwareVersionStrId] = ConfigurationManager::kMaxHardwareVersionStringLength; - maxLengths[FactoryDataId::kUniqueId] = ConfigurationManager::kMaxUniqueIDLength; - maxLengths[FactoryDataId::kPartNumber] = ConfigurationManager::kMaxPartNumberLength; - maxLengths[FactoryDataId::kProductURL] = ConfigurationManager::kMaxProductURLLength; - maxLengths[FactoryDataId::kProductLabel] = ConfigurationManager::kMaxProductLabelLength; -} - FactoryDataProvider::~FactoryDataProvider() {} CHIP_ERROR FactoryDataProvider::Validate() @@ -97,12 +72,6 @@ CHIP_ERROR FactoryDataProvider::SearchForId(uint8_t searchedType, uint8_t * pBuf if (searchedType == type) { - if ((type >= FactoryDataProvider::kNumberOfIds) || (length > maxLengths[type])) - { - ChipLogError(DeviceLayer, "Failed validity check for factory data with: id=%d, length=%d", type, length); - break; - } - ReturnErrorCodeIf(bufLength < length, CHIP_ERROR_BUFFER_TOO_SMALL); memcpy(pBuf, (void *) (addr + kValueOffset), length); @@ -367,5 +336,29 @@ CHIP_ERROR FactoryDataProvider::GetRotatingDeviceIdUniqueId(MutableByteSpan & un return err; } +CHIP_ERROR FactoryDataProvider::GetProductFinish(app::Clusters::BasicInformation::ProductFinishEnum * finish) +{ + uint8_t productFinish; + uint16_t length = 0; + auto err = SearchForId(FactoryDataId::kProductFinish, &productFinish, sizeof(productFinish), length); + ReturnErrorCodeIf(err != CHIP_NO_ERROR, CHIP_ERROR_NOT_IMPLEMENTED); + + *finish = static_cast(productFinish); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProvider::GetProductPrimaryColor(app::Clusters::BasicInformation::ColorEnum * primaryColor) +{ + uint8_t color; + uint16_t length = 0; + auto err = SearchForId(FactoryDataId::kProductPrimaryColor, &color, sizeof(color), length); + ReturnErrorCodeIf(err != CHIP_NO_ERROR, CHIP_ERROR_NOT_IMPLEMENTED); + + *primaryColor = static_cast(color); + + return CHIP_NO_ERROR; +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/nxp/k32w/common/FactoryDataProvider.h b/src/platform/nxp/k32w/common/FactoryDataProvider.h index 99b9a1e039cf34..2bad3e7934482f 100644 --- a/src/platform/nxp/k32w/common/FactoryDataProvider.h +++ b/src/platform/nxp/k32w/common/FactoryDataProvider.h @@ -88,17 +88,11 @@ class FactoryDataProvider : public DeviceInstanceInfoProvider, kPartNumber, kProductURL, kProductLabel, + kProductFinish, + kProductPrimaryColor, kMaxId }; -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER -#if !CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS -#error "CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS must be > 0 if custom provider is enabled." -#endif - static constexpr uint16_t kNumberOfIds = FactoryDataId::kMaxId + CHIP_DEVICE_CONFIG_CUSTOM_PROVIDER_NUMBER_IDS; -#else - static constexpr uint16_t kNumberOfIds = FactoryDataId::kMaxId; -#endif static uint32_t kFactoryDataStart; static uint32_t kFactoryDataSize; static uint32_t kFactoryDataPayloadStart; @@ -107,11 +101,13 @@ class FactoryDataProvider : public DeviceInstanceInfoProvider, static constexpr uint32_t kHashLen = 4; static constexpr size_t kHashId = 0xCE47BA5E; - FactoryDataProvider(); virtual ~FactoryDataProvider(); virtual CHIP_ERROR Init() = 0; virtual CHIP_ERROR SignWithDacKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) = 0; + CHIP_ERROR Validate(); + + CHIP_ERROR SearchForId(uint8_t searchedType, uint8_t * pBuf, size_t bufLength, uint16_t & length, uint32_t * offset = nullptr); // ===== Members functions that implement the CommissionableDataProvider CHIP_ERROR GetSetupDiscriminator(uint16_t & setupDiscriminator) override; @@ -142,12 +138,10 @@ class FactoryDataProvider : public DeviceInstanceInfoProvider, CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override; CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override; CHIP_ERROR GetRotatingDeviceIdUniqueId(MutableByteSpan & uniqueIdSpan) override; + CHIP_ERROR GetProductFinish(app::Clusters::BasicInformation::ProductFinishEnum * finish) override; + CHIP_ERROR GetProductPrimaryColor(app::Clusters::BasicInformation::ColorEnum * primaryColor) override; protected: - CHIP_ERROR Validate(); - CHIP_ERROR SearchForId(uint8_t searchedType, uint8_t * pBuf, size_t bufLength, uint16_t & length, uint32_t * offset = nullptr); - - uint16_t maxLengths[kNumberOfIds]; Header mHeader; }; diff --git a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp index c80bf64eaa357b..946c0c37f83d87 100644 --- a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp +++ b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp @@ -148,6 +148,16 @@ CHIP_ERROR OTAImageProcessorImpl::ProcessPayload(ByteSpan & block) mAccumulator.Init(sizeof(OTATlvHeader)); mCurrentProcessor = nullptr; + + // If the block size is 0, it means that the processed data was a multiple of + // received BDX block size (e.g. 8 blocks of 1024 bytes were transferred). + // After state for selecting next processor is reset, a request for fetching next + // data must be sent. + if (block.size() == 0) + { + status = CHIP_NO_ERROR; + break; + } } else { @@ -380,7 +390,11 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) // queued actions, e.g. sending events to a subscription SystemLayer().StartTimer( chip::System::Clock::Milliseconds32(CHIP_DEVICE_LAYER_OTA_REBOOT_DELAY), - [](chip::System::Layer *, void *) { OtaHookReset(); }, nullptr); + [](chip::System::Layer *, void *) { + PlatformMgr().HandleServerShuttingDown(); + OtaHookReset(); + }, + nullptr); } CHIP_ERROR OTAImageProcessorImpl::ReleaseBlock() diff --git a/src/platform/nxp/k32w/common/OTATlvProcessor.cpp b/src/platform/nxp/k32w/common/OTATlvProcessor.cpp index 7571e693728c00..d9d2ccba6f28e3 100644 --- a/src/platform/nxp/k32w/common/OTATlvProcessor.cpp +++ b/src/platform/nxp/k32w/common/OTATlvProcessor.cpp @@ -45,7 +45,7 @@ CHIP_ERROR OTATlvProcessor::Process(ByteSpan & block) if (mProcessedLength == mLength) { status = ExitAction(); - if (!IsError(status) && (block.size() > 0)) + if (!IsError(status)) { // If current block was processed fully and the block still contains data, it // means that the block contains another TLV's data and the current processor @@ -106,7 +106,7 @@ CHIP_ERROR OTADataAccumulator::Accumulate(ByteSpan & block) CHIP_ERROR OTATlvProcessor::vOtaProcessInternalEncryption(MutableByteSpan & block) { uint8_t iv[16]; - uint8_t key[16]; + uint8_t key[kOTAEncryptionKeyLength]; uint8_t dataOut[16] = { 0 }; uint32_t u32IVCount; uint32_t Offset = 0; @@ -124,18 +124,13 @@ CHIP_ERROR OTATlvProcessor::vOtaProcessInternalEncryption(MutableByteSpan & bloc iv[14] = (uint8_t) ((u32IVCount >> 8) & 0xff); iv[15] = (uint8_t) (u32IVCount & 0xff); - size_t len = strlen(OTA_ENCRYPTION_KEY); - - if (len != 32) + if (Encoding::HexToBytes(OTA_ENCRYPTION_KEY, strlen(OTA_ENCRYPTION_KEY), key, kOTAEncryptionKeyLength) != + kOTAEncryptionKeyLength) { - return CHIP_ERROR_INVALID_ARGUMENT; + // Failed to convert the OTAEncryptionKey string to octstr type value + return CHIP_ERROR_INVALID_STRING_LENGTH; } - for (size_t i = 0; i < len; i += 2) - { - char hex[3] = { OTA_ENCRYPTION_KEY[i], OTA_ENCRYPTION_KEY[i + 1], '\0' }; - key[i / 2] = (uint8_t) strtol(hex, NULL, 16); - } ByteSpan KEY = ByteSpan(key); Encoding::LittleEndian::Reader reader_key(KEY.data(), KEY.size()); ReturnErrorOnFailure(reader_key.Read32(&sKey.u32register0) diff --git a/src/platform/nxp/k32w/common/OTATlvProcessor.h b/src/platform/nxp/k32w/common/OTATlvProcessor.h index e412e1cdd1c5fa..13a2df115d90d9 100644 --- a/src/platform/nxp/k32w/common/OTATlvProcessor.h +++ b/src/platform/nxp/k32w/common/OTATlvProcessor.h @@ -127,6 +127,8 @@ class OTATlvProcessor #if OTA_ENCRYPTION_ENABLE /*ota decryption*/ uint32_t mIVOffset = 0; + /* Expected byte size of the OTAEncryptionKeyLength */ + static constexpr size_t kOTAEncryptionKeyLength = 16; #endif uint32_t mLength = 0; uint32_t mProcessedLength = 0; diff --git a/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h index 2f582b28171996..830024033fc0e7 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h @@ -79,13 +79,13 @@ #if NXP_ICD_ENABLED -#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC -#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC NXP_IDLE_MODE_INTERVAL -#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC +#ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC NXP_IDLE_MODE_INTERVAL +#endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS -#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS NXP_ACTIVE_MODE_INTERVAL -#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS +#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS NXP_ACTIVE_MODE_INTERVAL +#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS #define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS NXP_ACTIVE_MODE_THRESHOLD diff --git a/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.cpp b/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.cpp index df51c774712281..c595bf9cf31033 100644 --- a/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.cpp @@ -39,22 +39,6 @@ FactoryDataProviderImpl::FactoryDataProviderImpl() CHIP_ERROR FactoryDataProviderImpl::Init() { CHIP_ERROR error = CHIP_NO_ERROR; - uint32_t sum = 0; - -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER - ReturnErrorOnFailure(SetCustomIds()); -#endif - - for (uint8_t i = 1; i < FactoryDataProvider::kNumberOfIds; i++) - { - sum += maxLengths[i]; - } - - if (sum > kFactoryDataSize) - { - ChipLogError(DeviceLayer, "Max size of factory data: %lu is bigger than reserved factory data size: %lu", sum, - kFactoryDataSize); - } #if CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR error = ValidateWithRestore(); diff --git a/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.h b/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.h index f8d51573f6c488..b359a6d3f196cd 100644 --- a/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.h +++ b/src/platform/nxp/k32w/k32w0/FactoryDataProviderImpl.h @@ -24,7 +24,6 @@ namespace DeviceLayer { /** * This class provides K32W0 specific factory data features. - * CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER - application defined factory data provider * CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR - enables factory data OTA */ @@ -36,13 +35,6 @@ class FactoryDataProviderImpl : public FactoryDataProvider CHIP_ERROR Init() override; CHIP_ERROR SignWithDacKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) override; -#if CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER - virtual ~FactoryDataProviderImpl() {} - // Custom factory data providers must implement this method in order to define - // their own custom IDs. - virtual CHIP_ERROR SetCustomIds() = 0; -#endif - #if CONFIG_CHIP_K32W0_OTA_FACTORY_DATA_PROCESSOR using RestoreMechanism = CHIP_ERROR (*)(void); diff --git a/src/platform/nxp/k32w/k32w0/LowPowerHooks.cpp b/src/platform/nxp/k32w/k32w0/LowPowerHooks.cpp index 5d98fc1f0c6b67..b01854c964296d 100644 --- a/src/platform/nxp/k32w/k32w0/LowPowerHooks.cpp +++ b/src/platform/nxp/k32w/k32w0/LowPowerHooks.cpp @@ -34,9 +34,6 @@ #include "app_dual_mode_low_power.h" #include "app_dual_mode_switch.h" #include "k32w0-chip-mbedtls-config.h" -#include // nogncheck - -#include "app_config.h" using namespace ::chip; using namespace ::chip::Inet; @@ -107,22 +104,6 @@ uint32_t dm_switch_get15_4InitWakeUpTime(void) return dualModeStates.threadWarmBootInitTime; } -extern "C" bleResult_t App_PostCallbackMessage(appCallbackHandler_t handler, appCallbackParam_t param) -{ - AppEvent event; - event.Type = AppEvent::kEventType_Lp; - event.Handler = handler; - event.param = param; - -#if ENABLE_LOW_POWER_LOGS - K32W_LOG("App_PostCallbackMessage %d", (uint32_t) param); -#endif - - GetAppTask().PostEvent(&event); - - return gBleSuccess_c; -} - WEAK void dm_switch_wakeupCallBack(void) { BOARD_SetClockForWakeup(); diff --git a/src/platform/nxp/k32w/k32w0/OTAFactoryDataProcessor.cpp b/src/platform/nxp/k32w/k32w0/OTAFactoryDataProcessor.cpp index 438623dbc97d2f..d40d2ae3c17f5a 100644 --- a/src/platform/nxp/k32w/k32w0/OTAFactoryDataProcessor.cpp +++ b/src/platform/nxp/k32w/k32w0/OTAFactoryDataProcessor.cpp @@ -73,7 +73,8 @@ CHIP_ERROR OTAFactoryDataProcessor::ProcessInternal(ByteSpan & block) CHIP_ERROR OTAFactoryDataProcessor::ApplyAction() { - CHIP_ERROR error = CHIP_NO_ERROR; + CHIP_ERROR error = CHIP_NO_ERROR; + FactoryProvider * provider = nullptr; ReturnErrorOnFailure(Read()); ReturnErrorOnFailure(Backup()); @@ -83,7 +84,16 @@ CHIP_ERROR OTAFactoryDataProcessor::ApplyAction() SuccessOrExit(error = Update((uint8_t) Tags::kPaiCertificateId, mPayload.mCertPai)); SuccessOrExit(error = Update((uint8_t) Tags::kCertDeclarationId, mPayload.mCertDeclaration)); - error = FactoryProviderImpl::UpdateData(mFactoryData); + SuccessOrExit(error = FactoryProviderImpl::UpdateData(mFactoryData)); + + /* Check integrity of freshly copied data. If validation fails, OTA will be aborted + * and factory data will be restored to the previous version. Use device instance info + * provider getter to access the factory data provider instance. The instance is created + * by the application, so it's easier to access it this way.*/ + provider = static_cast(DeviceLayer::GetDeviceInstanceInfoProvider()); + SuccessOrExit(error = ((provider != nullptr) ? CHIP_NO_ERROR : CHIP_ERROR_INVALID_ADDRESS)); + + error = provider->Validate(); exit: if (error != CHIP_NO_ERROR) diff --git a/src/platform/nxp/k32w/k32w1/BUILD.gn b/src/platform/nxp/k32w/k32w1/BUILD.gn index 187a7360cd27d2..8ad11928178bb7 100644 --- a/src/platform/nxp/k32w/k32w1/BUILD.gn +++ b/src/platform/nxp/k32w/k32w1/BUILD.gn @@ -58,6 +58,8 @@ static_library("k32w1") { "ram_storage.h", ] + public = [ "${chip_root}/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h" ] + public_deps = [ "${chip_root}/src/platform:platform_base" ] if (chip_with_low_power != 0) { @@ -65,6 +67,8 @@ static_library("k32w1") { } if (chip_enable_ota_requestor) { + public += [ "../common/OTAImageProcessorImpl.h" ] + sources += [ "../common/OTAImageProcessorImpl.cpp", "../common/OTAImageProcessorImpl.h", From 9c4bde406218aab252336f0b914e46ddc8624a86 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 15 Jan 2024 12:30:38 -0500 Subject: [PATCH 128/143] For CFFI in chip-repl, remove variadic arguments (#31159) --- .../python/chip/clusters/Attribute.py | 97 +++++++++------ .../python/chip/clusters/Command.py | 25 ++-- .../python/chip/clusters/attribute.cpp | 117 ++++++++---------- .../python/chip/clusters/command.cpp | 70 +++++------ .../python/chip/interaction_model/Delegate.h | 39 +++++- .../python/chip/interaction_model/__init__.py | 10 +- .../python/chip/interaction_model/delegate.py | 77 +++++++++++- 7 files changed, 261 insertions(+), 174 deletions(-) diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index 25691bb826cf55..96a66f5706f174 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -24,7 +24,7 @@ import logging import sys from asyncio.futures import Future -from ctypes import CFUNCTYPE, c_size_t, c_uint8, c_uint16, c_uint32, c_uint64, c_void_p, py_object +from ctypes import CFUNCTYPE, POINTER, c_size_t, c_uint8, c_uint16, c_uint32, c_uint64, c_void_p, cast, py_object from dataclasses import dataclass, field from enum import Enum, unique from typing import Any, Callable, Dict, List, Optional, Tuple, Union @@ -34,6 +34,7 @@ import chip.interaction_model import chip.tlv import construct +from chip.interaction_model import PyWriteAttributeData from chip.native import ErrorSDKPart, PyChipError from rich.pretty import pprint @@ -955,22 +956,22 @@ def WriteAttributes(future: Future, eventLoop, device, interactionTimeoutMs: Union[None, int] = None, busyWaitMs: Union[None, int] = None) -> PyChipError: handle = chip.native.GetLibraryHandle() - writeargs = [] - for attr in attributes: + numberOfAttributes = len(attributes) + pyWriteAttributesArrayType = PyWriteAttributeData * numberOfAttributes + pyWriteAttributes = pyWriteAttributesArrayType() + for idx, attr in enumerate(attributes): if attr.Attribute.must_use_timed_write and timedRequestTimeoutMs is None or timedRequestTimeoutMs == 0: raise chip.interaction_model.InteractionModelError(chip.interaction_model.Status.NeedsTimedInteraction) - path = chip.interaction_model.AttributePathIBstruct.parse( - b'\x00' * chip.interaction_model.AttributePathIBstruct.sizeof()) - path.EndpointId = attr.EndpointId - path.ClusterId = attr.Attribute.cluster_id - path.AttributeId = attr.Attribute.attribute_id - path.DataVersion = attr.DataVersion - path.HasDataVersion = attr.HasDataVersion - path = chip.interaction_model.AttributePathIBstruct.build(path) + tlv = attr.Attribute.ToTLV(None, attr.Data) - writeargs.append(ctypes.c_char_p(path)) - writeargs.append(ctypes.c_char_p(bytes(tlv))) - writeargs.append(ctypes.c_int(len(tlv))) + + pyWriteAttributes[idx].attributePath.endpointId = c_uint16(attr.EndpointId) + pyWriteAttributes[idx].attributePath.clusterId = c_uint32(attr.Attribute.cluster_id) + pyWriteAttributes[idx].attributePath.attributeId = c_uint32(attr.Attribute.attribute_id) + pyWriteAttributes[idx].attributePath.dataVersion = c_uint32(attr.DataVersion) + pyWriteAttributes[idx].attributePath.hasDataVersion = c_uint8(attr.HasDataVersion) + pyWriteAttributes[idx].tlvData = cast(ctypes.c_char_p(bytes(tlv)), c_void_p) + pyWriteAttributes[idx].tlvLength = c_size_t(len(tlv)) transaction = AsyncWriteTransaction(future, eventLoop) ctypes.pythonapi.Py_IncRef(ctypes.py_object(transaction)) @@ -980,7 +981,7 @@ def WriteAttributes(future: Future, eventLoop, device, ctypes.c_size_t(0 if timedRequestTimeoutMs is None else timedRequestTimeoutMs), ctypes.c_size_t(0 if interactionTimeoutMs is None else interactionTimeoutMs), ctypes.c_size_t(0 if busyWaitMs is None else busyWaitMs), - ctypes.c_size_t(len(attributes)), *writeargs) + pyWriteAttributes, ctypes.c_size_t(numberOfAttributes)) ) if not res.is_success: ctypes.pythonapi.Py_DecRef(ctypes.py_object(transaction)) @@ -990,26 +991,26 @@ def WriteAttributes(future: Future, eventLoop, device, def WriteGroupAttributes(groupId: int, devCtrl: c_void_p, attributes: List[AttributeWriteRequest], busyWaitMs: Union[None, int] = None) -> PyChipError: handle = chip.native.GetLibraryHandle() - writeargs = [] - for attr in attributes: - path = chip.interaction_model.AttributePathIBstruct.parse( - b'\x00' * chip.interaction_model.AttributePathIBstruct.sizeof()) - path.EndpointId = attr.EndpointId - path.ClusterId = attr.Attribute.cluster_id - path.AttributeId = attr.Attribute.attribute_id - path.DataVersion = attr.DataVersion - path.HasDataVersion = attr.HasDataVersion - path = chip.interaction_model.AttributePathIBstruct.build(path) + numberOfAttributes = len(attributes) + pyWriteAttributesArrayType = PyWriteAttributeData * numberOfAttributes + pyWriteAttributes = pyWriteAttributesArrayType() + for idx, attr in enumerate(attributes): + tlv = attr.Attribute.ToTLV(None, attr.Data) - writeargs.append(ctypes.c_char_p(path)) - writeargs.append(ctypes.c_char_p(bytes(tlv))) - writeargs.append(ctypes.c_int(len(tlv))) + + pyWriteAttributes[idx].attributePath.endpointId = c_uint16(attr.EndpointId) + pyWriteAttributes[idx].attributePath.clusterId = c_uint32(attr.Attribute.cluster_id) + pyWriteAttributes[idx].attributePath.attributeId = c_uint32(attr.Attribute.attribute_id) + pyWriteAttributes[idx].attributePath.dataVersion = c_uint32(attr.DataVersion) + pyWriteAttributes[idx].attributePath.hasDataVersion = c_uint8(attr.HasDataVersion) + pyWriteAttributes[idx].tlvData = cast(ctypes.c_char_p(bytes(tlv)), c_void_p) + pyWriteAttributes[idx].tlvLength = c_size_t(len(tlv)) return builtins.chipStack.Call( lambda: handle.pychip_WriteClient_WriteGroupAttributes( ctypes.c_size_t(groupId), devCtrl, ctypes.c_size_t(0 if busyWaitMs is None else busyWaitMs), - ctypes.c_size_t(len(attributes)), *writeargs) + pyWriteAttributes, ctypes.c_size_t(numberOfAttributes)) ) @@ -1037,10 +1038,12 @@ def Read(future: Future, eventLoop, device, devCtrl, transaction = AsyncReadTransaction( future, eventLoop, devCtrl, returnClusterObject) - readargs = [] - + attributePathsForCffi = None if attributes is not None: - for attr in attributes: + numberOfAttributePaths = len(attributes) + attributePathsForCffiArrayType = c_void_p * numberOfAttributePaths + attributePathsForCffi = attributePathsForCffiArrayType() + for idx, attr in enumerate(attributes): path = chip.interaction_model.AttributePathIBstruct.parse( b'\xff' * chip.interaction_model.AttributePathIBstruct.sizeof()) if attr.EndpointId is not None: @@ -1050,10 +1053,14 @@ def Read(future: Future, eventLoop, device, devCtrl, if attr.AttributeId is not None: path.AttributeId = attr.AttributeId path = chip.interaction_model.AttributePathIBstruct.build(path) - readargs.append(ctypes.c_char_p(path)) + attributePathsForCffi[idx] = cast(ctypes.c_char_p(path), c_void_p) + dataVersionFiltersForCffi = None if dataVersionFilters is not None: - for f in dataVersionFilters: + numberOfDataVersionFilters = len(dataVersionFilters) + dataVersionFiltersForCffiArrayType = c_void_p * numberOfDataVersionFilters + dataVersionFiltersForCffi = dataVersionFiltersForCffiArrayType() + for idx, f in enumerate(dataVersionFilters): filter = chip.interaction_model.DataVersionFilterIBstruct.parse( b'\xff' * chip.interaction_model.DataVersionFilterIBstruct.sizeof()) if f.EndpointId is not None: @@ -1073,10 +1080,14 @@ def Read(future: Future, eventLoop, device, devCtrl, "DataVersionFilter must provide DataVersion.") filter = chip.interaction_model.DataVersionFilterIBstruct.build( filter) - readargs.append(ctypes.c_char_p(filter)) + dataVersionFiltersForCffi[idx] = cast(ctypes.c_char_p(filter), c_void_p) + eventPathsForCffi = None if events is not None: - for event in events: + numberOfEvents = len(events) + eventPathsForCffiArrayType = c_void_p * numberOfEvents + eventPathsForCffi = eventPathsForCffiArrayType() + for idx, event in enumerate(events): path = chip.interaction_model.EventPathIBstruct.parse( b'\xff' * chip.interaction_model.EventPathIBstruct.sizeof()) if event.EndpointId is not None: @@ -1090,7 +1101,7 @@ def Read(future: Future, eventLoop, device, devCtrl, else: path.Urgent = 0 path = chip.interaction_model.EventPathIBstruct.build(path) - readargs.append(ctypes.c_char_p(path)) + eventPathsForCffi[idx] = cast(ctypes.c_char_p(path), c_void_p) readClientObj = ctypes.POINTER(c_void_p)() readCallbackObj = ctypes.POINTER(c_void_p)() @@ -1116,12 +1127,14 @@ def Read(future: Future, eventLoop, device, devCtrl, ctypes.byref(readCallbackObj), device, ctypes.c_char_p(params), + attributePathsForCffi, ctypes.c_size_t(0 if attributes is None else len(attributes)), + dataVersionFiltersForCffi, ctypes.c_size_t( 0 if dataVersionFilters is None else len(dataVersionFilters)), + eventPathsForCffi, ctypes.c_size_t(0 if events is None else len(events)), - eventNumberFilterPtr, - *readargs)) + eventNumberFilterPtr)) transaction.SetClientObjPointers(readClientObj, readCallbackObj) @@ -1168,8 +1181,10 @@ def Init(): # attribute information we want written using a vector. This possibility was not implemented at the # time where simply specified the argtypes, because of time constraints. This solution was quicker # to fix the crash on ARM64 Apple platforms without a refactor. - handle.pychip_WriteClient_WriteAttributes.argtypes = [py_object, c_void_p, c_size_t, c_size_t, c_size_t, c_size_t] - handle.pychip_WriteClient_WriteGroupAttributes.argtypes = [c_size_t, c_void_p, c_size_t, c_size_t] + handle.pychip_WriteClient_WriteAttributes.argtypes = [py_object, c_void_p, + c_size_t, c_size_t, c_size_t, POINTER(PyWriteAttributeData), c_size_t] + handle.pychip_WriteClient_WriteGroupAttributes.argtypes = [ + c_size_t, c_void_p, c_size_t, POINTER(PyWriteAttributeData), c_size_t] setter.Set('pychip_WriteClient_InitCallbacks', None, [ _OnWriteResponseCallbackFunct, _OnWriteErrorCallbackFunct, _OnWriteDoneCallbackFunct]) diff --git a/src/controller/python/chip/clusters/Command.py b/src/controller/python/chip/clusters/Command.py index d3dcc5bba913ff..6e25a76d50230f 100644 --- a/src/controller/python/chip/clusters/Command.py +++ b/src/controller/python/chip/clusters/Command.py @@ -21,12 +21,13 @@ import logging import sys from asyncio.futures import Future -from ctypes import CFUNCTYPE, c_bool, c_char_p, c_size_t, c_uint8, c_uint16, c_uint32, c_void_p, py_object +from ctypes import CFUNCTYPE, POINTER, c_bool, c_char_p, c_size_t, c_uint8, c_uint16, c_uint32, c_void_p, cast, py_object from dataclasses import dataclass from typing import List, Optional, Type, Union import chip.exceptions import chip.interaction_model +from chip.interaction_model import PyInvokeRequestData from chip.native import PyChipError from .ClusterObjects import ClusterCommand @@ -313,8 +314,10 @@ def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRe handle = chip.native.GetLibraryHandle() responseTypes = [] - commandargs = [] - for command in commands: + numberOfCommands = len(commands) + pyBatchCommandsDataArrayType = PyInvokeRequestData * numberOfCommands + pyBatchCommandsData = pyBatchCommandsDataArrayType() + for idx, command in enumerate(commands): clusterCommand = command.Command responseType = command.ResponseType if (responseType is not None) and (not issubclass(responseType, ClusterCommand)): @@ -322,15 +325,13 @@ def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRe if clusterCommand.must_use_timed_invoke and timedRequestTimeoutMs is None or timedRequestTimeoutMs == 0: raise chip.interaction_model.InteractionModelError(chip.interaction_model.Status.NeedsTimedInteraction) - commandPath = chip.interaction_model.CommandPathIBStruct.build({ - "EndpointId": command.EndpointId, - "ClusterId": clusterCommand.cluster_id, - "CommandId": clusterCommand.command_id}) payloadTLV = clusterCommand.ToTLV() - commandargs.append(c_char_p(commandPath)) - commandargs.append(c_char_p(bytes(payloadTLV))) - commandargs.append(c_size_t(len(payloadTLV))) + pyBatchCommandsData[idx].commandPath.endpointId = c_uint16(command.EndpointId) + pyBatchCommandsData[idx].commandPath.clusterId = c_uint32(clusterCommand.cluster_id) + pyBatchCommandsData[idx].commandPath.commandId = c_uint32(clusterCommand.command_id) + pyBatchCommandsData[idx].tlvData = cast(c_char_p(bytes(payloadTLV)), c_void_p) + pyBatchCommandsData[idx].tlvLength = c_size_t(len(payloadTLV)) responseTypes.append(responseType) @@ -344,7 +345,7 @@ def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRe c_uint16(0 if interactionTimeoutMs is None else interactionTimeoutMs), c_uint16(0 if busyWaitMs is None else busyWaitMs), c_bool(False if suppressResponse is None else suppressResponse), - c_size_t(len(commands)), *commandargs) + pyBatchCommandsData, c_size_t(numberOfCommands)) ) @@ -375,7 +376,7 @@ def Init(): setter.Set('pychip_CommandSender_SendCommand', PyChipError, [py_object, c_void_p, c_uint16, c_uint32, c_uint32, c_char_p, c_size_t, c_uint16, c_bool]) setter.Set('pychip_CommandSender_SendBatchCommands', - PyChipError, [py_object, c_void_p, c_uint16, c_uint16, c_uint16, c_bool, c_size_t]) + PyChipError, [py_object, c_void_p, c_uint16, c_uint16, c_uint16, c_bool, POINTER(PyInvokeRequestData), c_size_t]) setter.Set('pychip_CommandSender_TestOnlySendCommandTimedRequestNoTimedInvoke', PyChipError, [py_object, c_void_p, c_uint32, c_uint32, c_char_p, c_size_t, c_uint16, c_bool]) setter.Set('pychip_CommandSender_SendGroupCommand', diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index d85d132b36bf8a..8abaaab18e1ed9 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -256,13 +257,14 @@ struct __attribute__((packed)) PyReadAttributeParams bool autoResubscribe; }; -// Encodes n attribute write requests, follows 3 * n arguments, in the (AttributeWritePath*=void *, uint8_t*, size_t) order. PyChipError pychip_WriteClient_WriteAttributes(void * appContext, DeviceProxy * device, size_t timedWriteTimeoutMsSizeT, - size_t interactionTimeoutMsSizeT, size_t busyWaitMsSizeT, size_t n, ...); + size_t interactionTimeoutMsSizeT, size_t busyWaitMsSizeT, + chip::python::PyWriteAttributeData * writeAttributesData, + size_t attributeDataLength); PyChipError pychip_WriteClient_WriteGroupAttributes(size_t groupIdSizeT, chip::Controller::DeviceCommissioner * devCtrl, - size_t busyWaitMsSizeT, size_t n, ...); -PyChipError pychip_ReadClient_ReadAttributes(void * appContext, ReadClient ** pReadClient, ReadClientCallback ** pCallback, - DeviceProxy * device, uint8_t * readParamsBuf, size_t n, size_t total, ...); + size_t busyWaitMsSizeT, + chip::python::PyWriteAttributeData * writeAttributesData, + size_t attributeDataLength); } using OnWriteResponseCallback = void (*)(PyObject * appContext, chip::EndpointId endpointId, chip::ClusterId clusterId, @@ -337,7 +339,8 @@ void pychip_ReadClient_InitCallbacks(OnReadAttributeDataCallback onReadAttribute } PyChipError pychip_WriteClient_WriteAttributes(void * appContext, DeviceProxy * device, size_t timedWriteTimeoutMsSizeT, - size_t interactionTimeoutMsSizeT, size_t busyWaitMsSizeT, size_t n, ...) + size_t interactionTimeoutMsSizeT, size_t busyWaitMsSizeT, + python::PyWriteAttributeData * writeAttributesData, size_t attributeDataLength) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -352,35 +355,27 @@ PyChipError pychip_WriteClient_WriteAttributes(void * appContext, DeviceProxy * app::InteractionModelEngine::GetInstance()->GetExchangeManager(), callback->GetChunkedCallback(), timedWriteTimeoutMs != 0 ? Optional(timedWriteTimeoutMs) : Optional::Missing()); - va_list args; - va_start(args, n); - VerifyOrExit(device != nullptr && device->GetSecureSession().HasValue(), err = CHIP_ERROR_MISSING_SECURE_SESSION); + for (size_t i = 0; i < attributeDataLength; i++) { - for (size_t i = 0; i < n; i++) + python::PyAttributePath path = writeAttributesData[i].attributePath; + void * tlv = writeAttributesData[i].tlvData; + size_t length = writeAttributesData[i].tlvLength; + + uint8_t * tlvBuffer = reinterpret_cast(tlv); + + TLV::TLVReader reader; + reader.Init(tlvBuffer, static_cast(length)); + reader.Next(); + Optional dataVersion; + if (path.hasDataVersion == 1) { - void * path = va_arg(args, void *); - void * tlv = va_arg(args, void *); - int length = va_arg(args, int); - - python::AttributePath pathObj; - memcpy(&pathObj, path, sizeof(python::AttributePath)); - uint8_t * tlvBuffer = reinterpret_cast(tlv); - - TLV::TLVReader reader; - reader.Init(tlvBuffer, static_cast(length)); - reader.Next(); - Optional dataVersion; - if (pathObj.hasDataVersion == 1) - { - dataVersion.SetValue(pathObj.dataVersion); - } - SuccessOrExit( - err = client->PutPreencodedAttribute( - chip::app::ConcreteDataAttributePath(pathObj.endpointId, pathObj.clusterId, pathObj.attributeId, dataVersion), - reader)); + dataVersion.SetValue(path.dataVersion); } + SuccessOrExit( + err = client->PutPreencodedAttribute( + chip::app::ConcreteDataAttributePath(path.endpointId, path.clusterId, path.attributeId, dataVersion), reader)); } SuccessOrExit(err = client->SendWriteRequest(device->GetSecureSession().Value(), @@ -396,12 +391,12 @@ PyChipError pychip_WriteClient_WriteAttributes(void * appContext, DeviceProxy * } exit: - va_end(args); return ToPyChipError(err); } PyChipError pychip_WriteClient_WriteGroupAttributes(size_t groupIdSizeT, chip::Controller::DeviceCommissioner * devCtrl, - size_t busyWaitMsSizeT, size_t n, ...) + size_t busyWaitMsSizeT, python::PyWriteAttributeData * writeAttributesData, + size_t attributeDataLength) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -417,34 +412,26 @@ PyChipError pychip_WriteClient_WriteGroupAttributes(size_t groupIdSizeT, chip::C std::unique_ptr client = std::make_unique( app::InteractionModelEngine::GetInstance()->GetExchangeManager(), nullptr /* callback */, Optional::Missing()); - va_list args; - va_start(args, n); - + for (size_t i = 0; i < attributeDataLength; i++) { - for (size_t i = 0; i < n; i++) + python::PyAttributePath path = writeAttributesData[i].attributePath; + void * tlv = writeAttributesData[i].tlvData; + size_t length = writeAttributesData[i].tlvLength; + + uint8_t * tlvBuffer = reinterpret_cast(tlv); + + TLV::TLVReader reader; + reader.Init(tlvBuffer, static_cast(length)); + reader.Next(); + Optional dataVersion; + if (path.hasDataVersion == 1) { - void * path = va_arg(args, void *); - void * tlv = va_arg(args, void *); - int length = va_arg(args, int); - - python::AttributePath pathObj; - memcpy(&pathObj, path, sizeof(python::AttributePath)); - uint8_t * tlvBuffer = reinterpret_cast(tlv); - - TLV::TLVReader reader; - reader.Init(tlvBuffer, static_cast(length)); - reader.Next(); - Optional dataVersion; - if (pathObj.hasDataVersion == 1) - { - dataVersion.SetValue(pathObj.dataVersion); - } - // Using kInvalidEndpointId as that used when sending group write requests. - SuccessOrExit( - err = client->PutPreencodedAttribute( - chip::app::ConcreteDataAttributePath(kInvalidEndpointId, pathObj.clusterId, pathObj.attributeId, dataVersion), - reader)); + dataVersion.SetValue(path.dataVersion); } + // Using kInvalidEndpointId as that used when sending group write requests. + SuccessOrExit( + err = client->PutPreencodedAttribute( + chip::app::ConcreteDataAttributePath(kInvalidEndpointId, path.clusterId, path.attributeId, dataVersion), reader)); } { @@ -460,7 +447,6 @@ PyChipError pychip_WriteClient_WriteGroupAttributes(size_t groupIdSizeT, chip::C } exit: - va_end(args); return ToPyChipError(err); } @@ -487,8 +473,9 @@ PyChipError pychip_ReadClient_GetReportingIntervals(ReadClient * pReadClient, ui } PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient, ReadClientCallback ** pCallback, - DeviceProxy * device, uint8_t * readParamsBuf, size_t numAttributePaths, - size_t numDataversionFilters, size_t numEventPaths, uint64_t * eventNumberFilter, ...) + DeviceProxy * device, uint8_t * readParamsBuf, void ** attributePathsFromPython, + size_t numAttributePaths, void ** dataversionFiltersFromPython, size_t numDataversionFilters, + void ** eventPathsFromPython, size_t numEventPaths, uint64_t * eventNumberFilter) { CHIP_ERROR err = CHIP_NO_ERROR; PyReadAttributeParams pyParams = {}; @@ -497,9 +484,6 @@ PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient, std::unique_ptr callback = std::make_unique(appContext); - va_list args; - va_start(args, eventNumberFilter); - std::unique_ptr attributePaths(new AttributePathParams[numAttributePaths]); std::unique_ptr dataVersionFilters(new chip::app::DataVersionFilter[numDataversionFilters]); std::unique_ptr eventPaths(new EventPathParams[numEventPaths]); @@ -507,7 +491,7 @@ PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient, for (size_t i = 0; i < numAttributePaths; i++) { - void * path = va_arg(args, void *); + void * path = attributePathsFromPython[i]; python::AttributePath pathObj; memcpy(&pathObj, path, sizeof(python::AttributePath)); @@ -517,7 +501,7 @@ PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient, for (size_t i = 0; i < numDataversionFilters; i++) { - void * filter = va_arg(args, void *); + void * filter = dataversionFiltersFromPython[i]; python::DataVersionFilter filterObj; memcpy(&filterObj, filter, sizeof(python::DataVersionFilter)); @@ -527,7 +511,7 @@ PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient, for (size_t i = 0; i < numEventPaths; i++) { - void * path = va_arg(args, void *); + void * path = eventPathsFromPython[i]; python::EventPath pathObj; memcpy(&pathObj, path, sizeof(python::EventPath)); @@ -599,7 +583,6 @@ PyChipError pychip_ReadClient_Read(void * appContext, ReadClient ** pReadClient, callback.release(); exit: - va_end(args); return ToPyChipError(err); } } diff --git a/src/controller/python/chip/clusters/command.cpp b/src/controller/python/chip/clusters/command.cpp index c920a82c53fb54..7195cefe16eba1 100644 --- a/src/controller/python/chip/clusters/command.cpp +++ b/src/controller/python/chip/clusters/command.cpp @@ -41,7 +41,7 @@ PyChipError pychip_CommandSender_SendCommand(void * appContext, DeviceProxy * de PyChipError pychip_CommandSender_SendBatchCommands(void * appContext, DeviceProxy * device, uint16_t timedRequestTimeoutMs, uint16_t interactionTimeoutMs, uint16_t busyWaitMs, bool suppressResponse, - size_t n, ...); + chip::python::PyInvokeRequestData * batchCommandData, size_t length); PyChipError pychip_CommandSender_TestOnlySendCommandTimedRequestNoTimedInvoke( void * appContext, DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::CommandId commandId, @@ -68,13 +68,6 @@ OnCommandSenderResponseCallback gOnCommandSenderResponseCallback = nullptr; OnCommandSenderErrorCallback gOnCommandSenderErrorCallback = nullptr; OnCommandSenderDoneCallback gOnCommandSenderDoneCallback = nullptr; -struct __attribute__((packed)) CommandPath -{ - chip::EndpointId endpointId; - chip::ClusterId clusterId; - chip::CommandId commandId; -}; - class CommandSenderCallback : public CommandSender::ExtendableCallback { public: @@ -256,7 +249,7 @@ PyChipError pychip_CommandSender_SendCommand(void * appContext, DeviceProxy * de PyChipError pychip_CommandSender_SendBatchCommands(void * appContext, DeviceProxy * device, uint16_t timedRequestTimeoutMs, uint16_t interactionTimeoutMs, uint16_t busyWaitMs, bool suppressResponse, - size_t n, ...) + python::PyInvokeRequestData * batchCommandData, size_t length) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -279,47 +272,41 @@ PyChipError pychip_CommandSender_SendBatchCommands(void * appContext, DeviceProx std::make_unique(callback.get(), device->GetExchangeManager(), /* is timed request */ timedRequestTimeoutMs != 0, suppressResponse); - // TODO(#30986): Move away from passing these command through variadic arguments. - va_list args; - va_start(args, n); - SuccessOrExit(err = sender->SetCommandSenderConfig(config)); + for (size_t i = 0; i < length; i++) { - for (size_t i = 0; i < n; i++) - { - void * commandPath = va_arg(args, void *); - void * tlv = va_arg(args, void *); - int length = va_arg(args, int); + chip::EndpointId endpointId = batchCommandData[i].commandPath.endpointId; + chip::ClusterId clusterId = batchCommandData[i].commandPath.clusterId; + chip::CommandId commandId = batchCommandData[i].commandPath.commandId; + void * tlv = batchCommandData[i].tlvData; + size_t tlvLength = batchCommandData[i].tlvLength; - python::CommandPath invokeRequestInfoObj; - memcpy(&invokeRequestInfoObj, commandPath, sizeof(python::CommandPath)); - const uint8_t * tlvBuffer = reinterpret_cast(tlv); + const uint8_t * tlvBuffer = reinterpret_cast(tlv); - app::CommandPathParams cmdParams = { invokeRequestInfoObj.endpointId, /* group id */ 0, invokeRequestInfoObj.clusterId, - invokeRequestInfoObj.commandId, (app::CommandPathFlags::kEndpointIdValid) }; + app::CommandPathParams cmdParams = { endpointId, /* group id */ 0, clusterId, commandId, + (app::CommandPathFlags::kEndpointIdValid) }; - CommandSender::AdditionalCommandParameters additionalParams; + CommandSender::AdditionalCommandParameters additionalParams; - SuccessOrExit(err = sender->PrepareCommand(cmdParams, additionalParams)); - { - auto writer = sender->GetCommandDataIBTLVWriter(); - VerifyOrExit(writer != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - TLV::TLVReader reader; - reader.Init(tlvBuffer, static_cast(length)); - reader.Next(); - SuccessOrExit(err = writer->CopyContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), reader)); - } + SuccessOrExit(err = sender->PrepareCommand(cmdParams, additionalParams)); + { + auto writer = sender->GetCommandDataIBTLVWriter(); + VerifyOrExit(writer != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + TLV::TLVReader reader; + reader.Init(tlvBuffer, static_cast(tlvLength)); + reader.Next(); + SuccessOrExit(err = writer->CopyContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), reader)); + } - SuccessOrExit(err = sender->FinishCommand(timedRequestTimeoutMs != 0 ? Optional(timedRequestTimeoutMs) - : Optional::Missing(), - additionalParams)); + SuccessOrExit(err = sender->FinishCommand(timedRequestTimeoutMs != 0 ? Optional(timedRequestTimeoutMs) + : Optional::Missing(), + additionalParams)); - // CommandSender provides us with the CommandReference for this associated command. In order to match responses - // we have to add CommandRef to index lookup. - VerifyOrExit(additionalParams.commandRef.HasValue(), err = CHIP_ERROR_INVALID_ARGUMENT); - SuccessOrExit(err = callback->AddCommandRefToIndexLookup(additionalParams.commandRef.Value(), i)); - } + // CommandSender provides us with the CommandReference for this associated command. In order to match responses + // we have to add CommandRef to index lookup. + VerifyOrExit(additionalParams.commandRef.HasValue(), err = CHIP_ERROR_INVALID_ARGUMENT); + SuccessOrExit(err = callback->AddCommandRefToIndexLookup(additionalParams.commandRef.Value(), i)); } SuccessOrExit(err = sender->SendCommandRequest(device->GetSecureSession().Value(), @@ -338,7 +325,6 @@ PyChipError pychip_CommandSender_SendBatchCommands(void * appContext, DeviceProx } exit: - va_end(args); return ToPyChipError(err); } diff --git a/src/controller/python/chip/interaction_model/Delegate.h b/src/controller/python/chip/interaction_model/Delegate.h index c92d0d042459c7..f11f4931fc4c1d 100644 --- a/src/controller/python/chip/interaction_model/Delegate.h +++ b/src/controller/python/chip/interaction_model/Delegate.h @@ -23,8 +23,45 @@ namespace chip { namespace python { + static constexpr ClusterStatus kUndefinedClusterStatus = 0xFF; -} + +// This needs to match the python definition that uses the same name. +struct PyCommandPath +{ + chip::EndpointId endpointId; + chip::ClusterId clusterId; + chip::CommandId commandId; +}; + +// This needs to match the python definition that uses the same name. +struct PyInvokeRequestData +{ + PyCommandPath commandPath; + void * tlvData; + size_t tlvLength; +}; + +// This needs to match the python definition that uses the same name. +struct PyAttributePath +{ + chip::EndpointId endpointId; + chip::ClusterId clusterId; + chip::AttributeId attributeId; + chip::DataVersion dataVersion; + uint8_t hasDataVersion; +}; + +// This needs to match the python definition that uses the same name. +struct PyWriteAttributeData +{ + PyAttributePath attributePath; + void * tlvData; + size_t tlvLength; +}; + +} // namespace python + namespace Controller { // The command status will be used for python script. diff --git a/src/controller/python/chip/interaction_model/__init__.py b/src/controller/python/chip/interaction_model/__init__.py index 97c185bdcd96e5..78568563a73475 100644 --- a/src/controller/python/chip/interaction_model/__init__.py +++ b/src/controller/python/chip/interaction_model/__init__.py @@ -26,12 +26,12 @@ from chip.exceptions import ChipStackException -from .delegate import (AttributePath, AttributePathIBstruct, CommandPathIBStruct, DataVersionFilterIBstruct, EventPath, - EventPathIBstruct, SessionParameters, SessionParametersStruct) +from .delegate import (AttributePath, AttributePathIBstruct, DataVersionFilterIBstruct, EventPath, EventPathIBstruct, + PyInvokeRequestData, PyWriteAttributeData, SessionParameters, SessionParametersStruct) -__all__ = ["AttributePath", "AttributePathIBstruct", "CommandPathIBStruct", - "DataVersionFilterIBstruct", "EventPath", "EventPathIBstruct", - "InteractionModelError", "SessionParameters", "SessionParametersStruct", "Status"] +__all__ = ["AttributePath", "AttributePathIBstruct", "DataVersionFilterIBstruct", + "EventPath", "EventPathIBstruct", "InteractionModelError", "PyInvokeRequestData", + "PyWriteAttributeData", "SessionParameters", "SessionParametersStruct", "Status"] # defined src/controller/python/chip/interaction_model/Delegate.h diff --git a/src/controller/python/chip/interaction_model/delegate.py b/src/controller/python/chip/interaction_model/delegate.py index 6ce577b94580de..a9a9c04c4365a9 100644 --- a/src/controller/python/chip/interaction_model/delegate.py +++ b/src/controller/python/chip/interaction_model/delegate.py @@ -46,12 +46,6 @@ "AttributeId" / Int32ul, ) -CommandPathIBStruct = Struct( - "EndpointId" / Int16ul, - "ClusterId" / Int32ul, - "CommandId" / Int32ul, -) - # AttributePath should not contain padding AttributePathIBstruct = Struct( "EndpointId" / Int16ul, @@ -134,6 +128,77 @@ class SessionParameters: maxPathsPerInvoke: int +class PyCommandPath(ctypes.Structure): + ''' InvokeRequest Path struct that has c++ counterpart for CFFI. + + We are using the following struct for passing the information of InvokeRequest between Python and C++: + + ```c + struct PyCommandPath + { + chip::EndpointId endpointId; + chip::ClusterId clusterId; + chip::CommandId commandId; + }; + ``` + ''' + _fields_ = [('endpointId', ctypes.c_uint16), ('clusterId', ctypes.c_uint32), ('commandId', ctypes.c_uint32)] + + +class PyInvokeRequestData(ctypes.Structure): + ''' InvokeRequest struct that has c++ counterpart for CFFI. + + We are using the following struct for passing the information of InvokeRequest between Python and C++: + + ```c + struct PyInvokeRequestData + { + PyCommandPath commandPath; + void * tlvData; + size_t tlvLength; + }; + ``` + ''' + _fields_ = [('commandPath', PyCommandPath), ('tlvData', ctypes.c_void_p), ('tlvLength', ctypes.c_size_t)] + + +class PyAttributePath(ctypes.Structure): + ''' Attributed Path struct that has c++ counterpart for CFFI. + + We are using the following struct for passing the information of WriteAttributes between Python and C++: + + ```c + struct PyAttributePath + { + chip::EndpointId endpointId; + chip::ClusterId clusterId; + chip::AttributeId attributeId; + chip::DataVersion dataVersion; + uint8_t hasDataVersion; + }; + ``` + ''' + _fields_ = [('endpointId', ctypes.c_uint16), ('clusterId', ctypes.c_uint32), ('attributeId', + ctypes.c_uint32), ('dataVersion', ctypes.c_uint32), ('hasDataVersion', ctypes.c_uint8)] + + +class PyWriteAttributeData(ctypes.Structure): + ''' WriteAttribute struct that has c++ counterpart for CFFI. + + We are using the following struct for passing the information of WriteAttributes between Python and C++: + + ```c + struct PyWriteAttributeData + { + PyAttributePath attributePath; + void * tlvData; + size_t tlvLength; + }; + ``` + ''' + _fields_ = [('attributePath', PyAttributePath), ('tlvData', ctypes.c_void_p), ('tlvLength', ctypes.c_size_t)] + + # typedef void (*PythonInteractionModelDelegate_OnCommandResponseStatusCodeReceivedFunct)(uint64_t commandSenderPtr, # void * commandStatusBuf); # typedef void (*PythonInteractionModelDelegate_OnCommandResponseProtocolErrorFunct)(uint64_t commandSenderPtr, From 3395777671f2b38129d59541712be8c7e6673b00 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 00:23:03 +0000 Subject: [PATCH 129/143] Updated energy-evse-cluster.xml to use latest EnergyEVSE.adoc which removes numberOfWeeklyTargets, numberOfDailyTargets, and adds new ChargingTargetScheduleStruct in Get/Set/Clear Target commands --- .../all-clusters-app.matter | 2 +- .../energy-management-app.matter | 2 +- .../data-model/chip/energy-evse-cluster.xml | 4 +-- .../data_model/controller-clusters.matter | 2 +- .../chip/devicecontroller/ChipStructs.java | 22 ++++++++-------- .../zap-generated/CHIPInvokeCallbacks.cpp | 26 +++++++++---------- .../python/chip/clusters/Objects.py | 4 +-- .../zap-generated/MTRCommandPayloadsObjc.mm | 12 ++++----- .../CHIP/zap-generated/MTRStructsObjc.h | 2 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 6 ++--- .../zap-generated/cluster-objects.h | 6 ++--- .../cluster/ComplexArgumentParser.cpp | 10 +++---- .../cluster/logging/DataModelLogger.cpp | 4 +-- .../zap-generated/cluster/Commands.h | 6 ++--- 14 files changed, 54 insertions(+), 54 deletions(-) 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 68230e374e0c29..777670c6770d3c 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 @@ -3934,7 +3934,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } 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 255901812b0f19..79b2a2b46894b1 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 @@ -973,7 +973,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 634c8d6e1b3698..048f217abb7db4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -82,7 +82,7 @@ limitations under the License. - + @@ -115,7 +115,7 @@ limitations under the License. UserMaximumChargeCurrent - + RandomizationDelayWindow diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index cdaea6617d3bc9..9fe728a6497994 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4656,7 +4656,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 8561046c058366..2c8d1b63c311df 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7352,22 +7352,22 @@ public String toString() { } } public static class EnergyEvseClusterChargingTargetScheduleStruct { - public Optional dayOfWeekForSequence; + public Optional dayOfWeekforSequence; public Optional> chargingTargets; - private static final long DAY_OF_WEEK_FOR_SEQUENCE_ID = 0L; + private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; private static final long CHARGING_TARGETS_ID = 1L; public EnergyEvseClusterChargingTargetScheduleStruct( - Optional dayOfWeekForSequence, + Optional dayOfWeekforSequence, Optional> chargingTargets ) { - this.dayOfWeekForSequence = dayOfWeekForSequence; + this.dayOfWeekforSequence = dayOfWeekforSequence; this.chargingTargets = chargingTargets; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DAY_OF_WEEK_FOR_SEQUENCE_ID, dayOfWeekForSequence.map((nonOptionaldayOfWeekForSequence) -> new UIntType(nonOptionaldayOfWeekForSequence)).orElse(new EmptyType()))); + values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); return new StructType(values); @@ -7377,13 +7377,13 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional dayOfWeekForSequence = Optional.empty(); + Optional dayOfWeekforSequence = Optional.empty(); Optional> chargingTargets = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == DAY_OF_WEEK_FOR_SEQUENCE_ID) { + if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - dayOfWeekForSequence = Optional.of(castingValue.value(Integer.class)); + dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); } } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { @@ -7393,7 +7393,7 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp } } return new EnergyEvseClusterChargingTargetScheduleStruct( - dayOfWeekForSequence, + dayOfWeekforSequence, chargingTargets ); } @@ -7402,8 +7402,8 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp public String toString() { StringBuilder output = new StringBuilder(); output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); - output.append("\tdayOfWeekForSequence: "); - output.append(dayOfWeekForSequence); + output.append("\tdayOfWeekforSequence: "); + output.append(dayOfWeekforSequence); output.append("\n"); output.append("\tchargingTargets: "); output.append(chargingTargets); diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 571cf5c9140c81..5bf21dd5f16bba 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3981,23 +3981,23 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( { auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_dayOfWeekForSequence; - if (!entry_0.dayOfWeekForSequence.HasValue()) + jobject newElement_0_dayOfWeekforSequence; + if (!entry_0.dayOfWeekforSequence.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekForSequence); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); } else { - jobject newElement_0_dayOfWeekForSequenceInsideOptional; - std::string newElement_0_dayOfWeekForSequenceInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dayOfWeekForSequenceInsideOptional = static_cast(entry_0.dayOfWeekForSequence.Value().Raw()); + jobject newElement_0_dayOfWeekforSequenceInsideOptional; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dayOfWeekForSequenceInsideOptionalClassName.c_str(), - newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature.c_str(), - jninewElement_0_dayOfWeekForSequenceInsideOptional, newElement_0_dayOfWeekForSequenceInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekForSequenceInsideOptional, - newElement_0_dayOfWeekForSequence); + newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), + newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), + jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, + newElement_0_dayOfWeekforSequence); } jobject newElement_0_chargingTargets; if (!entry_0.chargingTargets.HasValue()) @@ -4108,7 +4108,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( } newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, - newElement_0_dayOfWeekForSequence, newElement_0_chargingTargets); + newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 8fc7cbbc3429b6..622fc30523abf3 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -24063,11 +24063,11 @@ class ChargingTargetScheduleStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekForSequence", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), ]) - dayOfWeekForSequence: 'typing.Optional[uint]' = None + dayOfWeekforSequence: 'typing.Optional[uint]' = None chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None class Commands: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index aa401393f60882..6994220b206bfd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16909,10 +16909,10 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv auto & entry_0 = iter_0.GetValue(); MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekForSequence.HasValue()) { - newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekForSequence = nil; + newElement_0.dayOfWeekforSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables @@ -17343,9 +17343,9 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; - if (element_0.dayOfWeekForSequence != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekForSequence.Emplace(); - definedValue_2 = static_cast>(element_0.dayOfWeekForSequence.unsignedCharValue); + if (element_0.dayOfWeekforSequence != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); + definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); } if (element_0.chargingTargets != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 03c458487ac190..1d155ecd860e9c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1287,7 +1287,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekForSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index ea434a6affb49e..817b54dd8ad33c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5266,7 +5266,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekForSequence = nil; + _dayOfWeekforSequence = nil; _chargingTargets = nil; } @@ -5277,7 +5277,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; - other.dayOfWeekForSequence = self.dayOfWeekForSequence; + other.dayOfWeekforSequence = self.dayOfWeekforSequence; other.chargingTargets = self.chargingTargets; return other; @@ -5285,7 +5285,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekForSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekForSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; return descriptionString; } 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 46f2792ace7d16..cad9c6d003855e 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 @@ -22007,14 +22007,14 @@ using DecodableType = Type; namespace ChargingTargetScheduleStruct { enum class Fields : uint8_t { - kDayOfWeekForSequence = 0, + kDayOfWeekforSequence = 0, kChargingTargets = 1, }; struct Type { public: - Optional> dayOfWeekForSequence; + Optional> dayOfWeekforSequence; Optional> chargingTargets; static constexpr bool kIsFabricScoped = false; @@ -22025,7 +22025,7 @@ struct Type struct DecodableType { public: - Optional> dayOfWeekForSequence; + Optional> dayOfWeekforSequence; Optional> chargingTargets; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 2deb5c5f7303ae..ea06951314b7dd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3259,13 +3259,13 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, Json::Value valueCopy(value); char labelWithMember[kMaxLabelLength]; - if (value.isMember("dayOfWeekForSequence")) + if (value.isMember("dayOfWeekforSequence")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekForSequence"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); ReturnErrorOnFailure( - ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekForSequence, value["dayOfWeekForSequence"])); + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); } - valueCopy.removeMember("dayOfWeekForSequence"); + valueCopy.removeMember("dayOfWeekforSequence"); if (value.isMember("chargingTargets")) { @@ -3279,7 +3279,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) { - ComplexArgumentParser::Finalize(request.dayOfWeekForSequence); + ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); ComplexArgumentParser::Finalize(request.chargingTargets); } 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 8bf5953b30fdf2..446d77b0aee60f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -2896,10 +2896,10 @@ DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("DayOfWeekForSequence", indent + 1, value.dayOfWeekForSequence); + CHIP_ERROR err = LogValue("DayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekForSequence'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekforSequence'"); return err; } } 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 f7d45eb602da6a..6e4ec40955e85b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80918,10 +80918,10 @@ class EnergyEvseSetTargets : public ClusterCommand { for (auto & entry_0 : mRequest.chargingTargetSchedules) { MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekForSequence.HasValue()) { - newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekForSequence = nil; + newElement_0.dayOfWeekforSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables From c605fac7ae4ce625e29222f3ac022fe8f4da8733 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 22:24:53 +0000 Subject: [PATCH 130/143] Removed optional=true in xml for DayOfWeekForSequence & ChargingTargets in ChargingTargetScheduleStruct --- .../all-clusters-app.matter | 4 +- .../energy-management-app.matter | 4 +- .../data-model/chip/energy-evse-cluster.xml | 6 +- .../data_model/controller-clusters.matter | 4 +- .../chip/devicecontroller/ChipStructs.java | 32 ++-- ...EvseClusterChargingTargetScheduleStruct.kt | 46 ++--- ...EvseClusterChargingTargetScheduleStruct.kt | 45 ++--- .../zap-generated/CHIPInvokeCallbacks.cpp | 175 ++++++++---------- .../python/chip/clusters/Objects.py | 8 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 110 +++++------ .../CHIP/zap-generated/MTRStructsObjc.h | 4 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 8 +- .../zap-generated/cluster-objects.h | 10 +- .../cluster/ComplexArgumentParser.cpp | 25 ++- .../zap-generated/cluster/Commands.h | 44 ++--- 15 files changed, 222 insertions(+), 303 deletions(-) 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 777670c6770d3c..19159dd37f2724 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 @@ -3934,8 +3934,8 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - optional ChargingTargetStruct chargingTargets[] = 1; + TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; } info event EVConnected = 0 { 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 79b2a2b46894b1..aec093e322a34a 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 @@ -973,8 +973,8 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - optional ChargingTargetStruct chargingTargets[] = 1; + TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; } info event EVConnected = 0 { diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 048f217abb7db4..a95a5adbd2e34b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -82,8 +82,8 @@ limitations under the License. - - + + @@ -115,7 +115,7 @@ limitations under the License. UserMaximumChargeCurrent - + RandomizationDelayWindow diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9fe728a6497994..28a188e6f37f76 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4656,8 +4656,8 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - optional ChargingTargetStruct chargingTargets[] = 1; + TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; } info event EVConnected = 0 { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 2c8d1b63c311df..43f6b880185622 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7352,23 +7352,23 @@ public String toString() { } } public static class EnergyEvseClusterChargingTargetScheduleStruct { - public Optional dayOfWeekforSequence; - public Optional> chargingTargets; - private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; + public Integer dayOfWeekForSequence; + public ArrayList chargingTargets; + private static final long DAY_OF_WEEK_FOR_SEQUENCE_ID = 0L; private static final long CHARGING_TARGETS_ID = 1L; public EnergyEvseClusterChargingTargetScheduleStruct( - Optional dayOfWeekforSequence, - Optional> chargingTargets + Integer dayOfWeekForSequence, + ArrayList chargingTargets ) { - this.dayOfWeekforSequence = dayOfWeekforSequence; + this.dayOfWeekForSequence = dayOfWeekForSequence; this.chargingTargets = chargingTargets; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); - values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); + values.add(new StructElement(DAY_OF_WEEK_FOR_SEQUENCE_ID, new UIntType(dayOfWeekForSequence))); + values.add(new StructElement(CHARGING_TARGETS_ID, ArrayType.generateArrayType(chargingTargets, (elementchargingTargets) -> elementchargingTargets.encodeTlv()))); return new StructType(values); } @@ -7377,23 +7377,23 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional dayOfWeekforSequence = Optional.empty(); - Optional> chargingTargets = Optional.empty(); + Integer dayOfWeekForSequence = null; + ArrayList chargingTargets = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { + if (element.contextTagNum() == DAY_OF_WEEK_FOR_SEQUENCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); + dayOfWeekForSequence = castingValue.value(Integer.class); } } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); - chargingTargets = Optional.of(castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue))); + chargingTargets = castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue)); } } } return new EnergyEvseClusterChargingTargetScheduleStruct( - dayOfWeekforSequence, + dayOfWeekForSequence, chargingTargets ); } @@ -7402,8 +7402,8 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp public String toString() { StringBuilder output = new StringBuilder(); output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); - output.append("\tdayOfWeekforSequence: "); - output.append(dayOfWeekforSequence); + output.append("\tdayOfWeekForSequence: "); + output.append(dayOfWeekForSequence); output.append("\n"); output.append("\tchargingTargets: "); output.append(chargingTargets); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index 2cff1004099c89..bddc2563640620 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -17,7 +17,6 @@ package chip.devicecontroller.cluster.structs import chip.devicecontroller.cluster.* -import java.util.Optional import matter.tlv.AnonymousTag import matter.tlv.ContextSpecificTag import matter.tlv.Tag @@ -25,8 +24,8 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekForSequence: Optional, - val chargingTargets: Optional> + val dayOfWeekForSequence: UInt, + val chargingTargets: List ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") @@ -38,18 +37,12 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekForSequence.isPresent) { - val optdayOfWeekForSequence = dayOfWeekForSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) - } - if (chargingTargets.isPresent) { - val optchargingTargets = chargingTargets.get() - startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - for (item in optchargingTargets.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), dayOfWeekForSequence) + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in chargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) } + endArray() endStructure() } } @@ -60,25 +53,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) - val dayOfWeekForSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) - } else { - Optional.empty() - } + val dayOfWeekForSequence = tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE)) val chargingTargets = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { - Optional.of( - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - while (!tlvReader.isEndOfContainer()) { - add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() - } - ) - } else { - Optional.empty() + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index 417b0657103494..eaa06f527c652f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -16,7 +16,6 @@ */ package matter.controller.cluster.structs -import java.util.Optional import matter.controller.cluster.* import matter.tlv.AnonymousTag import matter.tlv.ContextSpecificTag @@ -25,8 +24,8 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekForSequence: Optional, - val chargingTargets: Optional> + val dayOfWeekForSequence: UByte, + val chargingTargets: List ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") @@ -38,18 +37,12 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekForSequence.isPresent) { - val optdayOfWeekForSequence = dayOfWeekForSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) - } - if (chargingTargets.isPresent) { - val optchargingTargets = chargingTargets.get() - startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - for (item in optchargingTargets.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), dayOfWeekForSequence) + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in chargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) } + endArray() endStructure() } } @@ -61,24 +54,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) val dayOfWeekForSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) - } else { - Optional.empty() - } + tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE)) val chargingTargets = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { - Optional.of( - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - while (!tlvReader.isEndOfContainer()) { - add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() - } - ) - } else { - Optional.empty() + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } tlvReader.exitContainer() diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 5bf21dd5f16bba..15ee339bd13e8d 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3981,110 +3981,87 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( { auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_dayOfWeekforSequence; - if (!entry_0.dayOfWeekforSequence.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); - } - else - { - jobject newElement_0_dayOfWeekforSequenceInsideOptional; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), - newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), - jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, - newElement_0_dayOfWeekforSequence); - } + jobject newElement_0_dayOfWeekForSequence; + std::string newElement_0_dayOfWeekForSequenceClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekForSequenceCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekForSequence = static_cast(entry_0.dayOfWeekForSequence.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dayOfWeekForSequenceClassName.c_str(), newElement_0_dayOfWeekForSequenceCtorSignature.c_str(), + jninewElement_0_dayOfWeekForSequence, newElement_0_dayOfWeekForSequence); jobject newElement_0_chargingTargets; - if (!entry_0.chargingTargets.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_chargingTargets); - } - else - { - jobject newElement_0_chargingTargetsInsideOptional; - chip::JniReferences::GetInstance().CreateArrayList(newElement_0_chargingTargetsInsideOptional); + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_chargingTargets); - auto iter_newElement_0_chargingTargetsInsideOptional_3 = entry_0.chargingTargets.Value().begin(); - while (iter_newElement_0_chargingTargetsInsideOptional_3.Next()) + auto iter_newElement_0_chargingTargets_2 = entry_0.chargingTargets.begin(); + while (iter_newElement_0_chargingTargets_2.Next()) + { + auto & entry_2 = iter_newElement_0_chargingTargets_2.GetValue(); + jobject newElement_2; + jobject newElement_2_targetTimeMinutesPastMidnight; + std::string newElement_2_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; + std::string newElement_2_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; + jint jninewElement_2_targetTimeMinutesPastMidnight = static_cast(entry_2.targetTimeMinutesPastMidnight); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_targetTimeMinutesPastMidnightClassName.c_str(), + newElement_2_targetTimeMinutesPastMidnightCtorSignature.c_str(), jninewElement_2_targetTimeMinutesPastMidnight, + newElement_2_targetTimeMinutesPastMidnight); + jobject newElement_2_targetSoC; + if (!entry_2.targetSoC.HasValue()) { - auto & entry_3 = iter_newElement_0_chargingTargetsInsideOptional_3.GetValue(); - jobject newElement_3; - jobject newElement_3_targetTimeMinutesPastMidnight; - std::string newElement_3_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; - std::string newElement_3_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; - jint jninewElement_3_targetTimeMinutesPastMidnight = static_cast(entry_3.targetTimeMinutesPastMidnight); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_targetSoC); + } + else + { + jobject newElement_2_targetSoCInsideOptional; + std::string newElement_2_targetSoCInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_targetSoCInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_targetSoCInsideOptional = static_cast(entry_2.targetSoC.Value()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_targetTimeMinutesPastMidnightClassName.c_str(), - newElement_3_targetTimeMinutesPastMidnightCtorSignature.c_str(), jninewElement_3_targetTimeMinutesPastMidnight, - newElement_3_targetTimeMinutesPastMidnight); - jobject newElement_3_targetSoC; - if (!entry_3.targetSoC.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_targetSoC); - } - else - { - jobject newElement_3_targetSoCInsideOptional; - std::string newElement_3_targetSoCInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_3_targetSoCInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_3_targetSoCInsideOptional = static_cast(entry_3.targetSoC.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_targetSoCInsideOptionalClassName.c_str(), - newElement_3_targetSoCInsideOptionalCtorSignature.c_str(), jninewElement_3_targetSoCInsideOptional, - newElement_3_targetSoCInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_3_targetSoCInsideOptional, newElement_3_targetSoC); - } - jobject newElement_3_addedEnergy; - if (!entry_3.addedEnergy.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_addedEnergy); - } - else - { - jobject newElement_3_addedEnergyInsideOptional; - std::string newElement_3_addedEnergyInsideOptionalClassName = "java/lang/Long"; - std::string newElement_3_addedEnergyInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_3_addedEnergyInsideOptional = static_cast(entry_3.addedEnergy.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_addedEnergyInsideOptionalClassName.c_str(), - newElement_3_addedEnergyInsideOptionalCtorSignature.c_str(), jninewElement_3_addedEnergyInsideOptional, - newElement_3_addedEnergyInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_3_addedEnergyInsideOptional, - newElement_3_addedEnergy); - } - - jclass chargingTargetStructStructClass_4; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", - chargingTargetStructStructClass_4); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); - return; - } + newElement_2_targetSoCInsideOptionalClassName.c_str(), + newElement_2_targetSoCInsideOptionalCtorSignature.c_str(), jninewElement_2_targetSoCInsideOptional, + newElement_2_targetSoCInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_targetSoCInsideOptional, newElement_2_targetSoC); + } + jobject newElement_2_addedEnergy; + if (!entry_2.addedEnergy.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_addedEnergy); + } + else + { + jobject newElement_2_addedEnergyInsideOptional; + std::string newElement_2_addedEnergyInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_addedEnergyInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_addedEnergyInsideOptional = static_cast(entry_2.addedEnergy.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_addedEnergyInsideOptionalClassName.c_str(), + newElement_2_addedEnergyInsideOptionalCtorSignature.c_str(), jninewElement_2_addedEnergyInsideOptional, + newElement_2_addedEnergyInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_addedEnergyInsideOptional, newElement_2_addedEnergy); + } - jmethodID chargingTargetStructStructCtor_4; - err = chip::JniReferences::GetInstance().FindMethod( - env, chargingTargetStructStructClass_4, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", &chargingTargetStructStructCtor_4); - if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_4 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); - return; - } + jclass chargingTargetStructStructClass_3; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", chargingTargetStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); + return; + } - newElement_3 = - env->NewObject(chargingTargetStructStructClass_4, chargingTargetStructStructCtor_4, - newElement_3_targetTimeMinutesPastMidnight, newElement_3_targetSoC, newElement_3_addedEnergy); - chip::JniReferences::GetInstance().AddToList(newElement_0_chargingTargetsInsideOptional, newElement_3); + jmethodID chargingTargetStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", + &chargingTargetStructStructCtor_3); + if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); + return; } - chip::JniReferences::GetInstance().CreateOptional(newElement_0_chargingTargetsInsideOptional, - newElement_0_chargingTargets); + + newElement_2 = + env->NewObject(chargingTargetStructStructClass_3, chargingTargetStructStructCtor_3, + newElement_2_targetTimeMinutesPastMidnight, newElement_2_targetSoC, newElement_2_addedEnergy); + chip::JniReferences::GetInstance().AddToList(newElement_0_chargingTargets, newElement_2); } jclass chargingTargetScheduleStructStructClass_1; @@ -4099,7 +4076,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( jmethodID chargingTargetScheduleStructStructCtor_1; err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetScheduleStructStructClass_1, "", - "(Ljava/util/Optional;Ljava/util/Optional;)V", + "(Ljava/lang/Integer;Ljava/util/ArrayList;)V", &chargingTargetScheduleStructStructCtor_1); if (err != CHIP_NO_ERROR || chargingTargetScheduleStructStructCtor_1 == nullptr) { @@ -4108,7 +4085,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( } newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, - newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); + newElement_0_dayOfWeekForSequence, newElement_0_chargingTargets); chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 622fc30523abf3..503b9738acce84 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -24063,12 +24063,12 @@ class ChargingTargetScheduleStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), + ClusterObjectFieldDescriptor(Label="dayOfWeekForSequence", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.List[EnergyEvse.Structs.ChargingTargetStruct]), ]) - dayOfWeekforSequence: 'typing.Optional[uint]' = None - chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None + dayOfWeekForSequence: 'uint' = 0 + chargingTargets: 'typing.List[EnergyEvse.Structs.ChargingTargetStruct]' = field(default_factory=lambda: []) class Commands: @dataclass diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 6994220b206bfd..5aaa076eb34afc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16909,40 +16909,32 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv auto & entry_0 = iter_0.GetValue(); MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; - } else { - newElement_0.dayOfWeekforSequence = nil; - } - if (entry_0.chargingTargets.HasValue()) { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = entry_0.chargingTargets.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - MTREnergyEVSEClusterChargingTargetStruct * newElement_3; - newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; - if (entry_3.targetSoC.HasValue()) { - newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; - } else { - newElement_3.targetSoC = nil; - } - if (entry_3.addedEnergy.HasValue()) { - newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; - } else { - newElement_3.addedEnergy = nil; - } - [array_3 addObject:newElement_3]; + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Raw()]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.chargingTargets.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTREnergyEVSEClusterChargingTargetStruct * newElement_2; + newElement_2 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_2.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_2.targetTimeMinutesPastMidnight]; + if (entry_2.targetSoC.HasValue()) { + newElement_2.targetSoC = [NSNumber numberWithUnsignedChar:entry_2.targetSoC.Value()]; + } else { + newElement_2.targetSoC = nil; } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - return err; + if (entry_2.addedEnergy.HasValue()) { + newElement_2.addedEnergy = [NSNumber numberWithLongLong:entry_2.addedEnergy.Value()]; + } else { + newElement_2.addedEnergy = nil; } - newElement_0.chargingTargets = array_3; + [array_2 addObject:newElement_2]; } - } else { - newElement_0.chargingTargets = nil; + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + return err; + } + newElement_0.chargingTargets = array_2; } [array_0 addObject:newElement_0]; } @@ -17343,41 +17335,35 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; - if (element_0.dayOfWeekforSequence != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); - definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); - } - if (element_0.chargingTargets != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); - { - using ListType_3 = std::remove_reference_t; - using ListMemberType_3 = ListMemberTypeGetter::Type; - if (element_0.chargingTargets.count != 0) { - auto * listHolder_3 = new ListHolder(element_0.chargingTargets.count); - if (listHolder_3 == nullptr || listHolder_3->mList == nullptr) { + listHolder_0->mList[i_0].dayOfWeekForSequence = static_castmList[i_0].dayOfWeekForSequence)>>(element_0.dayOfWeekForSequence.unsignedCharValue); + { + using ListType_2 = std::remove_reference_tmList[i_0].chargingTargets)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.chargingTargets.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.chargingTargets.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.chargingTargets.count; ++i_2) { + if (![element_0.chargingTargets[i_2] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { + // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - listFreer.add(listHolder_3); - for (size_t i_3 = 0; i_3 < element_0.chargingTargets.count; ++i_3) { - if (![element_0.chargingTargets[i_3] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_3 = (MTREnergyEVSEClusterChargingTargetStruct *) element_0.chargingTargets[i_3]; - listHolder_3->mList[i_3].targetTimeMinutesPastMidnight = element_3.targetTimeMinutesPastMidnight.unsignedShortValue; - if (element_3.targetSoC != nil) { - auto & definedValue_5 = listHolder_3->mList[i_3].targetSoC.Emplace(); - definedValue_5 = element_3.targetSoC.unsignedCharValue; - } - if (element_3.addedEnergy != nil) { - auto & definedValue_5 = listHolder_3->mList[i_3].addedEnergy.Emplace(); - definedValue_5 = element_3.addedEnergy.longLongValue; - } + auto element_2 = (MTREnergyEVSEClusterChargingTargetStruct *) element_0.chargingTargets[i_2]; + listHolder_2->mList[i_2].targetTimeMinutesPastMidnight = element_2.targetTimeMinutesPastMidnight.unsignedShortValue; + if (element_2.targetSoC != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].targetSoC.Emplace(); + definedValue_4 = element_2.targetSoC.unsignedCharValue; + } + if (element_2.addedEnergy != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].addedEnergy.Emplace(); + definedValue_4 = element_2.addedEnergy.longLongValue; } - definedValue_2 = ListType_3(listHolder_3->mList, element_0.chargingTargets.count); - } else { - definedValue_2 = ListType_3(); } + listHolder_0->mList[i_0].chargingTargets = ListType_2(listHolder_2->mList, element_0.chargingTargets.count); + } else { + listHolder_0->mList[i_0].chargingTargets = ListType_2(); } } } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 1d155ecd860e9c..dd26ad6a56dad5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1287,8 +1287,8 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull dayOfWeekForSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull chargingTargets MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 817b54dd8ad33c..d25571b48861f0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5266,9 +5266,9 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = nil; + _dayOfWeekForSequence = @(0); - _chargingTargets = nil; + _chargingTargets = [NSArray array]; } return self; } @@ -5277,7 +5277,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; + other.dayOfWeekForSequence = self.dayOfWeekForSequence; other.chargingTargets = self.chargingTargets; return other; @@ -5285,7 +5285,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekForSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekForSequence, _chargingTargets]; return descriptionString; } 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 cad9c6d003855e..7de5dc885bcecb 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 @@ -22007,15 +22007,15 @@ using DecodableType = Type; namespace ChargingTargetScheduleStruct { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, + kDayOfWeekForSequence = 0, kChargingTargets = 1, }; struct Type { public: - Optional> dayOfWeekforSequence; - Optional> chargingTargets; + chip::BitMask dayOfWeekForSequence = static_cast>(0); + DataModel::List chargingTargets; static constexpr bool kIsFabricScoped = false; @@ -22025,8 +22025,8 @@ struct Type struct DecodableType { public: - Optional> dayOfWeekforSequence; - Optional> chargingTargets; + chip::BitMask dayOfWeekForSequence = static_cast>(0); + DataModel::DecodableList chargingTargets; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index ea06951314b7dd..d32f230dc1d739 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3258,20 +3258,19 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, // Copy to track which members we already processed. Json::Value valueCopy(value); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChargingTargetScheduleStruct.dayOfWeekForSequence", + "dayOfWeekForSequence", value.isMember("dayOfWeekForSequence"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChargingTargetScheduleStruct.chargingTargets", "chargingTargets", + value.isMember("chargingTargets"))); + char labelWithMember[kMaxLabelLength]; - if (value.isMember("dayOfWeekforSequence")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); - ReturnErrorOnFailure( - ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); - } - valueCopy.removeMember("dayOfWeekforSequence"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekForSequence"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekForSequence, value["dayOfWeekForSequence"])); + valueCopy.removeMember("dayOfWeekForSequence"); - if (value.isMember("chargingTargets")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "chargingTargets"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.chargingTargets, value["chargingTargets"])); - } + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "chargingTargets"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.chargingTargets, value["chargingTargets"])); valueCopy.removeMember("chargingTargets"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); @@ -3279,7 +3278,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) { - ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); + ComplexArgumentParser::Finalize(request.dayOfWeekForSequence); ComplexArgumentParser::Finalize(request.chargingTargets); } 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 6e4ec40955e85b..6c6793c214a049 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80918,34 +80918,26 @@ class EnergyEvseSetTargets : public ClusterCommand { for (auto & entry_0 : mRequest.chargingTargetSchedules) { MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; - } else { - newElement_0.dayOfWeekforSequence = nil; - } - if (entry_0.chargingTargets.HasValue()) { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - for (auto & entry_3 : entry_0.chargingTargets.Value()) { - MTREnergyEVSEClusterChargingTargetStruct * newElement_3; - newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; - if (entry_3.targetSoC.HasValue()) { - newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; - } else { - newElement_3.targetSoC = nil; - } - if (entry_3.addedEnergy.HasValue()) { - newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; - } else { - newElement_3.addedEnergy = nil; - } - [array_3 addObject:newElement_3]; + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Raw()]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + for (auto & entry_2 : entry_0.chargingTargets) { + MTREnergyEVSEClusterChargingTargetStruct * newElement_2; + newElement_2 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_2.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_2.targetTimeMinutesPastMidnight]; + if (entry_2.targetSoC.HasValue()) { + newElement_2.targetSoC = [NSNumber numberWithUnsignedChar:entry_2.targetSoC.Value()]; + } else { + newElement_2.targetSoC = nil; } - newElement_0.chargingTargets = array_3; + if (entry_2.addedEnergy.HasValue()) { + newElement_2.addedEnergy = [NSNumber numberWithLongLong:entry_2.addedEnergy.Value()]; + } else { + newElement_2.addedEnergy = nil; + } + [array_2 addObject:newElement_2]; } - } else { - newElement_0.chargingTargets = nil; + newElement_0.chargingTargets = array_2; } [array_0 addObject:newElement_0]; } From 495d3478e8edff6069936c1f3abc7f39f3d0d038 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 15 Jan 2024 19:58:49 +0000 Subject: [PATCH 131/143] Small correction to description in test case. --- src/python_testing/TC_EEVSE_2_5.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_EEVSE_2_5.py b/src/python_testing/TC_EEVSE_2_5.py index 1a647c20e0bcef..34ca0151935f93 100644 --- a/src/python_testing/TC_EEVSE_2_5.py +++ b/src/python_testing/TC_EEVSE_2_5.py @@ -51,12 +51,12 @@ def steps_TC_EEVSE_2_5(self) -> list[TestStep]: TestStep("5", "TH sends command StartDiagnostics. Verify that command is rejected with Failure"), TestStep("6", "TH sends command Disable."), TestStep("6a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (Disabled)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), TestStep("7", "TH sends command StartDiagnostics. Verify that command is accepted with Success"), TestStep("7a", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (DisabledDiagnostics)"), TestStep("8", "A few seconds later TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Diagnostics Complete Event"), TestStep("8a", "TH reads from the DUT the State attribute. Verify value is 0x00 (NotPluggedIn)"), - TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x04 (Disabled)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute. Verify value is 0x00 (Disabled)"), TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), ] From e44dbf75aa506f4272b9fd7788438651364a10d4 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 00:23:03 +0000 Subject: [PATCH 132/143] Updated energy-evse-cluster.xml to use latest EnergyEVSE.adoc which removes numberOfWeeklyTargets, numberOfDailyTargets, and adds new ChargingTargetScheduleStruct in Get/Set/Clear Target commands --- .../all-clusters-app.matter | 21 +- .../all-clusters-common/all-clusters-app.zap | 32 --- .../energy-management-app.matter | 21 +- .../energy-management-app.zap | 32 --- .../include/EnergyEvseDelegateImpl.h | 4 - .../src/EnergyEvseDelegateImpl.cpp | 8 - .../energy-evse-server/energy-evse-server.cpp | 4 - .../energy-evse-server/energy-evse-server.h | 7 +- .../data-model/chip/energy-evse-cluster.xml | 111 ++++---- .../data_model/controller-clusters.matter | 19 +- .../chip/devicecontroller/ChipClusters.java | 89 +------ .../chip/devicecontroller/ChipStructs.java | 61 +++++ .../devicecontroller/ClusterIDMapping.java | 21 +- .../devicecontroller/ClusterInfoMapping.java | 21 +- .../devicecontroller/ClusterReadMapping.java | 22 -- .../chip/devicecontroller/cluster/files.gni | 1 + .../cluster/clusters/EnergyEvseCluster.kt | 235 ++--------------- .../java/matter/controller/cluster/files.gni | 1 + .../CHIPAttributeTLVValueDecoder.cpp | 32 --- .../zap-generated/CHIPInvokeCallbacks.cpp | 171 ++++++++----- .../python/chip/clusters/CHIPClusters.py | 16 +- .../python/chip/clusters/Objects.py | 64 ++--- .../MTRAttributeSpecifiedCheck.mm | 6 - .../MTRAttributeTLVValueDecoder.mm | 22 -- .../CHIP/zap-generated/MTRBaseClusters.h | 16 +- .../CHIP/zap-generated/MTRBaseClusters.mm | 78 +----- .../CHIP/zap-generated/MTRClusterConstants.h | 2 - .../CHIP/zap-generated/MTRClusters.h | 8 +- .../CHIP/zap-generated/MTRClusters.mm | 16 +- .../zap-generated/MTRCommandPayloadsObjc.h | 10 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 136 ++++++---- .../CHIP/zap-generated/MTRStructsObjc.h | 6 + .../CHIP/zap-generated/MTRStructsObjc.mm | 30 +++ .../zap-generated/attributes/Accessors.cpp | 62 ----- .../zap-generated/attributes/Accessors.h | 10 - .../zap-generated/cluster-objects.cpp | 71 +++--- .../zap-generated/cluster-objects.h | 78 +++--- .../app-common/zap-generated/ids/Attributes.h | 8 - .../zap-generated/cluster/Commands.h | 28 +- .../cluster/ComplexArgumentParser.cpp | 34 +++ .../cluster/ComplexArgumentParser.h | 5 + .../cluster/logging/DataModelLogger.cpp | 39 ++- .../cluster/logging/DataModelLogger.h | 3 + .../zap-generated/cluster/Commands.h | 239 +++--------------- 44 files changed, 643 insertions(+), 1257 deletions(-) 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 a63bd698b5f656..777670c6770d3c 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 @@ -3933,6 +3933,11 @@ provisional cluster EnergyEvse = 153 { optional energy_mwh addedEnergy = 2; } + struct ChargingTargetScheduleStruct { + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional ChargingTargetStruct chargingTargets[] = 1; + } + info event EVConnected = 0 { int32u sessionID = 0; } @@ -3980,8 +3985,6 @@ provisional cluster EnergyEvse = 153 { readonly attribute optional amperage_ma maximumDischargeCurrent = 8; attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; - readonly attribute optional int8u numberOfWeeklyTargets = 33; - readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; @@ -4002,8 +4005,7 @@ provisional cluster EnergyEvse = 153 { readonly attribute int16u clusterRevision = 65533; response struct GetTargetsResponse = 0 { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } request struct EnableChargingRequest { @@ -4018,12 +4020,7 @@ provisional cluster EnergyEvse = 153 { } request struct SetTargetsRequest { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; - } - - request struct GetTargetsRequest { - TargetDayOfWeekBitmap daysToReturn = 0; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } /** Allows a client to disable the EVSE from charging and discharging. */ @@ -4037,7 +4034,7 @@ provisional cluster EnergyEvse = 153 { /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; /** Allows a client to retrieve the user specified charging targets. */ - timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6; + timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; } @@ -7545,8 +7542,6 @@ endpoint 1 { callback attribute maximumDischargeCurrent default = 0; callback attribute userMaximumChargeCurrent default = 0; callback attribute randomizationDelayWindow default = 600; - callback attribute numberOfWeeklyTargets default = 0; - callback attribute numberOfDailyTargets default = 1; callback attribute nextChargeStartTime; callback attribute nextChargeTargetTime; callback attribute nextChargeRequiredEnergy; 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 c69cbe4cd4c4bf..44c739fd60be7e 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 @@ -12574,38 +12574,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "NumberOfWeeklyTargets", - "code": 33, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "NumberOfDailyTargets", - "code": 34, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NextChargeStartTime", "code": 35, 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 d48a22c42cc51e..79b2a2b46894b1 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 @@ -972,6 +972,11 @@ provisional cluster EnergyEvse = 153 { optional energy_mwh addedEnergy = 2; } + struct ChargingTargetScheduleStruct { + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional ChargingTargetStruct chargingTargets[] = 1; + } + info event EVConnected = 0 { int32u sessionID = 0; } @@ -1019,8 +1024,6 @@ provisional cluster EnergyEvse = 153 { readonly attribute optional amperage_ma maximumDischargeCurrent = 8; attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; - readonly attribute optional int8u numberOfWeeklyTargets = 33; - readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; @@ -1041,8 +1044,7 @@ provisional cluster EnergyEvse = 153 { readonly attribute int16u clusterRevision = 65533; response struct GetTargetsResponse = 0 { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } request struct EnableChargingRequest { @@ -1057,12 +1059,7 @@ provisional cluster EnergyEvse = 153 { } request struct SetTargetsRequest { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; - } - - request struct GetTargetsRequest { - TargetDayOfWeekBitmap daysToReturn = 0; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } /** Allows a client to disable the EVSE from charging and discharging. */ @@ -1076,7 +1073,7 @@ provisional cluster EnergyEvse = 153 { /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; /** Allows a client to retrieve the user specified charging targets. */ - timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6; + timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; } @@ -1308,8 +1305,6 @@ endpoint 1 { callback attribute maximumDischargeCurrent default = 0; callback attribute userMaximumChargeCurrent default = 0; callback attribute randomizationDelayWindow default = 600; - callback attribute numberOfWeeklyTargets default = 0; - callback attribute numberOfDailyTargets default = 1; callback attribute nextChargeStartTime; callback attribute nextChargeTargetTime; callback attribute nextChargeRequiredEnergy; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index 55d62101227dab..c160b35de2f7d8 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -2768,38 +2768,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "NumberOfWeeklyTargets", - "code": 33, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "NumberOfDailyTargets", - "code": 34, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "NextChargeStartTime", "code": 35, diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 8cf76f1b7a29bf..e365ef4f304ba6 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -208,8 +208,6 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate CHIP_ERROR SetRandomizationDelayWindow(uint32_t) override; /* PREF attributes */ - uint8_t GetNumberOfWeeklyTargets() override; - uint8_t GetNumberOfDailyTargets() override; DataModel::Nullable GetNextChargeStartTime() override; DataModel::Nullable GetNextChargeTargetTime() override; DataModel::Nullable GetNextChargeRequiredEnergy() override; @@ -293,8 +291,6 @@ class EnergyEvseDelegate : public EnergyEvse::Delegate int64_t mUserMaximumChargeCurrent = kDefaultUserMaximumChargeCurrent; // TODO update spec uint32_t mRandomizationDelayWindow = kDefaultRandomizationDelayWindow; /* PREF attributes */ - uint8_t mNumberOfWeeklyTargets = 0; - uint8_t mNumberOfDailyTargets = 1; DataModel::Nullable mNextChargeStartTime; DataModel::Nullable mNextChargeTargetTime; DataModel::Nullable mNextChargeRequiredEnergy; diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp index 2b4a6e44f5fcea..dc60d748958894 100644 --- a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp @@ -1374,14 +1374,6 @@ CHIP_ERROR EnergyEvseDelegate::SetRandomizationDelayWindow(uint32_t newValue) } /* PREF attributes */ -uint8_t EnergyEvseDelegate::GetNumberOfWeeklyTargets() -{ - return mNumberOfWeeklyTargets; -} -uint8_t EnergyEvseDelegate::GetNumberOfDailyTargets() -{ - return mNumberOfDailyTargets; -} DataModel::Nullable EnergyEvseDelegate::GetNextChargeStartTime() { return mNextChargeStartTime; diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.cpp b/src/app/clusters/energy-evse-server/energy-evse-server.cpp index bc07ba07eef55a..d718eb134c2f81 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.cpp +++ b/src/app/clusters/energy-evse-server/energy-evse-server.cpp @@ -95,10 +95,6 @@ CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValu /* Optional */ return aEncoder.Encode(mDelegate.GetRandomizationDelayWindow()); /* PREF - ChargingPreferences attributes */ - case NumberOfWeeklyTargets::Id: - return aEncoder.Encode(mDelegate.GetNumberOfWeeklyTargets()); - case NumberOfDailyTargets::Id: - return aEncoder.Encode(mDelegate.GetNumberOfDailyTargets()); case NextChargeStartTime::Id: return aEncoder.Encode(mDelegate.GetNextChargeStartTime()); case NextChargeTargetTime::Id: diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h index a194551607c6f4..edac2357e97c39 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.h +++ b/src/app/clusters/energy-evse-server/energy-evse-server.h @@ -94,8 +94,6 @@ class Delegate virtual int64_t GetUserMaximumChargeCurrent() = 0; virtual uint32_t GetRandomizationDelayWindow() = 0; /* PREF attributes */ - virtual uint8_t GetNumberOfWeeklyTargets() = 0; - virtual uint8_t GetNumberOfDailyTargets() = 0; virtual DataModel::Nullable GetNextChargeStartTime() = 0; virtual DataModel::Nullable GetNextChargeTargetTime() = 0; virtual DataModel::Nullable GetNextChargeRequiredEnergy() = 0; @@ -142,9 +140,8 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface public: Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs, OptionalCommands aOptionalCmds) : - AttributeAccessInterface(MakeOptional(aEndpointId), Id), - CommandHandlerInterface(MakeOptional(aEndpointId), Id), mDelegate(aDelegate), mFeature(aFeature), - mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds) + AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), + mDelegate(aDelegate), mFeature(aFeature), mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds) { /* set the base class delegates endpointId */ mDelegate.SetEndpointId(aEndpointId); diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 2e58fb31da3f42..048f217abb7db4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -13,6 +13,7 @@ limitations under the License. --> + @@ -23,6 +24,7 @@ limitations under the License. + @@ -31,6 +33,7 @@ limitations under the License. + @@ -51,12 +54,14 @@ limitations under the License. + + @@ -67,12 +72,20 @@ limitations under the License. + - - - + + + + + + + + + + Energy EVSE Energy Management @@ -81,92 +94,97 @@ limitations under the License. true true Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. - - + - State - SupplyState - FaultState + + State + SupplyState + FaultState ChargingEnabledUntil + DischargingEnabledUntil CircuitCapacity MinimumChargeCurrent MaximumChargeCurrent + MaximumDischargeCurrent - UserMaximumChargeCurrent - - + RandomizationDelayWindow - NumberOfWeeklyTargets + - NumberOfDailyTargets + - NextChargeStartTime + + NextChargeStartTime - NextChargeTargetTime + + NextChargeTargetTime + NextChargeRequiredEnergy - NextChargeTargetSoC + + NextChargeTargetSoC - - + + ApproximateEVEfficiency - StateOfCharge + + StateOfCharge + BatteryCapacity + VehicleID SessionID SessionDuration SessionEnergyCharged + SessionEnergyDischarged - + Allows a client to disable the EVSE from charging and discharging. - - + + Allows a client to enable the EVSE to charge an EV. - - + + Allows a client to enable the EVSE to discharge an EV. - + Allows a client to put the EVSE into a self-diagnostics mode. - - - + + Allows a client to set the user specified charging targets. - - + Allows a client to retrieve the user specified charging targets. - + Allows a client to clear all stored charging targets. - - - + + The GetTargetsResponse is sent in response to the GetTargets Command. @@ -176,30 +194,30 @@ limitations under the License. EVNotDetected - + - + EnergyTransferStarted - + EnergyTransferStopped - - + + Fault - - - + + + RFID @@ -208,10 +226,11 @@ limitations under the License. - - - - + + + + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9b39b0d849af15..9fe728a6497994 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4655,6 +4655,11 @@ provisional cluster EnergyEvse = 153 { optional energy_mwh addedEnergy = 2; } + struct ChargingTargetScheduleStruct { + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional ChargingTargetStruct chargingTargets[] = 1; + } + info event EVConnected = 0 { int32u sessionID = 0; } @@ -4702,8 +4707,6 @@ provisional cluster EnergyEvse = 153 { readonly attribute optional amperage_ma maximumDischargeCurrent = 8; attribute access(write: manage) optional amperage_ma userMaximumChargeCurrent = 9; attribute access(write: manage) optional elapsed_s randomizationDelayWindow = 10; - readonly attribute optional int8u numberOfWeeklyTargets = 33; - readonly attribute optional int8u numberOfDailyTargets = 34; readonly attribute optional nullable epoch_s nextChargeStartTime = 35; readonly attribute optional nullable epoch_s nextChargeTargetTime = 36; readonly attribute optional nullable energy_mwh nextChargeRequiredEnergy = 37; @@ -4724,8 +4727,7 @@ provisional cluster EnergyEvse = 153 { readonly attribute int16u clusterRevision = 65533; response struct GetTargetsResponse = 0 { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } request struct EnableChargingRequest { @@ -4740,12 +4742,7 @@ provisional cluster EnergyEvse = 153 { } request struct SetTargetsRequest { - TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - ChargingTargetStruct chargingTargets[] = 1; - } - - request struct GetTargetsRequest { - TargetDayOfWeekBitmap daysToReturn = 0; + ChargingTargetScheduleStruct chargingTargetSchedules[] = 0; } /** Allows a client to disable the EVSE from charging and discharging. */ @@ -4759,7 +4756,7 @@ provisional cluster EnergyEvse = 153 { /** Allows a client to set the user specified charging targets. */ timed command SetTargets(SetTargetsRequest): DefaultSuccess = 5; /** Allows a client to retrieve the user specified charging targets. */ - timed command GetTargets(GetTargetsRequest): GetTargetsResponse = 6; + timed command GetTargets(): GetTargetsResponse = 6; /** Allows a client to clear all stored charging targets. */ timed command ClearTargets(): DefaultSuccess = 7; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index f050f7e1428d6a..7209aeff02b6df 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -29842,8 +29842,6 @@ public static class EnergyEvseCluster extends BaseChipCluster { private static final long MAXIMUM_DISCHARGE_CURRENT_ATTRIBUTE_ID = 8L; private static final long USER_MAXIMUM_CHARGE_CURRENT_ATTRIBUTE_ID = 9L; private static final long RANDOMIZATION_DELAY_WINDOW_ATTRIBUTE_ID = 10L; - private static final long NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID = 33L; - private static final long NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID = 34L; private static final long NEXT_CHARGE_START_TIME_ATTRIBUTE_ID = 35L; private static final long NEXT_CHARGE_TARGET_TIME_ATTRIBUTE_ID = 36L; private static final long NEXT_CHARGE_REQUIRED_ENERGY_ATTRIBUTE_ID = 37L; @@ -29946,17 +29944,13 @@ public void onResponse(StructType invokeStructValue) { } - public void setTargets(DefaultClusterCallback callback, Integer dayOfWeekforSequence, ArrayList chargingTargets, int timedInvokeTimeoutMs) { + public void setTargets(DefaultClusterCallback callback, ArrayList chargingTargetSchedules, int timedInvokeTimeoutMs) { final long commandId = 5L; ArrayList elements = new ArrayList<>(); - final long dayOfWeekforSequenceFieldID = 0L; - BaseTLVType dayOfWeekforSequencetlvValue = new UIntType(dayOfWeekforSequence); - elements.add(new StructElement(dayOfWeekforSequenceFieldID, dayOfWeekforSequencetlvValue)); - - final long chargingTargetsFieldID = 1L; - BaseTLVType chargingTargetstlvValue = ArrayType.generateArrayType(chargingTargets, (elementchargingTargets) -> elementchargingTargets.encodeTlv()); - elements.add(new StructElement(chargingTargetsFieldID, chargingTargetstlvValue)); + final long chargingTargetSchedulesFieldID = 0L; + BaseTLVType chargingTargetSchedulestlvValue = ArrayType.generateArrayType(chargingTargetSchedules, (elementchargingTargetSchedules) -> elementchargingTargetSchedules.encodeTlv()); + elements.add(new StructElement(chargingTargetSchedulesFieldID, chargingTargetSchedulestlvValue)); StructType value = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @@ -29967,36 +29961,25 @@ public void onResponse(StructType invokeStructValue) { } - public void getTargets(GetTargetsResponseCallback callback, Integer daysToReturn, int timedInvokeTimeoutMs) { + public void getTargets(GetTargetsResponseCallback callback, int timedInvokeTimeoutMs) { final long commandId = 6L; ArrayList elements = new ArrayList<>(); - final long daysToReturnFieldID = 0L; - BaseTLVType daysToReturntlvValue = new UIntType(daysToReturn); - elements.add(new StructElement(daysToReturnFieldID, daysToReturntlvValue)); - StructType value = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - final long dayOfWeekforSequenceFieldID = 0L; - Integer dayOfWeekforSequence = null; - final long chargingTargetsFieldID = 1L; - ArrayList chargingTargets = null; + final long chargingTargetSchedulesFieldID = 0L; + ArrayList chargingTargetSchedules = null; for (StructElement element: invokeStructValue.value()) { - if (element.contextTagNum() == dayOfWeekforSequenceFieldID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - dayOfWeekforSequence = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == chargingTargetsFieldID) { + if (element.contextTagNum() == chargingTargetSchedulesFieldID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); - chargingTargets = castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue)); + chargingTargetSchedules = castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetScheduleStruct.decodeTlv(elementcastingValue)); } } } - callback.onSuccess(dayOfWeekforSequence, chargingTargets); + callback.onSuccess(chargingTargetSchedules); }}, commandId, value, timedInvokeTimeoutMs); } @@ -30014,7 +29997,7 @@ public void onResponse(StructType invokeStructValue) { } public interface GetTargetsResponseCallback extends BaseClusterCallback { - void onSuccess(Integer dayOfWeekforSequence, ArrayList chargingTargets); + void onSuccess(ArrayList chargingTargetSchedules); } public interface StateAttributeCallback extends BaseAttributeCallback { @@ -30386,56 +30369,6 @@ public void onSuccess(byte[] tlv) { }, RANDOMIZATION_DELAY_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readNumberOfWeeklyTargetsAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID, true); - } - - public void subscribeNumberOfWeeklyTargetsAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - } - }, NUMBER_OF_WEEKLY_TARGETS_ATTRIBUTE_ID, minInterval, maxInterval); - } - - public void readNumberOfDailyTargetsAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID, true); - } - - public void subscribeNumberOfDailyTargetsAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - } - }, NUMBER_OF_DAILY_TARGETS_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readNextChargeStartTimeAttribute( NextChargeStartTimeAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEXT_CHARGE_START_TIME_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 98bc3ca71303f5..2c8d1b63c311df 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7351,6 +7351,67 @@ public String toString() { return output.toString(); } } +public static class EnergyEvseClusterChargingTargetScheduleStruct { + public Optional dayOfWeekforSequence; + public Optional> chargingTargets; + private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; + private static final long CHARGING_TARGETS_ID = 1L; + + public EnergyEvseClusterChargingTargetScheduleStruct( + Optional dayOfWeekforSequence, + Optional> chargingTargets + ) { + this.dayOfWeekforSequence = dayOfWeekforSequence; + this.chargingTargets = chargingTargets; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); + values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional dayOfWeekforSequence = Optional.empty(); + Optional> chargingTargets = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + chargingTargets = Optional.of(castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue))); + } + } + } + return new EnergyEvseClusterChargingTargetScheduleStruct( + dayOfWeekforSequence, + chargingTargets + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); + output.append("\tdayOfWeekforSequence: "); + output.append(dayOfWeekforSequence); + output.append("\n"); + output.append("\tchargingTargets: "); + output.append(chargingTargets); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class EnergyPreferenceClusterBalanceStruct { public Integer step; public Optional label; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 2e712af09006a4..48a979486ad081 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -9561,8 +9561,6 @@ public enum Attribute { MaximumDischargeCurrent(8L), UserMaximumChargeCurrent(9L), RandomizationDelayWindow(10L), - NumberOfWeeklyTargets(33L), - NumberOfDailyTargets(34L), NextChargeStartTime(35L), NextChargeTargetTime(36L), NextChargeRequiredEnergy(37L), @@ -9685,7 +9683,7 @@ public static EnableDischargingCommandField value(int id) throws NoSuchFieldErro } throw new NoSuchFieldError(); } - }public enum SetTargetsCommandField {DayOfWeekforSequence(0),ChargingTargets(1),; + }public enum SetTargetsCommandField {ChargingTargetSchedules(0),; private final int id; SetTargetsCommandField(int id) { this.id = id; @@ -9702,23 +9700,6 @@ public static SetTargetsCommandField value(int id) throws NoSuchFieldError { } throw new NoSuchFieldError(); } - }public enum GetTargetsCommandField {DaysToReturn(0),; - private final int id; - GetTargetsCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static GetTargetsCommandField value(int id) throws NoSuchFieldError { - for (GetTargetsCommandField field : GetTargetsCommandField.values()) { - if (field.getID() == id) { - return field; - } - } - throw new NoSuchFieldError(); - } }@Override public String getAttributeName(long id) throws NoSuchFieldError { return Attribute.value(id).toString(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 94cda4091ba5dc..8d82536cd878a5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -10479,12 +10479,10 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(Integer dayOfWeekforSequence, ArrayList chargingTargets) { + public void onSuccess(ArrayList chargingTargetSchedules) { Map responseValues = new LinkedHashMap<>(); - CommandResponseInfo dayOfWeekforSequenceResponseValue = new CommandResponseInfo("dayOfWeekforSequence", "Integer"); - responseValues.put(dayOfWeekforSequenceResponseValue, dayOfWeekforSequence); - // chargingTargets: ChargingTargetStruct + // chargingTargetSchedules: ChargingTargetScheduleStruct // Conversion from this type to Java is not properly implemented yet callback.onSuccess(responseValues); @@ -23303,17 +23301,12 @@ public Map> getCommandMap() { Map energyEvsesetTargetsCommandParams = new LinkedHashMap(); - CommandParameterInfo energyEvsesetTargetsdayOfWeekforSequenceCommandParameterInfo = new CommandParameterInfo("dayOfWeekforSequence", Integer.class, Integer.class); - energyEvsesetTargetsCommandParams.put("dayOfWeekforSequence",energyEvsesetTargetsdayOfWeekforSequenceCommandParameterInfo); - InteractionInfo energyEvsesetTargetsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.EnergyEvseCluster) cluster) .setTargets((DefaultClusterCallback) callback - , (Integer) - commandArguments.get("dayOfWeekforSequence") - , (ArrayList) - commandArguments.get("chargingTargets"), 10000 + , (ArrayList) + commandArguments.get("chargingTargetSchedules"), 10000 ); }, () -> new DelegatedDefaultClusterCallback(), @@ -23322,16 +23315,10 @@ public Map> getCommandMap() { energyEvseClusterInteractionInfoMap.put("setTargets", energyEvsesetTargetsInteractionInfo); Map energyEvsegetTargetsCommandParams = new LinkedHashMap(); - - CommandParameterInfo energyEvsegetTargetsdaysToReturnCommandParameterInfo = new CommandParameterInfo("daysToReturn", Integer.class, Integer.class); - energyEvsegetTargetsCommandParams.put("daysToReturn",energyEvsegetTargetsdaysToReturnCommandParameterInfo); InteractionInfo energyEvsegetTargetsInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.EnergyEvseCluster) cluster) .getTargets((ChipClusters.EnergyEvseCluster.GetTargetsResponseCallback) callback - , (Integer) - commandArguments.get("daysToReturn") - , 10000); }, () -> new DelegatedEnergyEvseClusterGetTargetsResponseCallback(), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 16c71818bad11c..eb2711cd6fdde7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -9483,28 +9483,6 @@ private static Map readEnergyEvseInteractionInfo() { readEnergyEvseRandomizationDelayWindowCommandParams ); result.put("readRandomizationDelayWindowAttribute", readEnergyEvseRandomizationDelayWindowAttributeInteractionInfo); - Map readEnergyEvseNumberOfWeeklyTargetsCommandParams = new LinkedHashMap(); - InteractionInfo readEnergyEvseNumberOfWeeklyTargetsAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.EnergyEvseCluster) cluster).readNumberOfWeeklyTargetsAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readEnergyEvseNumberOfWeeklyTargetsCommandParams - ); - result.put("readNumberOfWeeklyTargetsAttribute", readEnergyEvseNumberOfWeeklyTargetsAttributeInteractionInfo); - Map readEnergyEvseNumberOfDailyTargetsCommandParams = new LinkedHashMap(); - InteractionInfo readEnergyEvseNumberOfDailyTargetsAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.EnergyEvseCluster) cluster).readNumberOfDailyTargetsAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readEnergyEvseNumberOfDailyTargetsCommandParams - ); - result.put("readNumberOfDailyTargetsAttribute", readEnergyEvseNumberOfDailyTargetsAttributeInteractionInfo); Map readEnergyEvseNextChargeStartTimeCommandParams = new LinkedHashMap(); InteractionInfo readEnergyEvseNextChargeStartTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { 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 41532a359802fa..701be9a7ebea52 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -56,6 +56,7 @@ structs_sources = [ "${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/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/EnergyPreferenceClusterBalanceStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt index c2a269e96018af..20363bff38ec5a 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt @@ -46,8 +46,7 @@ import matter.tlv.TlvWriter class EnergyEvseCluster(private val controller: MatterController, private val endpointId: UShort) { class GetTargetsResponse( - val dayOfWeekforSequence: UByte, - val chargingTargets: List + val chargingTargetSchedules: List ) class StateAttribute(val value: UByte?) @@ -345,8 +344,7 @@ class EnergyEvseCluster(private val controller: MatterController, private val en } suspend fun setTargets( - dayOfWeekforSequence: UByte, - chargingTargets: List, + chargingTargetSchedules: List, timedInvokeTimeout: Duration ) { val commandId: UInt = 5u @@ -354,12 +352,9 @@ class EnergyEvseCluster(private val controller: MatterController, private val en val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_DAY_OF_WEEKFOR_SEQUENCE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE_REQ), dayOfWeekforSequence) - - val TAG_CHARGING_TARGETS_REQ: Int = 1 - tlvWriter.startArray(ContextSpecificTag(TAG_CHARGING_TARGETS_REQ)) - for (item in chargingTargets.iterator()) { + val TAG_CHARGING_TARGET_SCHEDULES_REQ: Int = 0 + tlvWriter.startArray(ContextSpecificTag(TAG_CHARGING_TARGET_SCHEDULES_REQ)) + for (item in chargingTargetSchedules.iterator()) { item.toTlv(AnonymousTag, tlvWriter) } tlvWriter.endArray() @@ -376,14 +371,11 @@ class EnergyEvseCluster(private val controller: MatterController, private val en logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun getTargets(daysToReturn: UByte, timedInvokeTimeout: Duration): GetTargetsResponse { + suspend fun getTargets(timedInvokeTimeout: Duration): GetTargetsResponse { val commandId: UInt = 6u val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - - val TAG_DAYS_TO_RETURN_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_DAYS_TO_RETURN_REQ), daysToReturn) tlvWriter.endStructure() val request: InvokeRequest = @@ -398,25 +390,18 @@ class EnergyEvseCluster(private val controller: MatterController, private val en val tlvReader = TlvReader(response.payload) tlvReader.enterStructure(AnonymousTag) - val TAG_DAY_OF_WEEKFOR_SEQUENCE: Int = 0 - var dayOfWeekforSequence_decoded: UByte? = null - - val TAG_CHARGING_TARGETS: Int = 1 - var chargingTargets_decoded: List? = null + val TAG_CHARGING_TARGET_SCHEDULES: Int = 0 + var chargingTargetSchedules_decoded: List? = null while (!tlvReader.isEndOfContainer()) { val tag = tlvReader.peekElement().tag - if (tag == ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE)) { - dayOfWeekforSequence_decoded = tlvReader.getUByte(tag) - } - - if (tag == ContextSpecificTag(TAG_CHARGING_TARGETS)) { - chargingTargets_decoded = - buildList { + if (tag == ContextSpecificTag(TAG_CHARGING_TARGET_SCHEDULES)) { + chargingTargetSchedules_decoded = + buildList { tlvReader.enterArray(tag) while (!tlvReader.isEndOfContainer()) { - add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + add(EnergyEvseClusterChargingTargetScheduleStruct.fromTlv(AnonymousTag, tlvReader)) } tlvReader.exitContainer() } @@ -425,17 +410,13 @@ class EnergyEvseCluster(private val controller: MatterController, private val en } } - if (dayOfWeekforSequence_decoded == null) { - throw IllegalStateException("dayOfWeekforSequence not found in TLV") - } - - if (chargingTargets_decoded == null) { - throw IllegalStateException("chargingTargets not found in TLV") + if (chargingTargetSchedules_decoded == null) { + throw IllegalStateException("chargingTargetSchedules not found in TLV") } tlvReader.exitContainer() - return GetTargetsResponse(dayOfWeekforSequence_decoded, chargingTargets_decoded) + return GetTargetsResponse(chargingTargetSchedules_decoded) } suspend fun clearTargets(timedInvokeTimeout: Duration) { @@ -1523,192 +1504,6 @@ class EnergyEvseCluster(private val controller: MatterController, private val en } } - suspend fun readNumberOfWeeklyTargetsAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 33u - - 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) { "Numberofweeklytargets attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun subscribeNumberOfWeeklyTargetsAttribute( - minInterval: Int, - maxInterval: Int - ): Flow { - val ATTRIBUTE_ID: UInt = 33u - 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) { - "Numberofweeklytargets attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) - } - } - } - } - - suspend fun readNumberOfDailyTargetsAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 34u - - 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) { "Numberofdailytargets attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun subscribeNumberOfDailyTargetsAttribute( - minInterval: Int, - maxInterval: Int - ): Flow { - val ATTRIBUTE_ID: UInt = 34u - 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) { - "Numberofdailytargets attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getUByte(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(UByteSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(UByteSubscriptionState.SubscriptionEstablished) - } - } - } - } - suspend fun readNextChargeStartTimeAttribute(): NextChargeStartTimeAttribute { val ATTRIBUTE_ID: UInt = 35u 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 2ebed3b24f6c2c..7474e5ba2f1e8f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -56,6 +56,7 @@ matter_structs_sources = [ "${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/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/EnergyPreferenceClusterBalanceStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/FixedLabelClusterLabelStruct.kt", diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 58fb6a4bdd6646..fb6c29eead7d36 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -22811,38 +22811,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jnivalue, value); return value; } - case Attributes::NumberOfWeeklyTargets::Id: { - using TypeInfo = Attributes::NumberOfWeeklyTargets::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::NumberOfDailyTargets::Id: { - using TypeInfo = Attributes::NumberOfDailyTargets::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::NextChargeStartTime::Id: { using TypeInfo = Attributes::NextChargeStartTime::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 0611659ab41f0d..5bf21dd5f16bba 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3970,92 +3970,149 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( // Java callback is allowed to be null, exit early if this is the case. VerifyOrReturn(javaCallbackRef != nullptr); - err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;Ljava/util/ArrayList;)V", - &javaMethod); + err = JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/ArrayList;)V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); - jobject DayOfWeekforSequence; - std::string DayOfWeekforSequenceClassName = "java/lang/Integer"; - std::string DayOfWeekforSequenceCtorSignature = "(I)V"; - jint jniDayOfWeekforSequence = static_cast(dataResponse.dayOfWeekforSequence.Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject(DayOfWeekforSequenceClassName.c_str(), - DayOfWeekforSequenceCtorSignature.c_str(), jniDayOfWeekforSequence, - DayOfWeekforSequence); - jobject ChargingTargets; - chip::JniReferences::GetInstance().CreateArrayList(ChargingTargets); + jobject ChargingTargetSchedules; + chip::JniReferences::GetInstance().CreateArrayList(ChargingTargetSchedules); - auto iter_ChargingTargets_0 = dataResponse.chargingTargets.begin(); - while (iter_ChargingTargets_0.Next()) + auto iter_ChargingTargetSchedules_0 = dataResponse.chargingTargetSchedules.begin(); + while (iter_ChargingTargetSchedules_0.Next()) { - auto & entry_0 = iter_ChargingTargets_0.GetValue(); + auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_targetTimeMinutesPastMidnight; - std::string newElement_0_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; - std::string newElement_0_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; - jint jninewElement_0_targetTimeMinutesPastMidnight = static_cast(entry_0.targetTimeMinutesPastMidnight); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_targetTimeMinutesPastMidnightClassName.c_str(), - newElement_0_targetTimeMinutesPastMidnightCtorSignature.c_str(), - jninewElement_0_targetTimeMinutesPastMidnight, - newElement_0_targetTimeMinutesPastMidnight); - jobject newElement_0_targetSoC; - if (!entry_0.targetSoC.HasValue()) + jobject newElement_0_dayOfWeekforSequence; + if (!entry_0.dayOfWeekforSequence.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_targetSoC); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); } else { - jobject newElement_0_targetSoCInsideOptional; - std::string newElement_0_targetSoCInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_targetSoCInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_targetSoCInsideOptional = static_cast(entry_0.targetSoC.Value()); + jobject newElement_0_dayOfWeekforSequenceInsideOptional; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_targetSoCInsideOptionalClassName.c_str(), newElement_0_targetSoCInsideOptionalCtorSignature.c_str(), - jninewElement_0_targetSoCInsideOptional, newElement_0_targetSoCInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_targetSoCInsideOptional, newElement_0_targetSoC); + newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), + newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), + jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, + newElement_0_dayOfWeekforSequence); } - jobject newElement_0_addedEnergy; - if (!entry_0.addedEnergy.HasValue()) + jobject newElement_0_chargingTargets; + if (!entry_0.chargingTargets.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_addedEnergy); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_chargingTargets); } else { - jobject newElement_0_addedEnergyInsideOptional; - std::string newElement_0_addedEnergyInsideOptionalClassName = "java/lang/Long"; - std::string newElement_0_addedEnergyInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_0_addedEnergyInsideOptional = static_cast(entry_0.addedEnergy.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_addedEnergyInsideOptionalClassName.c_str(), - newElement_0_addedEnergyInsideOptionalCtorSignature.c_str(), - jninewElement_0_addedEnergyInsideOptional, - newElement_0_addedEnergyInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_addedEnergyInsideOptional, newElement_0_addedEnergy); + jobject newElement_0_chargingTargetsInsideOptional; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_chargingTargetsInsideOptional); + + auto iter_newElement_0_chargingTargetsInsideOptional_3 = entry_0.chargingTargets.Value().begin(); + while (iter_newElement_0_chargingTargetsInsideOptional_3.Next()) + { + auto & entry_3 = iter_newElement_0_chargingTargetsInsideOptional_3.GetValue(); + jobject newElement_3; + jobject newElement_3_targetTimeMinutesPastMidnight; + std::string newElement_3_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; + std::string newElement_3_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; + jint jninewElement_3_targetTimeMinutesPastMidnight = static_cast(entry_3.targetTimeMinutesPastMidnight); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_targetTimeMinutesPastMidnightClassName.c_str(), + newElement_3_targetTimeMinutesPastMidnightCtorSignature.c_str(), jninewElement_3_targetTimeMinutesPastMidnight, + newElement_3_targetTimeMinutesPastMidnight); + jobject newElement_3_targetSoC; + if (!entry_3.targetSoC.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_targetSoC); + } + else + { + jobject newElement_3_targetSoCInsideOptional; + std::string newElement_3_targetSoCInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_3_targetSoCInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_3_targetSoCInsideOptional = static_cast(entry_3.targetSoC.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_targetSoCInsideOptionalClassName.c_str(), + newElement_3_targetSoCInsideOptionalCtorSignature.c_str(), jninewElement_3_targetSoCInsideOptional, + newElement_3_targetSoCInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_targetSoCInsideOptional, newElement_3_targetSoC); + } + jobject newElement_3_addedEnergy; + if (!entry_3.addedEnergy.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_addedEnergy); + } + else + { + jobject newElement_3_addedEnergyInsideOptional; + std::string newElement_3_addedEnergyInsideOptionalClassName = "java/lang/Long"; + std::string newElement_3_addedEnergyInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_3_addedEnergyInsideOptional = static_cast(entry_3.addedEnergy.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_addedEnergyInsideOptionalClassName.c_str(), + newElement_3_addedEnergyInsideOptionalCtorSignature.c_str(), jninewElement_3_addedEnergyInsideOptional, + newElement_3_addedEnergyInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_3_addedEnergyInsideOptional, + newElement_3_addedEnergy); + } + + jclass chargingTargetStructStructClass_4; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", + chargingTargetStructStructClass_4); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); + return; + } + + jmethodID chargingTargetStructStructCtor_4; + err = chip::JniReferences::GetInstance().FindMethod( + env, chargingTargetStructStructClass_4, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", &chargingTargetStructStructCtor_4); + if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_4 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); + return; + } + + newElement_3 = + env->NewObject(chargingTargetStructStructClass_4, chargingTargetStructStructCtor_4, + newElement_3_targetTimeMinutesPastMidnight, newElement_3_targetSoC, newElement_3_addedEnergy); + chip::JniReferences::GetInstance().AddToList(newElement_0_chargingTargetsInsideOptional, newElement_3); + } + chip::JniReferences::GetInstance().CreateOptional(newElement_0_chargingTargetsInsideOptional, + newElement_0_chargingTargets); } - jclass chargingTargetStructStructClass_1; + jclass chargingTargetScheduleStructStructClass_1; err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", chargingTargetStructStructClass_1); + env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetScheduleStruct", + chargingTargetScheduleStructStructClass_1); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetScheduleStruct"); return; } - jmethodID chargingTargetStructStructCtor_1; - err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetStructStructClass_1, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", - &chargingTargetStructStructCtor_1); - if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_1 == nullptr) + jmethodID chargingTargetScheduleStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetScheduleStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;)V", + &chargingTargetScheduleStructStructCtor_1); + if (err != CHIP_NO_ERROR || chargingTargetScheduleStructStructCtor_1 == nullptr) { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); + ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetScheduleStruct constructor"); return; } - newElement_0 = env->NewObject(chargingTargetStructStructClass_1, chargingTargetStructStructCtor_1, - newElement_0_targetTimeMinutesPastMidnight, newElement_0_targetSoC, newElement_0_addedEnergy); - chip::JniReferences::GetInstance().AddToList(ChargingTargets, newElement_0); + newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, + newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); + chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } - env->CallVoidMethod(javaCallbackRef, javaMethod, DayOfWeekforSequence, ChargingTargets); + env->CallVoidMethod(javaCallbackRef, javaMethod, ChargingTargetSchedules); } CHIPDoorLockClusterGetWeekDayScheduleResponseCallback::CHIPDoorLockClusterGetWeekDayScheduleResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 7954593df97171..33f0a722a13d97 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -6749,15 +6749,13 @@ class ChipClusters: "commandId": 0x00000005, "commandName": "SetTargets", "args": { - "dayOfWeekforSequence": "int", - "chargingTargets": "ChargingTargetStruct", + "chargingTargetSchedules": "ChargingTargetScheduleStruct", }, }, 0x00000006: { "commandId": 0x00000006, "commandName": "GetTargets", "args": { - "daysToReturn": "int", }, }, 0x00000007: { @@ -6836,18 +6834,6 @@ class ChipClusters: "reportable": True, "writable": True, }, - 0x00000021: { - "attributeName": "NumberOfWeeklyTargets", - "attributeId": 0x00000021, - "type": "int", - "reportable": True, - }, - 0x00000022: { - "attributeName": "NumberOfDailyTargets", - "attributeId": 0x00000022, - "type": "int", - "reportable": True, - }, 0x00000023: { "attributeName": "NextChargeStartTime", "attributeId": 0x00000023, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index ecc9b63039e8bc..622fc30523abf3 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -23913,8 +23913,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="maximumDischargeCurrent", Tag=0x00000008, Type=typing.Optional[int]), ClusterObjectFieldDescriptor(Label="userMaximumChargeCurrent", Tag=0x00000009, Type=typing.Optional[int]), ClusterObjectFieldDescriptor(Label="randomizationDelayWindow", Tag=0x0000000A, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="numberOfWeeklyTargets", Tag=0x00000021, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="numberOfDailyTargets", Tag=0x00000022, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="nextChargeStartTime", Tag=0x00000023, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="nextChargeTargetTime", Tag=0x00000024, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="nextChargeRequiredEnergy", Tag=0x00000025, Type=typing.Union[None, Nullable, int]), @@ -23946,8 +23944,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: maximumDischargeCurrent: 'typing.Optional[int]' = None userMaximumChargeCurrent: 'typing.Optional[int]' = None randomizationDelayWindow: 'typing.Optional[uint]' = None - numberOfWeeklyTargets: 'typing.Optional[uint]' = None - numberOfDailyTargets: 'typing.Optional[uint]' = None nextChargeStartTime: 'typing.Union[None, Nullable, uint]' = None nextChargeTargetTime: 'typing.Union[None, Nullable, uint]' = None nextChargeRequiredEnergy: 'typing.Union[None, Nullable, int]' = None @@ -24061,6 +24057,19 @@ def descriptor(cls) -> ClusterObjectDescriptor: targetSoC: 'typing.Optional[uint]' = None addedEnergy: 'typing.Optional[int]' = None + @dataclass + class ChargingTargetScheduleStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), + ]) + + dayOfWeekforSequence: 'typing.Optional[uint]' = None + chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None + class Commands: @dataclass class GetTargetsResponse(ClusterCommand): @@ -24073,12 +24082,10 @@ class GetTargetsResponse(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.List[EnergyEvse.Structs.ChargingTargetStruct]), + ClusterObjectFieldDescriptor(Label="chargingTargetSchedules", Tag=0, Type=typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]), ]) - dayOfWeekforSequence: 'uint' = 0 - chargingTargets: 'typing.List[EnergyEvse.Structs.ChargingTargetStruct]' = field(default_factory=lambda: []) + chargingTargetSchedules: 'typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]' = field(default_factory=lambda: []) @dataclass class Disable(ClusterCommand): @@ -24171,16 +24178,14 @@ class SetTargets(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.List[EnergyEvse.Structs.ChargingTargetStruct]), + ClusterObjectFieldDescriptor(Label="chargingTargetSchedules", Tag=0, Type=typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]), ]) @ChipUtility.classproperty def must_use_timed_invoke(cls) -> bool: return True - dayOfWeekforSequence: 'uint' = 0 - chargingTargets: 'typing.List[EnergyEvse.Structs.ChargingTargetStruct]' = field(default_factory=lambda: []) + chargingTargetSchedules: 'typing.List[EnergyEvse.Structs.ChargingTargetScheduleStruct]' = field(default_factory=lambda: []) @dataclass class GetTargets(ClusterCommand): @@ -24193,15 +24198,12 @@ class GetTargets(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="daysToReturn", Tag=0, Type=uint), ]) @ChipUtility.classproperty def must_use_timed_invoke(cls) -> bool: return True - daysToReturn: 'uint' = 0 - @dataclass class ClearTargets(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000099 @@ -24396,38 +24398,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[uint]' = None - @dataclass - class NumberOfWeeklyTargets(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000099 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000021 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - - value: 'typing.Optional[uint]' = None - - @dataclass - class NumberOfDailyTargets(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000099 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000022 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - - value: 'typing.Optional[uint]' = None - @dataclass class NextChargeStartTime(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index b8c6f1a59ac4bb..24bc13b1a4698a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -3111,12 +3111,6 @@ static BOOL AttributeIsSpecifiedInEnergyEVSECluster(AttributeId aAttributeId) case Attributes::RandomizationDelayWindow::Id: { return YES; } - case Attributes::NumberOfWeeklyTargets::Id: { - return YES; - } - case Attributes::NumberOfDailyTargets::Id: { - return YES; - } case Attributes::NextChargeStartTime::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 20633dafe53b0c..5825f1d904acbb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -8620,28 +8620,6 @@ static id _Nullable DecodeAttributeValueForEnergyEVSECluster(AttributeId aAttrib value = [NSNumber numberWithUnsignedInt:cppValue]; return value; } - case Attributes::NumberOfWeeklyTargets::Id: { - using TypeInfo = Attributes::NumberOfWeeklyTargets::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::NumberOfDailyTargets::Id: { - using TypeInfo = Attributes::NumberOfDailyTargets::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::NextChargeStartTime::Id: { using TypeInfo = Attributes::NextChargeStartTime::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 7271543d1242db..ba967eb9bb5009 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -7702,7 +7702,9 @@ MTR_PROVISIONALLY_AVAILABLE * * Allows a client to retrieve the user specified charging targets. */ -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithCompletion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion + MTR_PROVISIONALLY_AVAILABLE; /** * Command ClearTargets * @@ -7782,18 +7784,6 @@ MTR_PROVISIONALLY_AVAILABLE reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeRandomizationDelayWindowWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeNumberOfWeeklyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeNumberOfWeeklyTargetsWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeNumberOfWeeklyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - -- (void)readAttributeNumberOfDailyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeNumberOfDailyTargetsWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeNumberOfDailyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeNextChargeStartTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeNextChargeStartTimeWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index c91da32da25ad3..2614e0ef5d9090 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -52332,7 +52332,11 @@ - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params comp queue:self.callbackQueue completion:responseHandler]; } -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)getTargetsWithCompletion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self getTargetsWithParams:nil completion:completion]; +} +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { params = [[MTREnergyEVSEClusterGetTargetsParams @@ -52843,78 +52847,6 @@ + (void)readAttributeRandomizationDelayWindowWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeNumberOfWeeklyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfWeeklyTargets::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeNumberOfWeeklyTargetsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfWeeklyTargets::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeNumberOfWeeklyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfWeeklyTargets::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - -- (void)readAttributeNumberOfDailyTargetsWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfDailyTargets::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeNumberOfDailyTargetsWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfDailyTargets::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeNumberOfDailyTargetsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = EnergyEvse::Attributes::NumberOfDailyTargets::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - - (void)readAttributeNextChargeStartTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = EnergyEvse::Attributes::NextChargeStartTime::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 7c46f6315692cb..159a0f0a14b267 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -2669,8 +2669,6 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterEnergyEVSEAttributeMaximumDischargeCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, MTRAttributeIDTypeClusterEnergyEVSEAttributeUserMaximumChargeCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, MTRAttributeIDTypeClusterEnergyEVSEAttributeRandomizationDelayWindowID MTR_PROVISIONALLY_AVAILABLE = 0x0000000A, - MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfWeeklyTargetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000021, - MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfDailyTargetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000022, MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeStartTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000023, MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeTargetTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000024, MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeRequiredEnergyID MTR_PROVISIONALLY_AVAILABLE = 0x00000025, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 605c522bb489c1..a4900af82bb2fa 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3632,7 +3632,9 @@ MTR_PROVISIONALLY_AVAILABLE - (void)startDiagnosticsWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)getTargetsWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion + MTR_PROVISIONALLY_AVAILABLE; - (void)clearTargetsWithParams:(MTREnergyEVSEClusterClearTargetsParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)clearTargetsWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; @@ -3663,10 +3665,6 @@ MTR_PROVISIONALLY_AVAILABLE - (void)writeAttributeRandomizationDelayWindowWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeRandomizationDelayWindowWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeNumberOfWeeklyTargetsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - -- (NSDictionary * _Nullable)readAttributeNumberOfDailyTargetsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeNextChargeStartTimeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeNextChargeTargetTimeWithParams:(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 ae9159d82900a2..2976a21948aa6c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -9997,7 +9997,11 @@ - (void)setTargetsWithParams:(MTREnergyEVSEClusterSetTargetsParams *)params expe completion:responseHandler]; } -- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +- (void)getTargetsWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + [self getTargetsWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; +} +- (void)getTargetsWithParams:(MTREnergyEVSEClusterGetTargetsParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { params = [[MTREnergyEVSEClusterGetTargetsParams @@ -10138,16 +10142,6 @@ - (void)writeAttributeRandomizationDelayWindowWithValue:(NSDictionary * _Nullable)readAttributeNumberOfWeeklyTargetsWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeEnergyEVSEID) attributeID:@(MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfWeeklyTargetsID) params:params]; -} - -- (NSDictionary * _Nullable)readAttributeNumberOfDailyTargetsWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeEnergyEVSEID) attributeID:@(MTRAttributeIDTypeClusterEnergyEVSEAttributeNumberOfDailyTargetsID) params:params]; -} - - (NSDictionary * _Nullable)readAttributeNextChargeStartTimeWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeEnergyEVSEID) attributeID:@(MTRAttributeIDTypeClusterEnergyEVSEAttributeNextChargeStartTimeID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 5f90f0d869be60..a98329f02b5a38 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -6078,9 +6078,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterGetTargetsResponseParams : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; - -@property (nonatomic, copy) NSArray * _Nonnull chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull chargingTargetSchedules MTR_PROVISIONALLY_AVAILABLE; /** * Initialize an MTREnergyEVSEClusterGetTargetsResponseParams with a response-value dictionary @@ -6221,9 +6219,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterSetTargetsParams : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; - -@property (nonatomic, copy) NSArray * _Nonnull chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull chargingTargetSchedules MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * @@ -6252,8 +6248,6 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterGetTargetsParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull daysToReturn MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 4090cfe1b4ed09..6994220b206bfd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16835,9 +16835,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = @(0); - - _chargingTargets = [NSArray array]; + _chargingTargetSchedules = [NSArray array]; } return self; } @@ -16846,15 +16844,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTREnergyEVSEClusterGetTargetsResponseParams alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; - other.chargingTargets = self.chargingTargets; + other.chargingTargetSchedules = self.chargingTargetSchedules; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: chargingTargetSchedules:%@; >", NSStringFromClass([self class]), _chargingTargetSchedules]; return descriptionString; } @@ -16904,27 +16901,48 @@ @implementation MTREnergyEVSEClusterGetTargetsResponseParams (InternalMethods) - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEvse::Commands::GetTargetsResponse::DecodableType &)decodableStruct { - { - self.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:decodableStruct.dayOfWeekforSequence.Raw()]; - } { { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; - auto iter_0 = decodableStruct.chargingTargets.begin(); + auto iter_0 = decodableStruct.chargingTargetSchedules.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTREnergyEVSEClusterChargingTargetStruct * newElement_0; - newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight]; - if (entry_0.targetSoC.HasValue()) { - newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()]; + MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; + newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.targetSoC = nil; + newElement_0.dayOfWeekforSequence = nil; } - if (entry_0.addedEnergy.HasValue()) { - newElement_0.addedEnergy = [NSNumber numberWithLongLong:entry_0.addedEnergy.Value()]; + if (entry_0.chargingTargets.HasValue()) { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_0.chargingTargets.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + MTREnergyEVSEClusterChargingTargetStruct * newElement_3; + newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; + if (entry_3.targetSoC.HasValue()) { + newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; + } else { + newElement_3.targetSoC = nil; + } + if (entry_3.addedEnergy.HasValue()) { + newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; + } else { + newElement_3.addedEnergy = nil; + } + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + return err; + } + newElement_0.chargingTargets = array_3; + } } else { - newElement_0.addedEnergy = nil; + newElement_0.chargingTargets = nil; } [array_0 addObject:newElement_0]; } @@ -16932,7 +16950,7 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv if (err != CHIP_NO_ERROR) { return err; } - self.chargingTargets = array_0; + self.chargingTargetSchedules = array_0; } } return CHIP_NO_ERROR; @@ -17277,9 +17295,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = @(0); - - _chargingTargets = [NSArray array]; + _chargingTargetSchedules = [NSArray array]; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -17290,8 +17306,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTREnergyEVSEClusterSetTargetsParams alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; - other.chargingTargets = self.chargingTargets; + other.chargingTargetSchedules = self.chargingTargetSchedules; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -17300,7 +17315,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: chargingTargetSchedules:%@; >", NSStringFromClass([self class]), _chargingTargetSchedules]; return descriptionString; } @@ -17312,38 +17327,63 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { chip::app::Clusters::EnergyEvse::Commands::SetTargets::Type encodableStruct; ListFreer listFreer; - { - encodableStruct.dayOfWeekforSequence = static_cast>(self.dayOfWeekforSequence.unsignedCharValue); - } { { - using ListType_0 = std::remove_reference_t; + using ListType_0 = std::remove_reference_t; using ListMemberType_0 = ListMemberTypeGetter::Type; - if (self.chargingTargets.count != 0) { - auto * listHolder_0 = new ListHolder(self.chargingTargets.count); + if (self.chargingTargetSchedules.count != 0) { + auto * listHolder_0 = new ListHolder(self.chargingTargetSchedules.count); if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { return CHIP_ERROR_INVALID_ARGUMENT; } listFreer.add(listHolder_0); - for (size_t i_0 = 0; i_0 < self.chargingTargets.count; ++i_0) { - if (![self.chargingTargets[i_0] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { + for (size_t i_0 = 0; i_0 < self.chargingTargetSchedules.count; ++i_0) { + if (![self.chargingTargetSchedules[i_0] isKindOfClass:[MTREnergyEVSEClusterChargingTargetScheduleStruct class]]) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_0 = (MTREnergyEVSEClusterChargingTargetStruct *) self.chargingTargets[i_0]; - listHolder_0->mList[i_0].targetTimeMinutesPastMidnight = element_0.targetTimeMinutesPastMidnight.unsignedShortValue; - if (element_0.targetSoC != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].targetSoC.Emplace(); - definedValue_2 = element_0.targetSoC.unsignedCharValue; + auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; + if (element_0.dayOfWeekforSequence != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); + definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); } - if (element_0.addedEnergy != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].addedEnergy.Emplace(); - definedValue_2 = element_0.addedEnergy.longLongValue; + if (element_0.chargingTargets != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); + { + using ListType_3 = std::remove_reference_t; + using ListMemberType_3 = ListMemberTypeGetter::Type; + if (element_0.chargingTargets.count != 0) { + auto * listHolder_3 = new ListHolder(element_0.chargingTargets.count); + if (listHolder_3 == nullptr || listHolder_3->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_3); + for (size_t i_3 = 0; i_3 < element_0.chargingTargets.count; ++i_3) { + if (![element_0.chargingTargets[i_3] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_3 = (MTREnergyEVSEClusterChargingTargetStruct *) element_0.chargingTargets[i_3]; + listHolder_3->mList[i_3].targetTimeMinutesPastMidnight = element_3.targetTimeMinutesPastMidnight.unsignedShortValue; + if (element_3.targetSoC != nil) { + auto & definedValue_5 = listHolder_3->mList[i_3].targetSoC.Emplace(); + definedValue_5 = element_3.targetSoC.unsignedCharValue; + } + if (element_3.addedEnergy != nil) { + auto & definedValue_5 = listHolder_3->mList[i_3].addedEnergy.Emplace(); + definedValue_5 = element_3.addedEnergy.longLongValue; + } + } + definedValue_2 = ListType_3(listHolder_3->mList, element_0.chargingTargets.count); + } else { + definedValue_2 = ListType_3(); + } + } } } - encodableStruct.chargingTargets = ListType_0(listHolder_0->mList, self.chargingTargets.count); + encodableStruct.chargingTargetSchedules = ListType_0(listHolder_0->mList, self.chargingTargetSchedules.count); } else { - encodableStruct.chargingTargets = ListType_0(); + encodableStruct.chargingTargetSchedules = ListType_0(); } } } @@ -17390,8 +17430,6 @@ @implementation MTREnergyEVSEClusterGetTargetsParams - (instancetype)init { if (self = [super init]) { - - _daysToReturn = @(0); _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -17402,7 +17440,6 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTREnergyEVSEClusterGetTargetsParams alloc] init]; - other.daysToReturn = self.daysToReturn; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -17411,7 +17448,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: daysToReturn:%@; >", NSStringFromClass([self class]), _daysToReturn]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; return descriptionString; } @@ -17423,9 +17460,6 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { chip::app::Clusters::EnergyEvse::Commands::GetTargets::Type encodableStruct; ListFreer listFreer; - { - encodableStruct.daysToReturn = static_cast>(self.daysToReturn.unsignedCharValue); - } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); if (buffer.IsNull()) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index c952dc3da5faa2..1d155ecd860e9c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1285,6 +1285,12 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable addedEnergy MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterEVConnectedEvent : NSObject @property (nonatomic, copy) NSNumber * _Nonnull sessionID MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 9324a04d612704..817b54dd8ad33c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5261,6 +5261,36 @@ - (NSString *)description @end +@implementation MTREnergyEVSEClusterChargingTargetScheduleStruct +- (instancetype)init +{ + if (self = [super init]) { + + _dayOfWeekforSequence = nil; + + _chargingTargets = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; + + other.dayOfWeekforSequence = self.dayOfWeekforSequence; + other.chargingTargets = self.chargingTargets; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + return descriptionString; +} + +@end + @implementation MTREnergyEVSEClusterEVConnectedEvent - (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 ee8e52fb08d776..7aa3b7083e4241 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 @@ -11093,68 +11093,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { - -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace NumberOfWeeklyTargets - -namespace NumberOfDailyTargets { - -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::EnergyEvse::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - *value = Traits::StorageToWorking(temp); - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::EnergyEvse::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); -} - -} // namespace NumberOfDailyTargets - namespace NextChargeStartTime { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) 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 e9969a14e8ed00..e85f61f4be3882 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 @@ -2135,16 +2135,6 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // elapsed_s EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); -} // namespace NumberOfWeeklyTargets - -namespace NumberOfDailyTargets { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); -} // namespace NumberOfDailyTargets - namespace NextChargeStartTime { EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); 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 834f1faa123612..9e5a7b34497209 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 @@ -15857,10 +15857,8 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace ChargingTargetStruct -} // namespace Structs -namespace Commands { -namespace GetTargetsResponse { +namespace ChargingTargetScheduleStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; @@ -15898,6 +15896,44 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } + +} // namespace ChargingTargetScheduleStruct +} // namespace Structs + +namespace Commands { +namespace GetTargetsResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kChargingTargetSchedules), chargingTargetSchedules); + 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::kChargingTargetSchedules)) + { + err = DataModel::Decode(reader, chargingTargetSchedules); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} } // namespace GetTargetsResponse. namespace Disable { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const @@ -16026,8 +16062,7 @@ namespace SetTargets { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kDayOfWeekforSequence), dayOfWeekforSequence); - encoder.Encode(to_underlying(Fields::kChargingTargets), chargingTargets); + encoder.Encode(to_underlying(Fields::kChargingTargetSchedules), chargingTargetSchedules); return encoder.Finalize(); } @@ -16045,13 +16080,9 @@ 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::kDayOfWeekforSequence)) + if (__context_tag == to_underlying(Fields::kChargingTargetSchedules)) { - err = DataModel::Decode(reader, dayOfWeekforSequence); - } - else if (__context_tag == to_underlying(Fields::kChargingTargets)) - { - err = DataModel::Decode(reader, chargingTargets); + err = DataModel::Decode(reader, chargingTargetSchedules); } else { @@ -16065,7 +16096,6 @@ namespace GetTargets { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kDaysToReturn), daysToReturn); return encoder.Finalize(); } @@ -16079,19 +16109,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } - - CHIP_ERROR err = CHIP_NO_ERROR; - const uint8_t __context_tag = std::get(__element); - - if (__context_tag == to_underlying(Fields::kDaysToReturn)) - { - err = DataModel::Decode(reader, daysToReturn); - } - else - { - } - - ReturnErrorOnFailure(err); } } } // namespace GetTargets. @@ -16144,10 +16161,6 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, userMaximumChargeCurrent); case Attributes::RandomizationDelayWindow::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, randomizationDelayWindow); - case Attributes::NumberOfWeeklyTargets::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, numberOfWeeklyTargets); - case Attributes::NumberOfDailyTargets::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, numberOfDailyTargets); case Attributes::NextChargeStartTime::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, nextChargeStartTime); case Attributes::NextChargeTargetTime::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 c4fc5f675fae30..cad9c6d003855e 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 @@ -22004,6 +22004,36 @@ struct Type using DecodableType = Type; } // namespace ChargingTargetStruct +namespace ChargingTargetScheduleStruct { +enum class Fields : uint8_t +{ + kDayOfWeekforSequence = 0, + kChargingTargets = 1, +}; + +struct Type +{ +public: + Optional> dayOfWeekforSequence; + Optional> chargingTargets; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + Optional> dayOfWeekforSequence; + Optional> chargingTargets; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace ChargingTargetScheduleStruct } // namespace Structs namespace Commands { @@ -22055,8 +22085,7 @@ namespace Commands { namespace GetTargetsResponse { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, - kChargingTargets = 1, + kChargingTargetSchedules = 0, }; struct Type @@ -22066,8 +22095,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetTargetsResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::List chargingTargets; + DataModel::List chargingTargetSchedules; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -22082,8 +22110,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetTargetsResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::DecodableList chargingTargets; + DataModel::DecodableList chargingTargetSchedules; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetTargetsResponse @@ -22219,8 +22246,7 @@ struct DecodableType namespace SetTargets { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, - kChargingTargets = 1, + kChargingTargetSchedules = 0, }; struct Type @@ -22230,8 +22256,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::SetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::List chargingTargets; + DataModel::List chargingTargetSchedules; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -22246,15 +22271,13 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::SetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask dayOfWeekforSequence = static_cast>(0); - DataModel::DecodableList chargingTargets; + DataModel::DecodableList chargingTargetSchedules; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetTargets namespace GetTargets { enum class Fields : uint8_t { - kDaysToReturn = 0, }; struct Type @@ -22264,8 +22287,6 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask daysToReturn = static_cast>(0); - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; using ResponseType = Clusters::EnergyEvse::Commands::GetTargetsResponse::DecodableType; @@ -22279,7 +22300,6 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetTargets::Id; } static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - chip::BitMask daysToReturn = static_cast>(0); CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetTargets @@ -22447,30 +22467,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { -struct TypeInfo -{ - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; - - static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfWeeklyTargets::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace NumberOfWeeklyTargets -namespace NumberOfDailyTargets { -struct TypeInfo -{ - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; - - static constexpr ClusterId GetClusterId() { return Clusters::EnergyEvse::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfDailyTargets::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace NumberOfDailyTargets namespace NextChargeStartTime { struct TypeInfo { @@ -22674,8 +22670,6 @@ struct TypeInfo Attributes::MaximumDischargeCurrent::TypeInfo::DecodableType maximumDischargeCurrent = static_cast(0); Attributes::UserMaximumChargeCurrent::TypeInfo::DecodableType userMaximumChargeCurrent = static_cast(0); Attributes::RandomizationDelayWindow::TypeInfo::DecodableType randomizationDelayWindow = static_cast(0); - Attributes::NumberOfWeeklyTargets::TypeInfo::DecodableType numberOfWeeklyTargets = static_cast(0); - Attributes::NumberOfDailyTargets::TypeInfo::DecodableType numberOfDailyTargets = static_cast(0); Attributes::NextChargeStartTime::TypeInfo::DecodableType nextChargeStartTime; Attributes::NextChargeTargetTime::TypeInfo::DecodableType nextChargeTargetTime; Attributes::NextChargeRequiredEnergy::TypeInfo::DecodableType nextChargeRequiredEnergy; 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 4038c9c9c41723..10c5cc365f632f 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 @@ -3870,14 +3870,6 @@ namespace RandomizationDelayWindow { static constexpr AttributeId Id = 0x0000000A; } // namespace RandomizationDelayWindow -namespace NumberOfWeeklyTargets { -static constexpr AttributeId Id = 0x00000021; -} // namespace NumberOfWeeklyTargets - -namespace NumberOfDailyTargets { -static constexpr AttributeId Id = 0x00000022; -} // namespace NumberOfDailyTargets - namespace NextChargeStartTime { static constexpr AttributeId Id = 0x00000023; } // namespace NextChargeStartTime diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index a7645ac8f0c77f..9a522434590c2b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -7172,8 +7172,6 @@ class DeviceEnergyManagementRequestConstraintBasedForecast : public ClusterComma | * MaximumDischargeCurrent | 0x0008 | | * UserMaximumChargeCurrent | 0x0009 | | * RandomizationDelayWindow | 0x000A | -| * NumberOfWeeklyTargets | 0x0021 | -| * NumberOfDailyTargets | 0x0022 | | * NextChargeStartTime | 0x0023 | | * NextChargeTargetTime | 0x0024 | | * NextChargeRequiredEnergy | 0x0025 | @@ -7360,10 +7358,9 @@ class EnergyEvseSetTargets : public ClusterCommand { public: EnergyEvseSetTargets(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-targets", credsIssuerConfig), mComplex_ChargingTargets(&mRequest.chargingTargets) + ClusterCommand("set-targets", credsIssuerConfig), mComplex_ChargingTargetSchedules(&mRequest.chargingTargetSchedules) { - AddArgument("DayOfWeekforSequence", 0, UINT8_MAX, &mRequest.dayOfWeekforSequence); - AddArgument("ChargingTargets", &mComplex_ChargingTargets); + AddArgument("ChargingTargetSchedules", &mComplex_ChargingTargetSchedules); ClusterCommand::AddArguments(); } @@ -7390,8 +7387,9 @@ class EnergyEvseSetTargets : public ClusterCommand private: chip::app::Clusters::EnergyEvse::Commands::SetTargets::Type mRequest; - TypedComplexArgument> - mComplex_ChargingTargets; + TypedComplexArgument< + chip::app::DataModel::List> + mComplex_ChargingTargetSchedules; }; /* @@ -7402,7 +7400,6 @@ class EnergyEvseGetTargets : public ClusterCommand public: EnergyEvseGetTargets(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("get-targets", credsIssuerConfig) { - AddArgument("DaysToReturn", 0, UINT8_MAX, &mRequest.daysToReturn); ClusterCommand::AddArguments(); } @@ -19906,11 +19903,9 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "user-maximum-charge-current", Attributes::UserMaximumChargeCurrent::Id, credsIssuerConfig), // make_unique(Id, "randomization-delay-window", Attributes::RandomizationDelayWindow::Id, - credsIssuerConfig), // - make_unique(Id, "number-of-weekly-targets", Attributes::NumberOfWeeklyTargets::Id, credsIssuerConfig), // - make_unique(Id, "number-of-daily-targets", Attributes::NumberOfDailyTargets::Id, credsIssuerConfig), // - make_unique(Id, "next-charge-start-time", Attributes::NextChargeStartTime::Id, credsIssuerConfig), // - make_unique(Id, "next-charge-target-time", Attributes::NextChargeTargetTime::Id, credsIssuerConfig), // + credsIssuerConfig), // + make_unique(Id, "next-charge-start-time", Attributes::NextChargeStartTime::Id, credsIssuerConfig), // + make_unique(Id, "next-charge-target-time", Attributes::NextChargeTargetTime::Id, credsIssuerConfig), // make_unique(Id, "next-charge-required-energy", Attributes::NextChargeRequiredEnergy::Id, credsIssuerConfig), // make_unique(Id, "next-charge-target-so-c", Attributes::NextChargeTargetSoC::Id, credsIssuerConfig), // @@ -19958,10 +19953,6 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique>(Id, "randomization-delay-window", 0, UINT32_MAX, Attributes::RandomizationDelayWindow::Id, WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>(Id, "number-of-weekly-targets", 0, UINT8_MAX, Attributes::NumberOfWeeklyTargets::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "number-of-daily-targets", 0, UINT8_MAX, Attributes::NumberOfDailyTargets::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>(Id, "next-charge-start-time", 0, UINT32_MAX, Attributes::NextChargeStartTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -20024,10 +20015,7 @@ void registerClusterEnergyEvse(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "user-maximum-charge-current", Attributes::UserMaximumChargeCurrent::Id, credsIssuerConfig), // make_unique(Id, "randomization-delay-window", Attributes::RandomizationDelayWindow::Id, - credsIssuerConfig), // - make_unique(Id, "number-of-weekly-targets", Attributes::NumberOfWeeklyTargets::Id, credsIssuerConfig), // - make_unique(Id, "number-of-daily-targets", Attributes::NumberOfDailyTargets::Id, credsIssuerConfig), // make_unique(Id, "next-charge-start-time", Attributes::NextChargeStartTime::Id, credsIssuerConfig), // make_unique(Id, "next-charge-target-time", Attributes::NextChargeTargetTime::Id, credsIssuerConfig), // make_unique(Id, "next-charge-required-energy", Attributes::NextChargeRequiredEnergy::Id, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index acbd349dc09dfc..ea06951314b7dd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3249,6 +3249,40 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::C ComplexArgumentParser::Finalize(request.addedEnergy); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + char labelWithMember[kMaxLabelLength]; + if (value.isMember("dayOfWeekforSequence")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); + } + valueCopy.removeMember("dayOfWeekforSequence"); + + if (value.isMember("chargingTargets")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "chargingTargets"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.chargingTargets, value["chargingTargets"])); + } + valueCopy.removeMember("chargingTargets"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); + ComplexArgumentParser::Finalize(request.chargingTargets); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 445524c97f85e4..a97d35e2ac7f0b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -378,6 +378,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyEvse::Str static void Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 2da87471d0a3c0..446d77b0aee60f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -2890,6 +2890,32 @@ 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::EnergyEvse::Structs::ChargingTargetScheduleStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("DayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekforSequence'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("ChargingTargets", indent + 1, value.chargingTargets); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ChargingTargets'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::DecodableType & value) { @@ -6964,8 +6990,7 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const EnergyEvse::Commands::GetTargetsResponse::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); - ReturnErrorOnFailure(DataModelLogger::LogValue("dayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence)); - ReturnErrorOnFailure(DataModelLogger::LogValue("chargingTargets", indent + 1, value.chargingTargets)); + ReturnErrorOnFailure(DataModelLogger::LogValue("chargingTargetSchedules", indent + 1, value.chargingTargetSchedules)); DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } @@ -12062,16 +12087,6 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("RandomizationDelayWindow", 1, value); } - case EnergyEvse::Attributes::NumberOfWeeklyTargets::Id: { - uint8_t value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("NumberOfWeeklyTargets", 1, value); - } - case EnergyEvse::Attributes::NumberOfDailyTargets::Id: { - uint8_t value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("NumberOfDailyTargets", 1, value); - } case EnergyEvse::Attributes::NextChargeStartTime::Id: { chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); 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 2880226ecb9d14..89b8e51c0d0799 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -238,6 +238,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyEvse::Structs::ChargingTargetStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::EnergyPreference::Structs::BalanceStruct::DecodableType & value); 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 8b7c3cfbf53724..6e4ec40955e85b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80633,8 +80633,6 @@ class SubscribeAttributeDeviceEnergyManagementClusterRevision : public Subscribe | * MaximumDischargeCurrent | 0x0008 | | * UserMaximumChargeCurrent | 0x0009 | | * RandomizationDelayWindow | 0x000A | -| * NumberOfWeeklyTargets | 0x0021 | -| * NumberOfDailyTargets | 0x0022 | | * NextChargeStartTime | 0x0023 | | * NextChargeTargetTime | 0x0024 | | * NextChargeRequiredEnergy | 0x0025 | @@ -80895,13 +80893,10 @@ class EnergyEvseSetTargets : public ClusterCommand { public: EnergyEvseSetTargets() : ClusterCommand("set-targets") - , mComplex_ChargingTargets(&mRequest.chargingTargets) + , mComplex_ChargingTargetSchedules(&mRequest.chargingTargetSchedules) { #if MTR_ENABLE_PROVISIONAL - AddArgument("DayOfWeekforSequence", 0, UINT8_MAX, &mRequest.dayOfWeekforSequence); -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - AddArgument("ChargingTargets", &mComplex_ChargingTargets); + AddArgument("ChargingTargetSchedules", &mComplex_ChargingTargetSchedules); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -80917,29 +80912,44 @@ class EnergyEvseSetTargets : public ClusterCommand { __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterSetTargetsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:mRequest.dayOfWeekforSequence.Raw()]; -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.chargingTargets) { - MTREnergyEVSEClusterChargingTargetStruct * newElement_0; - newElement_0 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_0.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_0.targetTimeMinutesPastMidnight]; - if (entry_0.targetSoC.HasValue()) { - newElement_0.targetSoC = [NSNumber numberWithUnsignedChar:entry_0.targetSoC.Value()]; + for (auto & entry_0 : mRequest.chargingTargetSchedules) { + MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; + newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.targetSoC = nil; + newElement_0.dayOfWeekforSequence = nil; } - if (entry_0.addedEnergy.HasValue()) { - newElement_0.addedEnergy = [NSNumber numberWithLongLong:entry_0.addedEnergy.Value()]; + if (entry_0.chargingTargets.HasValue()) { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + for (auto & entry_3 : entry_0.chargingTargets.Value()) { + MTREnergyEVSEClusterChargingTargetStruct * newElement_3; + newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; + if (entry_3.targetSoC.HasValue()) { + newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; + } else { + newElement_3.targetSoC = nil; + } + if (entry_3.addedEnergy.HasValue()) { + newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; + } else { + newElement_3.addedEnergy = nil; + } + [array_3 addObject:newElement_3]; + } + newElement_0.chargingTargets = array_3; + } } else { - newElement_0.addedEnergy = nil; + newElement_0.chargingTargets = nil; } [array_0 addObject:newElement_0]; } - params.chargingTargets = array_0; + params.chargingTargetSchedules = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); @@ -80963,7 +80973,7 @@ class EnergyEvseSetTargets : public ClusterCommand { private: chip::app::Clusters::EnergyEvse::Commands::SetTargets::Type mRequest; - TypedComplexArgument> mComplex_ChargingTargets; + TypedComplexArgument> mComplex_ChargingTargetSchedules; }; #endif // MTR_ENABLE_PROVISIONAL @@ -80976,9 +80986,6 @@ class EnergyEvseGetTargets : public ClusterCommand { EnergyEvseGetTargets() : ClusterCommand("get-targets") { -#if MTR_ENABLE_PROVISIONAL - AddArgument("DaysToReturn", 0, UINT8_MAX, &mRequest.daysToReturn); -#endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -80993,9 +81000,6 @@ class EnergyEvseGetTargets : public ClusterCommand { __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterGetTargetsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.daysToReturn = [NSNumber numberWithUnsignedChar:mRequest.daysToReturn.Raw()]; -#endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -81022,7 +81026,6 @@ class EnergyEvseGetTargets : public ClusterCommand { } private: - chip::app::Clusters::EnergyEvse::Commands::GetTargets::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL @@ -82092,176 +82095,6 @@ class SubscribeAttributeEnergyEvseRandomizationDelayWindow : public SubscribeAtt #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Attribute NumberOfWeeklyTargets - */ -class ReadEnergyEvseNumberOfWeeklyTargets : public ReadAttribute { -public: - ReadEnergyEvseNumberOfWeeklyTargets() - : ReadAttribute("number-of-weekly-targets") - { - } - - ~ReadEnergyEvseNumberOfWeeklyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfWeeklyTargets::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 = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfWeeklyTargetsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfWeeklyTargets response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("EnergyEVSE NumberOfWeeklyTargets read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeEnergyEvseNumberOfWeeklyTargets : public SubscribeAttribute { -public: - SubscribeAttributeEnergyEvseNumberOfWeeklyTargets() - : SubscribeAttribute("number-of-weekly-targets") - { - } - - ~SubscribeAttributeEnergyEvseNumberOfWeeklyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfWeeklyTargets::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 = [[MTRBaseClusterEnergyEVSE 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 subscribeAttributeNumberOfWeeklyTargetsWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfWeeklyTargets 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 NumberOfDailyTargets - */ -class ReadEnergyEvseNumberOfDailyTargets : public ReadAttribute { -public: - ReadEnergyEvseNumberOfDailyTargets() - : ReadAttribute("number-of-daily-targets") - { - } - - ~ReadEnergyEvseNumberOfDailyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfDailyTargets::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 = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeNumberOfDailyTargetsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfDailyTargets response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("EnergyEVSE NumberOfDailyTargets read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeEnergyEvseNumberOfDailyTargets : public SubscribeAttribute { -public: - SubscribeAttributeEnergyEvseNumberOfDailyTargets() - : SubscribeAttribute("number-of-daily-targets") - { - } - - ~SubscribeAttributeEnergyEvseNumberOfDailyTargets() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NumberOfDailyTargets::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 = [[MTRBaseClusterEnergyEVSE 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 subscribeAttributeNumberOfDailyTargetsWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"EnergyEVSE.NumberOfDailyTargets 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 NextChargeStartTime */ @@ -179242,14 +179075,6 @@ void registerClusterEnergyEvse(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(), // -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // From bc6a4c7da066702ec7159bf92da58d9837efa39e Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 00:37:17 +0000 Subject: [PATCH 133/143] Removed min/max for Randomisation window due to ZAP bug that doesn't allow more than 2 bytes. --- .../zap-templates/zcl/data-model/chip/energy-evse-cluster.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 048f217abb7db4..3f955d28876944 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -115,7 +115,7 @@ limitations under the License. UserMaximumChargeCurrent - + RandomizationDelayWindow From 10ee1d8640f25a23c28c0780adf1b68b3d67043b Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 01:05:34 +0000 Subject: [PATCH 134/143] Added missing new Java files --- ...EvseClusterChargingTargetScheduleStruct.kt | 89 +++++++++++++++++++ ...EvseClusterChargingTargetScheduleStruct.kt | 89 +++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt new file mode 100644 index 00000000000000..423672b1349bef --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class EnergyEvseClusterChargingTargetScheduleStruct( + val dayOfWeekforSequence: Optional, + val chargingTargets: Optional> +) { + override fun toString(): String = buildString { + append("EnergyEvseClusterChargingTargetScheduleStruct {\n") + append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tchargingTargets : $chargingTargets\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (dayOfWeekforSequence.isPresent) { + val optdayOfWeekforSequence = dayOfWeekforSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + } + if (chargingTargets.isPresent) { + val optchargingTargets = chargingTargets.get() + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in optchargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + } + endStructure() + } + } + + companion object { + private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_CHARGING_TARGETS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { + tlvReader.enterStructure(tlvTag) + val dayOfWeekforSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + } else { + Optional.empty() + } + val chargingTargets = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { + Optional.of( + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt new file mode 100644 index 00000000000000..b8aa1d7408f1c1 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import java.util.Optional +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 EnergyEvseClusterChargingTargetScheduleStruct( + val dayOfWeekforSequence: Optional, + val chargingTargets: Optional> +) { + override fun toString(): String = buildString { + append("EnergyEvseClusterChargingTargetScheduleStruct {\n") + append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tchargingTargets : $chargingTargets\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (dayOfWeekforSequence.isPresent) { + val optdayOfWeekforSequence = dayOfWeekforSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + } + if (chargingTargets.isPresent) { + val optchargingTargets = chargingTargets.get() + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in optchargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + } + endStructure() + } + } + + companion object { + private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_CHARGING_TARGETS = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { + tlvReader.enterStructure(tlvTag) + val dayOfWeekforSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + } else { + Optional.empty() + } + val chargingTargets = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { + Optional.of( + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + } + } +} From b1125530c6ce7edfd5608c929721786c9ad6b342 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 16:02:22 +0000 Subject: [PATCH 135/143] Changed DayOfWeekforSequence -> DayOfWeekForSequence in XML. Regen-all --- .../all-clusters-app.matter | 2 +- .../energy-management-app.matter | 2 +- .../data-model/chip/energy-evse-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../chip/devicecontroller/ChipStructs.java | 22 ++++++++-------- ...EvseClusterChargingTargetScheduleStruct.kt | 20 +++++++------- ...EvseClusterChargingTargetScheduleStruct.kt | 20 +++++++------- .../zap-generated/CHIPInvokeCallbacks.cpp | 26 +++++++++---------- .../python/chip/clusters/Objects.py | 4 +-- .../zap-generated/MTRCommandPayloadsObjc.mm | 12 ++++----- .../CHIP/zap-generated/MTRStructsObjc.h | 2 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 6 ++--- .../zap-generated/cluster-objects.cpp | 6 ++--- .../zap-generated/cluster-objects.h | 6 ++--- .../cluster/ComplexArgumentParser.cpp | 10 +++---- .../cluster/logging/DataModelLogger.cpp | 4 +-- .../zap-generated/cluster/Commands.h | 6 ++--- 17 files changed, 76 insertions(+), 76 deletions(-) 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 777670c6770d3c..68230e374e0c29 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 @@ -3934,7 +3934,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } 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 79b2a2b46894b1..255901812b0f19 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 @@ -973,7 +973,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 3f955d28876944..634c8d6e1b3698 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -82,7 +82,7 @@ limitations under the License. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9fe728a6497994..cdaea6617d3bc9 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4656,7 +4656,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 2c8d1b63c311df..8561046c058366 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7352,22 +7352,22 @@ public String toString() { } } public static class EnergyEvseClusterChargingTargetScheduleStruct { - public Optional dayOfWeekforSequence; + public Optional dayOfWeekForSequence; public Optional> chargingTargets; - private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; + private static final long DAY_OF_WEEK_FOR_SEQUENCE_ID = 0L; private static final long CHARGING_TARGETS_ID = 1L; public EnergyEvseClusterChargingTargetScheduleStruct( - Optional dayOfWeekforSequence, + Optional dayOfWeekForSequence, Optional> chargingTargets ) { - this.dayOfWeekforSequence = dayOfWeekforSequence; + this.dayOfWeekForSequence = dayOfWeekForSequence; this.chargingTargets = chargingTargets; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); + values.add(new StructElement(DAY_OF_WEEK_FOR_SEQUENCE_ID, dayOfWeekForSequence.map((nonOptionaldayOfWeekForSequence) -> new UIntType(nonOptionaldayOfWeekForSequence)).orElse(new EmptyType()))); values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); return new StructType(values); @@ -7377,13 +7377,13 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional dayOfWeekforSequence = Optional.empty(); + Optional dayOfWeekForSequence = Optional.empty(); Optional> chargingTargets = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { + if (element.contextTagNum() == DAY_OF_WEEK_FOR_SEQUENCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); + dayOfWeekForSequence = Optional.of(castingValue.value(Integer.class)); } } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { @@ -7393,7 +7393,7 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp } } return new EnergyEvseClusterChargingTargetScheduleStruct( - dayOfWeekforSequence, + dayOfWeekForSequence, chargingTargets ); } @@ -7402,8 +7402,8 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp public String toString() { StringBuilder output = new StringBuilder(); output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); - output.append("\tdayOfWeekforSequence: "); - output.append(dayOfWeekforSequence); + output.append("\tdayOfWeekForSequence: "); + output.append(dayOfWeekForSequence); output.append("\n"); output.append("\tchargingTargets: "); output.append(chargingTargets); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index 423672b1349bef..2cff1004099c89 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -25,12 +25,12 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekforSequence: Optional, + val dayOfWeekForSequence: Optional, val chargingTargets: Optional> ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") - append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tdayOfWeekForSequence : $dayOfWeekForSequence\n") append("\tchargingTargets : $chargingTargets\n") append("}\n") } @@ -38,9 +38,9 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekforSequence.isPresent) { - val optdayOfWeekforSequence = dayOfWeekforSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + if (dayOfWeekForSequence.isPresent) { + val optdayOfWeekForSequence = dayOfWeekForSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) } if (chargingTargets.isPresent) { val optchargingTargets = chargingTargets.get() @@ -55,14 +55,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( } companion object { - private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_DAY_OF_WEEK_FOR_SEQUENCE = 0 private const val TAG_CHARGING_TARGETS = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) - val dayOfWeekforSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + val dayOfWeekForSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) } else { Optional.empty() } @@ -83,7 +83,7 @@ class EnergyEvseClusterChargingTargetScheduleStruct( tlvReader.exitContainer() - return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekForSequence, chargingTargets) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index b8aa1d7408f1c1..417b0657103494 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -25,12 +25,12 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekforSequence: Optional, + val dayOfWeekForSequence: Optional, val chargingTargets: Optional> ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") - append("\tdayOfWeekforSequence : $dayOfWeekforSequence\n") + append("\tdayOfWeekForSequence : $dayOfWeekForSequence\n") append("\tchargingTargets : $chargingTargets\n") append("}\n") } @@ -38,9 +38,9 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekforSequence.isPresent) { - val optdayOfWeekforSequence = dayOfWeekforSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE), optdayOfWeekforSequence) + if (dayOfWeekForSequence.isPresent) { + val optdayOfWeekForSequence = dayOfWeekForSequence.get() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) } if (chargingTargets.isPresent) { val optchargingTargets = chargingTargets.get() @@ -55,14 +55,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( } companion object { - private const val TAG_DAY_OF_WEEKFOR_SEQUENCE = 0 + private const val TAG_DAY_OF_WEEK_FOR_SEQUENCE = 0 private const val TAG_CHARGING_TARGETS = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) - val dayOfWeekforSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEKFOR_SEQUENCE))) + val dayOfWeekForSequence = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) } else { Optional.empty() } @@ -83,7 +83,7 @@ class EnergyEvseClusterChargingTargetScheduleStruct( tlvReader.exitContainer() - return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekforSequence, chargingTargets) + return EnergyEvseClusterChargingTargetScheduleStruct(dayOfWeekForSequence, chargingTargets) } } } diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 5bf21dd5f16bba..571cf5c9140c81 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3981,23 +3981,23 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( { auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_dayOfWeekforSequence; - if (!entry_0.dayOfWeekforSequence.HasValue()) + jobject newElement_0_dayOfWeekForSequence; + if (!entry_0.dayOfWeekForSequence.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekForSequence); } else { - jobject newElement_0_dayOfWeekforSequenceInsideOptional; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); + jobject newElement_0_dayOfWeekForSequenceInsideOptional; + std::string newElement_0_dayOfWeekForSequenceInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekForSequenceInsideOptional = static_cast(entry_0.dayOfWeekForSequence.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), - newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), - jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, - newElement_0_dayOfWeekforSequence); + newElement_0_dayOfWeekForSequenceInsideOptionalClassName.c_str(), + newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature.c_str(), + jninewElement_0_dayOfWeekForSequenceInsideOptional, newElement_0_dayOfWeekForSequenceInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekForSequenceInsideOptional, + newElement_0_dayOfWeekForSequence); } jobject newElement_0_chargingTargets; if (!entry_0.chargingTargets.HasValue()) @@ -4108,7 +4108,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( } newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, - newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); + newElement_0_dayOfWeekForSequence, newElement_0_chargingTargets); chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 622fc30523abf3..8fc7cbbc3429b6 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -24063,11 +24063,11 @@ class ChargingTargetScheduleStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="dayOfWeekForSequence", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), ]) - dayOfWeekforSequence: 'typing.Optional[uint]' = None + dayOfWeekForSequence: 'typing.Optional[uint]' = None chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None class Commands: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 6994220b206bfd..aa401393f60882 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16909,10 +16909,10 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv auto & entry_0 = iter_0.GetValue(); MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; + if (entry_0.dayOfWeekForSequence.HasValue()) { + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekforSequence = nil; + newElement_0.dayOfWeekForSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables @@ -17343,9 +17343,9 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; - if (element_0.dayOfWeekforSequence != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); - definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); + if (element_0.dayOfWeekForSequence != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekForSequence.Emplace(); + definedValue_2 = static_cast>(element_0.dayOfWeekForSequence.unsignedCharValue); } if (element_0.chargingTargets != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 1d155ecd860e9c..03c458487ac190 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1287,7 +1287,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekForSequence MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 817b54dd8ad33c..ea434a6affb49e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5266,7 +5266,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = nil; + _dayOfWeekForSequence = nil; _chargingTargets = nil; } @@ -5277,7 +5277,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; + other.dayOfWeekForSequence = self.dayOfWeekForSequence; other.chargingTargets = self.chargingTargets; return other; @@ -5285,7 +5285,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekForSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekForSequence, _chargingTargets]; return descriptionString; } 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 9e5a7b34497209..5efe6b63375543 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 @@ -15862,7 +15862,7 @@ namespace ChargingTargetScheduleStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kDayOfWeekforSequence), dayOfWeekforSequence); + encoder.Encode(to_underlying(Fields::kDayOfWeekForSequence), dayOfWeekForSequence); encoder.Encode(to_underlying(Fields::kChargingTargets), chargingTargets); return encoder.Finalize(); } @@ -15881,9 +15881,9 @@ 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::kDayOfWeekforSequence)) + if (__context_tag == to_underlying(Fields::kDayOfWeekForSequence)) { - err = DataModel::Decode(reader, dayOfWeekforSequence); + err = DataModel::Decode(reader, dayOfWeekForSequence); } else if (__context_tag == to_underlying(Fields::kChargingTargets)) { 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 cad9c6d003855e..46f2792ace7d16 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 @@ -22007,14 +22007,14 @@ using DecodableType = Type; namespace ChargingTargetScheduleStruct { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, + kDayOfWeekForSequence = 0, kChargingTargets = 1, }; struct Type { public: - Optional> dayOfWeekforSequence; + Optional> dayOfWeekForSequence; Optional> chargingTargets; static constexpr bool kIsFabricScoped = false; @@ -22025,7 +22025,7 @@ struct Type struct DecodableType { public: - Optional> dayOfWeekforSequence; + Optional> dayOfWeekForSequence; Optional> chargingTargets; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index ea06951314b7dd..2deb5c5f7303ae 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3259,13 +3259,13 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, Json::Value valueCopy(value); char labelWithMember[kMaxLabelLength]; - if (value.isMember("dayOfWeekforSequence")) + if (value.isMember("dayOfWeekForSequence")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekForSequence"); ReturnErrorOnFailure( - ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekForSequence, value["dayOfWeekForSequence"])); } - valueCopy.removeMember("dayOfWeekforSequence"); + valueCopy.removeMember("dayOfWeekForSequence"); if (value.isMember("chargingTargets")) { @@ -3279,7 +3279,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) { - ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); + ComplexArgumentParser::Finalize(request.dayOfWeekForSequence); ComplexArgumentParser::Finalize(request.chargingTargets); } 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 446d77b0aee60f..8bf5953b30fdf2 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -2896,10 +2896,10 @@ DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("DayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence); + CHIP_ERROR err = LogValue("DayOfWeekForSequence", indent + 1, value.dayOfWeekForSequence); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekforSequence'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekForSequence'"); return err; } } 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 6e4ec40955e85b..f7d45eb602da6a 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80918,10 +80918,10 @@ class EnergyEvseSetTargets : public ClusterCommand { for (auto & entry_0 : mRequest.chargingTargetSchedules) { MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; + if (entry_0.dayOfWeekForSequence.HasValue()) { + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekforSequence = nil; + newElement_0.dayOfWeekForSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables From a863e96680bfd244d44866488cceb31778ff5e19 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 00:23:03 +0000 Subject: [PATCH 136/143] Updated energy-evse-cluster.xml to use latest EnergyEVSE.adoc which removes numberOfWeeklyTargets, numberOfDailyTargets, and adds new ChargingTargetScheduleStruct in Get/Set/Clear Target commands --- .../all-clusters-app.matter | 2 +- .../energy-management-app.matter | 2 +- .../data-model/chip/energy-evse-cluster.xml | 4 +-- .../data_model/controller-clusters.matter | 2 +- .../chip/devicecontroller/ChipStructs.java | 22 ++++++++-------- .../zap-generated/CHIPInvokeCallbacks.cpp | 26 +++++++++---------- .../python/chip/clusters/Objects.py | 4 +-- .../zap-generated/MTRCommandPayloadsObjc.mm | 12 ++++----- .../CHIP/zap-generated/MTRStructsObjc.h | 2 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 6 ++--- .../zap-generated/cluster-objects.h | 6 ++--- .../cluster/ComplexArgumentParser.cpp | 10 +++---- .../cluster/logging/DataModelLogger.cpp | 4 +-- .../zap-generated/cluster/Commands.h | 6 ++--- 14 files changed, 54 insertions(+), 54 deletions(-) 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 68230e374e0c29..777670c6770d3c 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 @@ -3934,7 +3934,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } 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 255901812b0f19..79b2a2b46894b1 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 @@ -973,7 +973,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 634c8d6e1b3698..048f217abb7db4 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -82,7 +82,7 @@ limitations under the License. - + @@ -115,7 +115,7 @@ limitations under the License. UserMaximumChargeCurrent - + RandomizationDelayWindow diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index cdaea6617d3bc9..9fe728a6497994 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4656,7 +4656,7 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; optional ChargingTargetStruct chargingTargets[] = 1; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 8561046c058366..2c8d1b63c311df 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7352,22 +7352,22 @@ public String toString() { } } public static class EnergyEvseClusterChargingTargetScheduleStruct { - public Optional dayOfWeekForSequence; + public Optional dayOfWeekforSequence; public Optional> chargingTargets; - private static final long DAY_OF_WEEK_FOR_SEQUENCE_ID = 0L; + private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; private static final long CHARGING_TARGETS_ID = 1L; public EnergyEvseClusterChargingTargetScheduleStruct( - Optional dayOfWeekForSequence, + Optional dayOfWeekforSequence, Optional> chargingTargets ) { - this.dayOfWeekForSequence = dayOfWeekForSequence; + this.dayOfWeekforSequence = dayOfWeekforSequence; this.chargingTargets = chargingTargets; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DAY_OF_WEEK_FOR_SEQUENCE_ID, dayOfWeekForSequence.map((nonOptionaldayOfWeekForSequence) -> new UIntType(nonOptionaldayOfWeekForSequence)).orElse(new EmptyType()))); + values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); return new StructType(values); @@ -7377,13 +7377,13 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional dayOfWeekForSequence = Optional.empty(); + Optional dayOfWeekforSequence = Optional.empty(); Optional> chargingTargets = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == DAY_OF_WEEK_FOR_SEQUENCE_ID) { + if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - dayOfWeekForSequence = Optional.of(castingValue.value(Integer.class)); + dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); } } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { @@ -7393,7 +7393,7 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp } } return new EnergyEvseClusterChargingTargetScheduleStruct( - dayOfWeekForSequence, + dayOfWeekforSequence, chargingTargets ); } @@ -7402,8 +7402,8 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp public String toString() { StringBuilder output = new StringBuilder(); output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); - output.append("\tdayOfWeekForSequence: "); - output.append(dayOfWeekForSequence); + output.append("\tdayOfWeekforSequence: "); + output.append(dayOfWeekforSequence); output.append("\n"); output.append("\tchargingTargets: "); output.append(chargingTargets); diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 571cf5c9140c81..5bf21dd5f16bba 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3981,23 +3981,23 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( { auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_dayOfWeekForSequence; - if (!entry_0.dayOfWeekForSequence.HasValue()) + jobject newElement_0_dayOfWeekforSequence; + if (!entry_0.dayOfWeekforSequence.HasValue()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekForSequence); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); } else { - jobject newElement_0_dayOfWeekForSequenceInsideOptional; - std::string newElement_0_dayOfWeekForSequenceInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dayOfWeekForSequenceInsideOptional = static_cast(entry_0.dayOfWeekForSequence.Value().Raw()); + jobject newElement_0_dayOfWeekforSequenceInsideOptional; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dayOfWeekForSequenceInsideOptionalClassName.c_str(), - newElement_0_dayOfWeekForSequenceInsideOptionalCtorSignature.c_str(), - jninewElement_0_dayOfWeekForSequenceInsideOptional, newElement_0_dayOfWeekForSequenceInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekForSequenceInsideOptional, - newElement_0_dayOfWeekForSequence); + newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), + newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), + jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, + newElement_0_dayOfWeekforSequence); } jobject newElement_0_chargingTargets; if (!entry_0.chargingTargets.HasValue()) @@ -4108,7 +4108,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( } newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, - newElement_0_dayOfWeekForSequence, newElement_0_chargingTargets); + newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 8fc7cbbc3429b6..622fc30523abf3 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -24063,11 +24063,11 @@ class ChargingTargetScheduleStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekForSequence", Tag=0, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), ]) - dayOfWeekForSequence: 'typing.Optional[uint]' = None + dayOfWeekforSequence: 'typing.Optional[uint]' = None chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None class Commands: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index aa401393f60882..6994220b206bfd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16909,10 +16909,10 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv auto & entry_0 = iter_0.GetValue(); MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekForSequence.HasValue()) { - newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekForSequence = nil; + newElement_0.dayOfWeekforSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables @@ -17343,9 +17343,9 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; - if (element_0.dayOfWeekForSequence != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekForSequence.Emplace(); - definedValue_2 = static_cast>(element_0.dayOfWeekForSequence.unsignedCharValue); + if (element_0.dayOfWeekforSequence != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); + definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); } if (element_0.chargingTargets != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 03c458487ac190..1d155ecd860e9c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1287,7 +1287,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekForSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index ea434a6affb49e..817b54dd8ad33c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5266,7 +5266,7 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekForSequence = nil; + _dayOfWeekforSequence = nil; _chargingTargets = nil; } @@ -5277,7 +5277,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; - other.dayOfWeekForSequence = self.dayOfWeekForSequence; + other.dayOfWeekforSequence = self.dayOfWeekforSequence; other.chargingTargets = self.chargingTargets; return other; @@ -5285,7 +5285,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekForSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekForSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; return descriptionString; } 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 46f2792ace7d16..cad9c6d003855e 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 @@ -22007,14 +22007,14 @@ using DecodableType = Type; namespace ChargingTargetScheduleStruct { enum class Fields : uint8_t { - kDayOfWeekForSequence = 0, + kDayOfWeekforSequence = 0, kChargingTargets = 1, }; struct Type { public: - Optional> dayOfWeekForSequence; + Optional> dayOfWeekforSequence; Optional> chargingTargets; static constexpr bool kIsFabricScoped = false; @@ -22025,7 +22025,7 @@ struct Type struct DecodableType { public: - Optional> dayOfWeekForSequence; + Optional> dayOfWeekforSequence; Optional> chargingTargets; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 2deb5c5f7303ae..ea06951314b7dd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3259,13 +3259,13 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, Json::Value valueCopy(value); char labelWithMember[kMaxLabelLength]; - if (value.isMember("dayOfWeekForSequence")) + if (value.isMember("dayOfWeekforSequence")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekForSequence"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); ReturnErrorOnFailure( - ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekForSequence, value["dayOfWeekForSequence"])); + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); } - valueCopy.removeMember("dayOfWeekForSequence"); + valueCopy.removeMember("dayOfWeekforSequence"); if (value.isMember("chargingTargets")) { @@ -3279,7 +3279,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) { - ComplexArgumentParser::Finalize(request.dayOfWeekForSequence); + ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); ComplexArgumentParser::Finalize(request.chargingTargets); } 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 8bf5953b30fdf2..446d77b0aee60f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -2896,10 +2896,10 @@ DataModelLogger::LogValue(const char * label, size_t indent, { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("DayOfWeekForSequence", indent + 1, value.dayOfWeekForSequence); + CHIP_ERROR err = LogValue("DayOfWeekforSequence", indent + 1, value.dayOfWeekforSequence); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekForSequence'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'DayOfWeekforSequence'"); return err; } } 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 f7d45eb602da6a..6e4ec40955e85b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80918,10 +80918,10 @@ class EnergyEvseSetTargets : public ClusterCommand { for (auto & entry_0 : mRequest.chargingTargetSchedules) { MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekForSequence.HasValue()) { - newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Value().Raw()]; + if (entry_0.dayOfWeekforSequence.HasValue()) { + newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; } else { - newElement_0.dayOfWeekForSequence = nil; + newElement_0.dayOfWeekforSequence = nil; } if (entry_0.chargingTargets.HasValue()) { { // Scope for our temporary variables From e395e1c98a604f64eeb89c700542d3eca1587648 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Sun, 14 Jan 2024 22:24:53 +0000 Subject: [PATCH 137/143] Removed optional=true in xml for DayOfWeekForSequence & ChargingTargets in ChargingTargetScheduleStruct --- .../all-clusters-app.matter | 4 +- .../energy-management-app.matter | 4 +- .../data-model/chip/energy-evse-cluster.xml | 6 +- .../data_model/controller-clusters.matter | 4 +- .../chip/devicecontroller/ChipStructs.java | 32 ++-- ...EvseClusterChargingTargetScheduleStruct.kt | 46 ++--- ...EvseClusterChargingTargetScheduleStruct.kt | 45 ++--- .../zap-generated/CHIPInvokeCallbacks.cpp | 175 ++++++++---------- .../python/chip/clusters/Objects.py | 8 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 110 +++++------ .../CHIP/zap-generated/MTRStructsObjc.h | 4 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 8 +- .../zap-generated/cluster-objects.h | 10 +- .../cluster/ComplexArgumentParser.cpp | 25 ++- .../zap-generated/cluster/Commands.h | 44 ++--- 15 files changed, 222 insertions(+), 303 deletions(-) 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 777670c6770d3c..19159dd37f2724 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 @@ -3934,8 +3934,8 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - optional ChargingTargetStruct chargingTargets[] = 1; + TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; } info event EVConnected = 0 { 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 79b2a2b46894b1..aec093e322a34a 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 @@ -973,8 +973,8 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - optional ChargingTargetStruct chargingTargets[] = 1; + TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; } info event EVConnected = 0 { diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml index 048f217abb7db4..a95a5adbd2e34b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-evse-cluster.xml @@ -82,8 +82,8 @@ limitations under the License. - - + + @@ -115,7 +115,7 @@ limitations under the License. UserMaximumChargeCurrent - + RandomizationDelayWindow diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9fe728a6497994..28a188e6f37f76 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4656,8 +4656,8 @@ provisional cluster EnergyEvse = 153 { } struct ChargingTargetScheduleStruct { - optional TargetDayOfWeekBitmap dayOfWeekforSequence = 0; - optional ChargingTargetStruct chargingTargets[] = 1; + TargetDayOfWeekBitmap dayOfWeekForSequence = 0; + ChargingTargetStruct chargingTargets[] = 1; } info event EVConnected = 0 { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 2c8d1b63c311df..43f6b880185622 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -7352,23 +7352,23 @@ public String toString() { } } public static class EnergyEvseClusterChargingTargetScheduleStruct { - public Optional dayOfWeekforSequence; - public Optional> chargingTargets; - private static final long DAY_OF_WEEKFOR_SEQUENCE_ID = 0L; + public Integer dayOfWeekForSequence; + public ArrayList chargingTargets; + private static final long DAY_OF_WEEK_FOR_SEQUENCE_ID = 0L; private static final long CHARGING_TARGETS_ID = 1L; public EnergyEvseClusterChargingTargetScheduleStruct( - Optional dayOfWeekforSequence, - Optional> chargingTargets + Integer dayOfWeekForSequence, + ArrayList chargingTargets ) { - this.dayOfWeekforSequence = dayOfWeekforSequence; + this.dayOfWeekForSequence = dayOfWeekForSequence; this.chargingTargets = chargingTargets; } public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DAY_OF_WEEKFOR_SEQUENCE_ID, dayOfWeekforSequence.map((nonOptionaldayOfWeekforSequence) -> new UIntType(nonOptionaldayOfWeekforSequence)).orElse(new EmptyType()))); - values.add(new StructElement(CHARGING_TARGETS_ID, chargingTargets.map((nonOptionalchargingTargets) -> ArrayType.generateArrayType(nonOptionalchargingTargets, (elementnonOptionalchargingTargets) -> elementnonOptionalchargingTargets.encodeTlv())).orElse(new EmptyType()))); + values.add(new StructElement(DAY_OF_WEEK_FOR_SEQUENCE_ID, new UIntType(dayOfWeekForSequence))); + values.add(new StructElement(CHARGING_TARGETS_ID, ArrayType.generateArrayType(chargingTargets, (elementchargingTargets) -> elementchargingTargets.encodeTlv()))); return new StructType(values); } @@ -7377,23 +7377,23 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional dayOfWeekforSequence = Optional.empty(); - Optional> chargingTargets = Optional.empty(); + Integer dayOfWeekForSequence = null; + ArrayList chargingTargets = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == DAY_OF_WEEKFOR_SEQUENCE_ID) { + if (element.contextTagNum() == DAY_OF_WEEK_FOR_SEQUENCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - dayOfWeekforSequence = Optional.of(castingValue.value(Integer.class)); + dayOfWeekForSequence = castingValue.value(Integer.class); } } else if (element.contextTagNum() == CHARGING_TARGETS_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); - chargingTargets = Optional.of(castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue))); + chargingTargets = castingValue.map((elementcastingValue) -> ChipStructs.EnergyEvseClusterChargingTargetStruct.decodeTlv(elementcastingValue)); } } } return new EnergyEvseClusterChargingTargetScheduleStruct( - dayOfWeekforSequence, + dayOfWeekForSequence, chargingTargets ); } @@ -7402,8 +7402,8 @@ public static EnergyEvseClusterChargingTargetScheduleStruct decodeTlv(BaseTLVTyp public String toString() { StringBuilder output = new StringBuilder(); output.append("EnergyEvseClusterChargingTargetScheduleStruct {\n"); - output.append("\tdayOfWeekforSequence: "); - output.append(dayOfWeekforSequence); + output.append("\tdayOfWeekForSequence: "); + output.append(dayOfWeekForSequence); output.append("\n"); output.append("\tchargingTargets: "); output.append(chargingTargets); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index 2cff1004099c89..bddc2563640620 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -17,7 +17,6 @@ package chip.devicecontroller.cluster.structs import chip.devicecontroller.cluster.* -import java.util.Optional import matter.tlv.AnonymousTag import matter.tlv.ContextSpecificTag import matter.tlv.Tag @@ -25,8 +24,8 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekForSequence: Optional, - val chargingTargets: Optional> + val dayOfWeekForSequence: UInt, + val chargingTargets: List ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") @@ -38,18 +37,12 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekForSequence.isPresent) { - val optdayOfWeekForSequence = dayOfWeekForSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) - } - if (chargingTargets.isPresent) { - val optchargingTargets = chargingTargets.get() - startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - for (item in optchargingTargets.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), dayOfWeekForSequence) + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in chargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) } + endArray() endStructure() } } @@ -60,25 +53,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) - val dayOfWeekForSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) - } else { - Optional.empty() - } + val dayOfWeekForSequence = tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE)) val chargingTargets = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { - Optional.of( - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - while (!tlvReader.isEndOfContainer()) { - add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() - } - ) - } else { - Optional.empty() + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt index 417b0657103494..eaa06f527c652f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt @@ -16,7 +16,6 @@ */ package matter.controller.cluster.structs -import java.util.Optional import matter.controller.cluster.* import matter.tlv.AnonymousTag import matter.tlv.ContextSpecificTag @@ -25,8 +24,8 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyEvseClusterChargingTargetScheduleStruct( - val dayOfWeekForSequence: Optional, - val chargingTargets: Optional> + val dayOfWeekForSequence: UByte, + val chargingTargets: List ) { override fun toString(): String = buildString { append("EnergyEvseClusterChargingTargetScheduleStruct {\n") @@ -38,18 +37,12 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - if (dayOfWeekForSequence.isPresent) { - val optdayOfWeekForSequence = dayOfWeekForSequence.get() - put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), optdayOfWeekForSequence) - } - if (chargingTargets.isPresent) { - val optchargingTargets = chargingTargets.get() - startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - for (item in optchargingTargets.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() + put(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE), dayOfWeekForSequence) + startArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + for (item in chargingTargets.iterator()) { + item.toTlv(AnonymousTag, this) } + endArray() endStructure() } } @@ -61,24 +54,14 @@ class EnergyEvseClusterChargingTargetScheduleStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterChargingTargetScheduleStruct { tlvReader.enterStructure(tlvTag) val dayOfWeekForSequence = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) { - Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE))) - } else { - Optional.empty() - } + tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK_FOR_SEQUENCE)) val chargingTargets = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_CHARGING_TARGETS))) { - Optional.of( - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) - while (!tlvReader.isEndOfContainer()) { - add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() - } - ) - } else { - Optional.empty() + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_CHARGING_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(EnergyEvseClusterChargingTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() } tlvReader.exitContainer() diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index 5bf21dd5f16bba..15ee339bd13e8d 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -3981,110 +3981,87 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( { auto & entry_0 = iter_ChargingTargetSchedules_0.GetValue(); jobject newElement_0; - jobject newElement_0_dayOfWeekforSequence; - if (!entry_0.dayOfWeekforSequence.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_dayOfWeekforSequence); - } - else - { - jobject newElement_0_dayOfWeekforSequenceInsideOptional; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_0_dayOfWeekforSequenceInsideOptional = static_cast(entry_0.dayOfWeekforSequence.Value().Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_dayOfWeekforSequenceInsideOptionalClassName.c_str(), - newElement_0_dayOfWeekforSequenceInsideOptionalCtorSignature.c_str(), - jninewElement_0_dayOfWeekforSequenceInsideOptional, newElement_0_dayOfWeekforSequenceInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_0_dayOfWeekforSequenceInsideOptional, - newElement_0_dayOfWeekforSequence); - } + jobject newElement_0_dayOfWeekForSequence; + std::string newElement_0_dayOfWeekForSequenceClassName = "java/lang/Integer"; + std::string newElement_0_dayOfWeekForSequenceCtorSignature = "(I)V"; + jint jninewElement_0_dayOfWeekForSequence = static_cast(entry_0.dayOfWeekForSequence.Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_dayOfWeekForSequenceClassName.c_str(), newElement_0_dayOfWeekForSequenceCtorSignature.c_str(), + jninewElement_0_dayOfWeekForSequence, newElement_0_dayOfWeekForSequence); jobject newElement_0_chargingTargets; - if (!entry_0.chargingTargets.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_chargingTargets); - } - else - { - jobject newElement_0_chargingTargetsInsideOptional; - chip::JniReferences::GetInstance().CreateArrayList(newElement_0_chargingTargetsInsideOptional); + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_chargingTargets); - auto iter_newElement_0_chargingTargetsInsideOptional_3 = entry_0.chargingTargets.Value().begin(); - while (iter_newElement_0_chargingTargetsInsideOptional_3.Next()) + auto iter_newElement_0_chargingTargets_2 = entry_0.chargingTargets.begin(); + while (iter_newElement_0_chargingTargets_2.Next()) + { + auto & entry_2 = iter_newElement_0_chargingTargets_2.GetValue(); + jobject newElement_2; + jobject newElement_2_targetTimeMinutesPastMidnight; + std::string newElement_2_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; + std::string newElement_2_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; + jint jninewElement_2_targetTimeMinutesPastMidnight = static_cast(entry_2.targetTimeMinutesPastMidnight); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_targetTimeMinutesPastMidnightClassName.c_str(), + newElement_2_targetTimeMinutesPastMidnightCtorSignature.c_str(), jninewElement_2_targetTimeMinutesPastMidnight, + newElement_2_targetTimeMinutesPastMidnight); + jobject newElement_2_targetSoC; + if (!entry_2.targetSoC.HasValue()) { - auto & entry_3 = iter_newElement_0_chargingTargetsInsideOptional_3.GetValue(); - jobject newElement_3; - jobject newElement_3_targetTimeMinutesPastMidnight; - std::string newElement_3_targetTimeMinutesPastMidnightClassName = "java/lang/Integer"; - std::string newElement_3_targetTimeMinutesPastMidnightCtorSignature = "(I)V"; - jint jninewElement_3_targetTimeMinutesPastMidnight = static_cast(entry_3.targetTimeMinutesPastMidnight); + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_targetSoC); + } + else + { + jobject newElement_2_targetSoCInsideOptional; + std::string newElement_2_targetSoCInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_targetSoCInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_targetSoCInsideOptional = static_cast(entry_2.targetSoC.Value()); chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_targetTimeMinutesPastMidnightClassName.c_str(), - newElement_3_targetTimeMinutesPastMidnightCtorSignature.c_str(), jninewElement_3_targetTimeMinutesPastMidnight, - newElement_3_targetTimeMinutesPastMidnight); - jobject newElement_3_targetSoC; - if (!entry_3.targetSoC.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_targetSoC); - } - else - { - jobject newElement_3_targetSoCInsideOptional; - std::string newElement_3_targetSoCInsideOptionalClassName = "java/lang/Integer"; - std::string newElement_3_targetSoCInsideOptionalCtorSignature = "(I)V"; - jint jninewElement_3_targetSoCInsideOptional = static_cast(entry_3.targetSoC.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_targetSoCInsideOptionalClassName.c_str(), - newElement_3_targetSoCInsideOptionalCtorSignature.c_str(), jninewElement_3_targetSoCInsideOptional, - newElement_3_targetSoCInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_3_targetSoCInsideOptional, newElement_3_targetSoC); - } - jobject newElement_3_addedEnergy; - if (!entry_3.addedEnergy.HasValue()) - { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_addedEnergy); - } - else - { - jobject newElement_3_addedEnergyInsideOptional; - std::string newElement_3_addedEnergyInsideOptionalClassName = "java/lang/Long"; - std::string newElement_3_addedEnergyInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_3_addedEnergyInsideOptional = static_cast(entry_3.addedEnergy.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_addedEnergyInsideOptionalClassName.c_str(), - newElement_3_addedEnergyInsideOptionalCtorSignature.c_str(), jninewElement_3_addedEnergyInsideOptional, - newElement_3_addedEnergyInsideOptional); - chip::JniReferences::GetInstance().CreateOptional(newElement_3_addedEnergyInsideOptional, - newElement_3_addedEnergy); - } - - jclass chargingTargetStructStructClass_4; - err = chip::JniReferences::GetInstance().GetClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", - chargingTargetStructStructClass_4); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); - return; - } + newElement_2_targetSoCInsideOptionalClassName.c_str(), + newElement_2_targetSoCInsideOptionalCtorSignature.c_str(), jninewElement_2_targetSoCInsideOptional, + newElement_2_targetSoCInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_targetSoCInsideOptional, newElement_2_targetSoC); + } + jobject newElement_2_addedEnergy; + if (!entry_2.addedEnergy.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_addedEnergy); + } + else + { + jobject newElement_2_addedEnergyInsideOptional; + std::string newElement_2_addedEnergyInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_addedEnergyInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_addedEnergyInsideOptional = static_cast(entry_2.addedEnergy.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_addedEnergyInsideOptionalClassName.c_str(), + newElement_2_addedEnergyInsideOptionalCtorSignature.c_str(), jninewElement_2_addedEnergyInsideOptional, + newElement_2_addedEnergyInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_addedEnergyInsideOptional, newElement_2_addedEnergy); + } - jmethodID chargingTargetStructStructCtor_4; - err = chip::JniReferences::GetInstance().FindMethod( - env, chargingTargetStructStructClass_4, "", - "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", &chargingTargetStructStructCtor_4); - if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_4 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); - return; - } + jclass chargingTargetStructStructClass_3; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$EnergyEvseClusterChargingTargetStruct", chargingTargetStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$EnergyEvseClusterChargingTargetStruct"); + return; + } - newElement_3 = - env->NewObject(chargingTargetStructStructClass_4, chargingTargetStructStructCtor_4, - newElement_3_targetTimeMinutesPastMidnight, newElement_3_targetSoC, newElement_3_addedEnergy); - chip::JniReferences::GetInstance().AddToList(newElement_0_chargingTargetsInsideOptional, newElement_3); + jmethodID chargingTargetStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetStructStructClass_3, "", + "(Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", + &chargingTargetStructStructCtor_3); + if (err != CHIP_NO_ERROR || chargingTargetStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$EnergyEvseClusterChargingTargetStruct constructor"); + return; } - chip::JniReferences::GetInstance().CreateOptional(newElement_0_chargingTargetsInsideOptional, - newElement_0_chargingTargets); + + newElement_2 = + env->NewObject(chargingTargetStructStructClass_3, chargingTargetStructStructCtor_3, + newElement_2_targetTimeMinutesPastMidnight, newElement_2_targetSoC, newElement_2_addedEnergy); + chip::JniReferences::GetInstance().AddToList(newElement_0_chargingTargets, newElement_2); } jclass chargingTargetScheduleStructStructClass_1; @@ -4099,7 +4076,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( jmethodID chargingTargetScheduleStructStructCtor_1; err = chip::JniReferences::GetInstance().FindMethod(env, chargingTargetScheduleStructStructClass_1, "", - "(Ljava/util/Optional;Ljava/util/Optional;)V", + "(Ljava/lang/Integer;Ljava/util/ArrayList;)V", &chargingTargetScheduleStructStructCtor_1); if (err != CHIP_NO_ERROR || chargingTargetScheduleStructStructCtor_1 == nullptr) { @@ -4108,7 +4085,7 @@ void CHIPEnergyEvseClusterGetTargetsResponseCallback::CallbackFn( } newElement_0 = env->NewObject(chargingTargetScheduleStructStructClass_1, chargingTargetScheduleStructStructCtor_1, - newElement_0_dayOfWeekforSequence, newElement_0_chargingTargets); + newElement_0_dayOfWeekForSequence, newElement_0_chargingTargets); chip::JniReferences::GetInstance().AddToList(ChargingTargetSchedules, newElement_0); } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 622fc30523abf3..503b9738acce84 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -24063,12 +24063,12 @@ class ChargingTargetScheduleStruct(ClusterObject): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="dayOfWeekforSequence", Tag=0, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]), + ClusterObjectFieldDescriptor(Label="dayOfWeekForSequence", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="chargingTargets", Tag=1, Type=typing.List[EnergyEvse.Structs.ChargingTargetStruct]), ]) - dayOfWeekforSequence: 'typing.Optional[uint]' = None - chargingTargets: 'typing.Optional[typing.List[EnergyEvse.Structs.ChargingTargetStruct]]' = None + dayOfWeekForSequence: 'uint' = 0 + chargingTargets: 'typing.List[EnergyEvse.Structs.ChargingTargetStruct]' = field(default_factory=lambda: []) class Commands: @dataclass diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 6994220b206bfd..5aaa076eb34afc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -16909,40 +16909,32 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::EnergyEv auto & entry_0 = iter_0.GetValue(); MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; - } else { - newElement_0.dayOfWeekforSequence = nil; - } - if (entry_0.chargingTargets.HasValue()) { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = entry_0.chargingTargets.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - MTREnergyEVSEClusterChargingTargetStruct * newElement_3; - newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; - if (entry_3.targetSoC.HasValue()) { - newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; - } else { - newElement_3.targetSoC = nil; - } - if (entry_3.addedEnergy.HasValue()) { - newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; - } else { - newElement_3.addedEnergy = nil; - } - [array_3 addObject:newElement_3]; + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Raw()]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.chargingTargets.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTREnergyEVSEClusterChargingTargetStruct * newElement_2; + newElement_2 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_2.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_2.targetTimeMinutesPastMidnight]; + if (entry_2.targetSoC.HasValue()) { + newElement_2.targetSoC = [NSNumber numberWithUnsignedChar:entry_2.targetSoC.Value()]; + } else { + newElement_2.targetSoC = nil; } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - return err; + if (entry_2.addedEnergy.HasValue()) { + newElement_2.addedEnergy = [NSNumber numberWithLongLong:entry_2.addedEnergy.Value()]; + } else { + newElement_2.addedEnergy = nil; } - newElement_0.chargingTargets = array_3; + [array_2 addObject:newElement_2]; } - } else { - newElement_0.chargingTargets = nil; + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + return err; + } + newElement_0.chargingTargets = array_2; } [array_0 addObject:newElement_0]; } @@ -17343,41 +17335,35 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader return CHIP_ERROR_INVALID_ARGUMENT; } auto element_0 = (MTREnergyEVSEClusterChargingTargetScheduleStruct *) self.chargingTargetSchedules[i_0]; - if (element_0.dayOfWeekforSequence != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].dayOfWeekforSequence.Emplace(); - definedValue_2 = static_cast>(element_0.dayOfWeekforSequence.unsignedCharValue); - } - if (element_0.chargingTargets != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].chargingTargets.Emplace(); - { - using ListType_3 = std::remove_reference_t; - using ListMemberType_3 = ListMemberTypeGetter::Type; - if (element_0.chargingTargets.count != 0) { - auto * listHolder_3 = new ListHolder(element_0.chargingTargets.count); - if (listHolder_3 == nullptr || listHolder_3->mList == nullptr) { + listHolder_0->mList[i_0].dayOfWeekForSequence = static_castmList[i_0].dayOfWeekForSequence)>>(element_0.dayOfWeekForSequence.unsignedCharValue); + { + using ListType_2 = std::remove_reference_tmList[i_0].chargingTargets)>; + using ListMemberType_2 = ListMemberTypeGetter::Type; + if (element_0.chargingTargets.count != 0) { + auto * listHolder_2 = new ListHolder(element_0.chargingTargets.count); + if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_2); + for (size_t i_2 = 0; i_2 < element_0.chargingTargets.count; ++i_2) { + if (![element_0.chargingTargets[i_2] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { + // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - listFreer.add(listHolder_3); - for (size_t i_3 = 0; i_3 < element_0.chargingTargets.count; ++i_3) { - if (![element_0.chargingTargets[i_3] isKindOfClass:[MTREnergyEVSEClusterChargingTargetStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_3 = (MTREnergyEVSEClusterChargingTargetStruct *) element_0.chargingTargets[i_3]; - listHolder_3->mList[i_3].targetTimeMinutesPastMidnight = element_3.targetTimeMinutesPastMidnight.unsignedShortValue; - if (element_3.targetSoC != nil) { - auto & definedValue_5 = listHolder_3->mList[i_3].targetSoC.Emplace(); - definedValue_5 = element_3.targetSoC.unsignedCharValue; - } - if (element_3.addedEnergy != nil) { - auto & definedValue_5 = listHolder_3->mList[i_3].addedEnergy.Emplace(); - definedValue_5 = element_3.addedEnergy.longLongValue; - } + auto element_2 = (MTREnergyEVSEClusterChargingTargetStruct *) element_0.chargingTargets[i_2]; + listHolder_2->mList[i_2].targetTimeMinutesPastMidnight = element_2.targetTimeMinutesPastMidnight.unsignedShortValue; + if (element_2.targetSoC != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].targetSoC.Emplace(); + definedValue_4 = element_2.targetSoC.unsignedCharValue; + } + if (element_2.addedEnergy != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].addedEnergy.Emplace(); + definedValue_4 = element_2.addedEnergy.longLongValue; } - definedValue_2 = ListType_3(listHolder_3->mList, element_0.chargingTargets.count); - } else { - definedValue_2 = ListType_3(); } + listHolder_0->mList[i_0].chargingTargets = ListType_2(listHolder_2->mList, element_0.chargingTargets.count); + } else { + listHolder_0->mList[i_0].chargingTargets = ListType_2(); } } } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 1d155ecd860e9c..dd26ad6a56dad5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1287,8 +1287,8 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyEVSEClusterChargingTargetScheduleStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeekforSequence MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSArray * _Nullable chargingTargets MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull dayOfWeekForSequence MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull chargingTargets MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 817b54dd8ad33c..d25571b48861f0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -5266,9 +5266,9 @@ - (instancetype)init { if (self = [super init]) { - _dayOfWeekforSequence = nil; + _dayOfWeekForSequence = @(0); - _chargingTargets = nil; + _chargingTargets = [NSArray array]; } return self; } @@ -5277,7 +5277,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTREnergyEVSEClusterChargingTargetScheduleStruct alloc] init]; - other.dayOfWeekforSequence = self.dayOfWeekforSequence; + other.dayOfWeekForSequence = self.dayOfWeekForSequence; other.chargingTargets = self.chargingTargets; return other; @@ -5285,7 +5285,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekforSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekforSequence, _chargingTargets]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: dayOfWeekForSequence:%@; chargingTargets:%@; >", NSStringFromClass([self class]), _dayOfWeekForSequence, _chargingTargets]; return descriptionString; } 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 cad9c6d003855e..7de5dc885bcecb 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 @@ -22007,15 +22007,15 @@ using DecodableType = Type; namespace ChargingTargetScheduleStruct { enum class Fields : uint8_t { - kDayOfWeekforSequence = 0, + kDayOfWeekForSequence = 0, kChargingTargets = 1, }; struct Type { public: - Optional> dayOfWeekforSequence; - Optional> chargingTargets; + chip::BitMask dayOfWeekForSequence = static_cast>(0); + DataModel::List chargingTargets; static constexpr bool kIsFabricScoped = false; @@ -22025,8 +22025,8 @@ struct Type struct DecodableType { public: - Optional> dayOfWeekforSequence; - Optional> chargingTargets; + chip::BitMask dayOfWeekForSequence = static_cast>(0); + DataModel::DecodableList chargingTargets; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index ea06951314b7dd..d32f230dc1d739 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -3258,20 +3258,19 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, // Copy to track which members we already processed. Json::Value valueCopy(value); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChargingTargetScheduleStruct.dayOfWeekForSequence", + "dayOfWeekForSequence", value.isMember("dayOfWeekForSequence"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ChargingTargetScheduleStruct.chargingTargets", "chargingTargets", + value.isMember("chargingTargets"))); + char labelWithMember[kMaxLabelLength]; - if (value.isMember("dayOfWeekforSequence")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekforSequence"); - ReturnErrorOnFailure( - ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekforSequence, value["dayOfWeekforSequence"])); - } - valueCopy.removeMember("dayOfWeekforSequence"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "dayOfWeekForSequence"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.dayOfWeekForSequence, value["dayOfWeekForSequence"])); + valueCopy.removeMember("dayOfWeekForSequence"); - if (value.isMember("chargingTargets")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "chargingTargets"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.chargingTargets, value["chargingTargets"])); - } + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "chargingTargets"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.chargingTargets, value["chargingTargets"])); valueCopy.removeMember("chargingTargets"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); @@ -3279,7 +3278,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, void ComplexArgumentParser::Finalize(chip::app::Clusters::EnergyEvse::Structs::ChargingTargetScheduleStruct::Type & request) { - ComplexArgumentParser::Finalize(request.dayOfWeekforSequence); + ComplexArgumentParser::Finalize(request.dayOfWeekForSequence); ComplexArgumentParser::Finalize(request.chargingTargets); } 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 6e4ec40955e85b..6c6793c214a049 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -80918,34 +80918,26 @@ class EnergyEvseSetTargets : public ClusterCommand { for (auto & entry_0 : mRequest.chargingTargetSchedules) { MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; - if (entry_0.dayOfWeekforSequence.HasValue()) { - newElement_0.dayOfWeekforSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekforSequence.Value().Raw()]; - } else { - newElement_0.dayOfWeekforSequence = nil; - } - if (entry_0.chargingTargets.HasValue()) { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - for (auto & entry_3 : entry_0.chargingTargets.Value()) { - MTREnergyEVSEClusterChargingTargetStruct * newElement_3; - newElement_3 = [MTREnergyEVSEClusterChargingTargetStruct new]; - newElement_3.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_3.targetTimeMinutesPastMidnight]; - if (entry_3.targetSoC.HasValue()) { - newElement_3.targetSoC = [NSNumber numberWithUnsignedChar:entry_3.targetSoC.Value()]; - } else { - newElement_3.targetSoC = nil; - } - if (entry_3.addedEnergy.HasValue()) { - newElement_3.addedEnergy = [NSNumber numberWithLongLong:entry_3.addedEnergy.Value()]; - } else { - newElement_3.addedEnergy = nil; - } - [array_3 addObject:newElement_3]; + newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Raw()]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + for (auto & entry_2 : entry_0.chargingTargets) { + MTREnergyEVSEClusterChargingTargetStruct * newElement_2; + newElement_2 = [MTREnergyEVSEClusterChargingTargetStruct new]; + newElement_2.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_2.targetTimeMinutesPastMidnight]; + if (entry_2.targetSoC.HasValue()) { + newElement_2.targetSoC = [NSNumber numberWithUnsignedChar:entry_2.targetSoC.Value()]; + } else { + newElement_2.targetSoC = nil; } - newElement_0.chargingTargets = array_3; + if (entry_2.addedEnergy.HasValue()) { + newElement_2.addedEnergy = [NSNumber numberWithLongLong:entry_2.addedEnergy.Value()]; + } else { + newElement_2.addedEnergy = nil; + } + [array_2 addObject:newElement_2]; } - } else { - newElement_0.chargingTargets = nil; + newElement_0.chargingTargets = array_2; } [array_0 addObject:newElement_0]; } From 69241b73791455b6713b857ff83dd4e447b8841b Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:06:27 +0000 Subject: [PATCH 138/143] Update examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h Co-authored-by: Boris Zbarsky --- .../energy-management-common/include/EnergyEvseDelegateImpl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h index 8cf76f1b7a29bf..d27f35ee63201c 100644 --- a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h +++ b/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h @@ -53,7 +53,7 @@ class EvseSession public: EvseSession(EndpointId aEndpoint) { mEndpointId = aEndpoint; } /** - * @brief This function samples the start-time, and energy meter to hold the session info + * @brief This function records the start time and provided energy meter values as part of the new session. * * @param chargingMeterValue - The current value of the energy meter (charging) in mWh * @param dischargingMeterValue - The current value of the energy meter (discharging) in mWh From 0c2a8cdf4c0b6605fdf807878ed9ce00f67fc30a Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:30:29 +0000 Subject: [PATCH 139/143] Touched file to retrigger restyled job --- .../energy-management-common/include/EVSECallbacks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h index 15578405552d78..124326d1e260cf 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h +++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h @@ -30,7 +30,7 @@ using namespace chip::app::Clusters::EnergyEvse; * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement * and potential future clusters. */ - + enum class EVSECallbackType : uint8_t { /* From fa454722179b2e682ae0f4bdd74777a9b656defe Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:32:11 +0000 Subject: [PATCH 140/143] Removed whitespace which was added to trigger restyled to rerun --- .../energy-management-common/include/EVSECallbacks.h | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h index 124326d1e260cf..7d288809952ee3 100644 --- a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h +++ b/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h @@ -30,7 +30,6 @@ using namespace chip::app::Clusters::EnergyEvse; * This is not specific to the EnergyEVSE cluster, but includes DeviceEnergyManagement * and potential future clusters. */ - enum class EVSECallbackType : uint8_t { /* From 6c34314474d8d7b04e0c11439297590c221084ee Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 16 Jan 2024 21:58:26 +0000 Subject: [PATCH 141/143] Removed potentially unsafe code before merging into PR #30957 --- .../DeviceEnergyManagementDelegateImpl.cpp | 57 +------------------ 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp index 25a9afd6a766cc..4d4d9bf05bbdbb 100644 --- a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp +++ b/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp @@ -332,66 +332,13 @@ CHIP_ERROR DeviceEnergyManagementDelegate::SetAbsMaxPower(int64_t newValue) CHIP_ERROR DeviceEnergyManagementDelegate::SetPowerAdjustmentCapability(PowerAdjustmentCapability::TypeInfo::Type powerAdjustmentCapability) { - if (powerAdjustmentCapability.IsNull()) - { - mPowerAdjustmentCapability.SetNull(); - ChipLogDetail(AppServer, "DEM: PowerAdjustmentCapability is null"); - } - else - { - auto src = powerAdjustmentCapability.Value(); - auto target = mPowerAdjustmentCapability.Value(); - auto size = src.size(); - - if (size > 8) - { - return CHIP_ERROR_BAD_REQUEST; - } - - target.reduce_size(0); - - for (size_t i = 0; i < size; i++) - { - const_cast(target[i]) = src[i]; - } - } - - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, PowerAdjustmentCapability::Id); + // TODO see Issue #31147 return CHIP_NO_ERROR; } CHIP_ERROR DeviceEnergyManagementDelegate::SetForecast(DataModel::Nullable forecast) { - if (forecast.IsNull()) - { - mForecast.SetNull(); - ChipLogDetail(AppServer, "DEM: Forecast is null"); - } - else - { - auto src = forecast.Value(); - auto target = mForecast.Value(); - - target.forecastId++; - target.activeSlotNumber = src.activeSlotNumber; - target.startTime = src.startTime; - target.endTime = src.endTime; - target.earliestStartTime = src.earliestStartTime; - target.latestEndTime = src.latestEndTime; - target.isPauseable = src.isPauseable; - - auto slots = src.slots; - auto size = slots.size(); - target.slots.reduce_size(0); // clear them - - for (size_t i = 0; i < size; i++) - { - const_cast(target.slots[i]) = - slots[i]; // TODO: test if this works for optional/nullable stuff - } - } - - MatterReportingAttributeChangeCallback(mEndpointId, DeviceEnergyManagement::Id, Forecast::Id); + // TODO see Issue #31147 return CHIP_NO_ERROR; } From b2a8c1cf1f6086bfc9ff232f4b7422ce8fcda1ca Mon Sep 17 00:00:00 2001 From: James Harrow Date: Tue, 16 Jan 2024 22:09:46 +0000 Subject: [PATCH 142/143] Renamed variable and replaced auto with type so it is clearer to reader. --- .../device-energy-management-server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp index eb63aa31da330f..bfe3cac5f2e89e 100644 --- a/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp +++ b/src/app/clusters/device-energy-management-server/device-energy-management-server.cpp @@ -343,11 +343,11 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, } /* Temporary variable to save keep calling .Value() on the Optional element */ - auto & earliestStartTimeOptional = forecast.earliestStartTime.Value(); + DataModel::Nullable & earliestStartTimeNullable = forecast.earliestStartTime.Value(); /* Latest End Time is optional & cannot be null - unlike earliestStartTime! */ latestEndTimeEpoch = forecast.latestEndTime.Value(); - if (earliestStartTimeOptional.IsNull()) + if (earliestStartTimeNullable.IsNull()) { System::Clock::Milliseconds64 cTMs; CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(cTMs); @@ -372,7 +372,7 @@ void Instance::HandleStartTimeAdjustRequest(HandlerContext & ctx, } else { - earliestStartTimeEpoch = earliestStartTimeOptional.Value(); + earliestStartTimeEpoch = earliestStartTimeNullable.Value(); } duration = forecast.endTime - forecast.startTime; // the current entire forecast duration From e8996a9ff3543c5f91ff7ed29a6833aea2a54593 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 17 Jan 2024 10:24:21 +0000 Subject: [PATCH 143/143] Restyled by clang-format --- src/app/clusters/energy-evse-server/energy-evse-server.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/energy-evse-server/energy-evse-server.h b/src/app/clusters/energy-evse-server/energy-evse-server.h index edac2357e97c39..dfead37517d4e8 100644 --- a/src/app/clusters/energy-evse-server/energy-evse-server.h +++ b/src/app/clusters/energy-evse-server/energy-evse-server.h @@ -140,8 +140,9 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface public: Instance(EndpointId aEndpointId, Delegate & aDelegate, Feature aFeature, OptionalAttributes aOptionalAttrs, OptionalCommands aOptionalCmds) : - AttributeAccessInterface(MakeOptional(aEndpointId), Id), CommandHandlerInterface(MakeOptional(aEndpointId), Id), - mDelegate(aDelegate), mFeature(aFeature), mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds) + AttributeAccessInterface(MakeOptional(aEndpointId), Id), + CommandHandlerInterface(MakeOptional(aEndpointId), Id), mDelegate(aDelegate), mFeature(aFeature), + mOptionalAttrs(aOptionalAttrs), mOptionalCmds(aOptionalCmds) { /* set the base class delegates endpointId */ mDelegate.SetEndpointId(aEndpointId);