From 46d90980c23f918760dce71d4611738f688953bf Mon Sep 17 00:00:00 2001 From: Nivedita Sarkar Date: Fri, 26 Jul 2024 00:47:03 -0700 Subject: [PATCH 01/63] Add support for Presets attributes and commands to the Thermostat cluster Clean up the Thermostat cluster and remove the TemperatureSetpointHoldPolicy attribute and SetTemperatureSetpointHoldPolicy command --- .../air-purifier-app.matter | 17 +- .../all-clusters-app.matter | 20 +- .../all-clusters-minimal-app.matter | 17 +- ...umiditysensor_thermostat_56de3d5f45.matter | 17 +- ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 17 +- ...tnode_roomairconditioner_9cf3607804.matter | 17 +- .../rootnode_thermostat_bm3fb8dhYi.matter | 17 +- .../placeholder/linux/apps/app1/config.matter | 34 +- .../placeholder/linux/apps/app2/config.matter | 34 +- examples/thermostat/linux/BUILD.gn | 7 + .../linux/include/thermostat-delegate-impl.h | 99 ++ .../linux/include/thermostat-manager.h | 72 ++ examples/thermostat/linux/main.cpp | 16 +- .../linux/thermostat-delegate-impl.cpp | 245 ++++ .../thermostat/linux/thermostat-manager.cpp | 503 ++++++++ .../nxp/zap/thermostat_matter_thread.matter | 17 +- .../nxp/zap/thermostat_matter_wifi.matter | 17 +- .../qpg/zap/thermostaticRadiatorValve.matter | 17 +- .../thermostat-common/thermostat.matter | 28 +- .../thermostat-common/thermostat.zap | 114 +- .../app-templates/endpoint_config.h | 79 +- .../PresetStructWithOwnedMembers.cpp | 153 +++ .../PresetStructWithOwnedMembers.h | 72 ++ .../thermostat-server/thermostat-delegate.h | 127 ++ .../thermostat-server/thermostat-server.cpp | 1139 +++++++++++++++-- .../thermostat-server/thermostat-server.h | 105 ++ .../data-model/chip/thermostat-cluster.xml | 18 +- .../data_model/controller-clusters.matter | 17 +- .../chip/devicecontroller/ChipClusters.java | 49 +- .../devicecontroller/ClusterIDMapping.java | 23 +- .../devicecontroller/ClusterInfoMapping.java | 17 - .../devicecontroller/ClusterReadMapping.java | 11 - .../cluster/clusters/ThermostatCluster.kt | 126 +- .../CHIPAttributeTLVValueDecoder.cpp | 16 - .../python/chip/clusters/CHIPClusters.py | 15 +- .../python/chip/clusters/Objects.py | 47 +- .../MTRAttributeSpecifiedCheck.mm | 3 - .../MTRAttributeTLVValueDecoder.mm | 11 - .../CHIP/zap-generated/MTRBaseClusters.h | 20 +- .../CHIP/zap-generated/MTRBaseClusters.mm | 60 - .../CHIP/zap-generated/MTRClusterConstants.h | 4 +- .../CHIP/zap-generated/MTRClusterNames.mm | 4 - .../CHIP/zap-generated/MTRClusters.h | 3 - .../CHIP/zap-generated/MTRClusters.mm | 32 - .../zap-generated/MTRCommandPayloadsObjc.h | 30 - .../zap-generated/MTRCommandPayloadsObjc.mm | 79 -- .../MTRCommandPayloads_Internal.h | 6 - .../zap-generated/attributes/Accessors.cpp | 50 - .../zap-generated/attributes/Accessors.h | 11 - .../app-common/zap-generated/callback.h | 6 - .../zap-generated/cluster-enums-check.h | 1 + .../app-common/zap-generated/cluster-enums.h | 24 +- .../zap-generated/cluster-objects.cpp | 36 - .../zap-generated/cluster-objects.h | 53 - .../app-common/zap-generated/ids/Attributes.h | 6 +- .../app-common/zap-generated/ids/Commands.h | 4 - .../zap-generated/cluster/Commands.h | 50 +- .../cluster/logging/DataModelLogger.cpp | 5 - .../zap-generated/cluster/Commands.h | 149 +-- 59 files changed, 2648 insertions(+), 1338 deletions(-) create mode 100644 examples/thermostat/linux/include/thermostat-delegate-impl.h create mode 100644 examples/thermostat/linux/include/thermostat-manager.h create mode 100644 examples/thermostat/linux/thermostat-delegate-impl.cpp create mode 100644 examples/thermostat/linux/thermostat-manager.cpp create mode 100644 src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp create mode 100644 src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h create mode 100644 src/app/clusters/thermostat-server/thermostat-delegate.h create mode 100644 src/app/clusters/thermostat-server/thermostat-server.h diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index 4e9d31f7df3b8e..9e3b6da2deaa71 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1277,7 +1277,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1403,11 +1404,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1513,8 +1509,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1558,10 +1553,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1580,8 +1571,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ 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 b8855227a52db1..719f13ce379f84 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 @@ -5006,7 +5006,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -5132,11 +5133,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -5242,8 +5238,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5287,10 +5282,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5309,8 +5300,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ @@ -8598,8 +8587,7 @@ endpoint 1 { callback attribute presets; callback attribute schedules; ram attribute presetsSchedulesEditable; - ram attribute temperatureSetpointHoldPolicy default = 0; - ram attribute setpointHoldExpiryTimestamp; + ram attribute setpointHoldExpiryTimestamp default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 80fd60040a9142..224d37a2a32af1 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -3551,7 +3551,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -3677,11 +3678,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -3787,8 +3783,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -3832,10 +3827,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -3854,8 +3845,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index d56dff0afcf204..1eb8cd15cabcc9 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1200,7 +1200,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1326,11 +1327,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1436,8 +1432,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1481,10 +1476,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1503,8 +1494,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 45bdce794448c0..7ae87d191298b2 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -1557,7 +1557,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1683,11 +1684,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1793,8 +1789,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1838,10 +1833,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1860,8 +1851,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 81770335f21b94..c21a5adf0fdb78 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1140,7 +1140,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1266,11 +1267,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1376,8 +1372,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1421,10 +1416,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1443,8 +1434,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index 6ae0a08d75721a..e76f99dd0e63e7 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1360,7 +1360,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1486,11 +1487,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1596,8 +1592,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1641,10 +1636,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1663,8 +1654,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 2f250369cd3c05..dff3bdb93c0011 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -4797,7 +4797,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -4923,11 +4924,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -5033,8 +5029,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5078,10 +5073,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5100,8 +5091,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring and controlling the functionality of a thermostat. */ @@ -5158,7 +5147,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -5284,11 +5274,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -5394,8 +5379,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5439,10 +5423,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5461,8 +5441,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index a68dc9ce2b63f2..10a4ff89f5285c 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -4754,7 +4754,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -4880,11 +4881,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -4990,8 +4986,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5035,10 +5030,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5057,8 +5048,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring and controlling the functionality of a thermostat. */ @@ -5115,7 +5104,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -5241,11 +5231,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -5351,8 +5336,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5396,10 +5380,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -5418,8 +5398,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index 89d24bff8a0835..d65f6b6648fae9 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -19,7 +19,10 @@ executable("thermostat-app") { sources = [ "include/low-power/LowPowerManager.cpp", "include/low-power/LowPowerManager.h", + "${chip_root}/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp", "main.cpp", + "thermostat-manager.cpp", + "thermostat-delegate-impl.cpp", ] deps = [ @@ -28,6 +31,10 @@ executable("thermostat-app") { "${chip_root}/src/lib", ] + include_dirs = [ + "include" + ] + cflags = [ "-Wconversion" ] output_dir = root_out_dir diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h new file mode 100644 index 00000000000000..3685faef5f1104 --- /dev/null +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -0,0 +1,99 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +/** + * The ThermostatDelegate class serves as the instance delegate for storing Presets related information and providing it to the Thermostat server code. + * It also manages the presets attribute and provides methods to write to presets, edit presets, maintain a pending presets list and either commit the + * presets when requested or discard the changes. It also provide API's to get and set the attribute values. + * + */ + +static constexpr uint8_t kMaxNumberOfPresetTypes = 6; + +// We will support only one preset of each preset type. +static constexpr uint8_t kMaxNumberOfPresetTypesOfEachType = 1; + +class ThermostatDelegate : public Delegate +{ +public: + static inline ThermostatDelegate & GetInstance() { return sInstance; } + + CHIP_ERROR GetPresetTypeAtIndex(size_t index, Structs::PresetTypeStruct::Type & presetType) override; + + uint8_t GetNumberOfPresets() override; + + CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; + + CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) override; + + CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) override; + + CHIP_ERROR AppendToPendingPresetList(const Structs::PresetStruct::Type & preset) override; + + CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; + + CHIP_ERROR ApplyPendingPresets() override; + + void ClearPendingPresetList() override; + +private: + + static ThermostatDelegate sInstance; + + ThermostatDelegate(); + ~ThermostatDelegate() = default; + + ThermostatDelegate(const ThermostatDelegate &) = delete; + ThermostatDelegate & operator=(const ThermostatDelegate &) = delete; + + /** + * @brief Initializes the preset types array with all preset types corresponding to PresetScenarioEnum. + */ + void InitializePresetTypes(); + + /** + * @brief Initializes the presets array with some sample presets for testing. + */ + void InitializePresets(); + + uint8_t mNumberOfPresets; + + Structs::PresetTypeStruct::Type mPresetTypes[kMaxNumberOfPresetTypes]; + PresetStructWithOwnedMembers mPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType]; + PresetStructWithOwnedMembers mPendingPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType]; + + uint8_t mNextFreeIndexInPendingPresetsList; + uint8_t mNextFreeIndexInPresetsList; + + uint8_t mActivePresetHandleData[kPresetHandleSize]; + size_t mActivePresetHandleDataSize; +}; + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/thermostat/linux/include/thermostat-manager.h b/examples/thermostat/linux/include/thermostat-manager.h new file mode 100644 index 00000000000000..3857e465b190fe --- /dev/null +++ b/examples/thermostat/linux/include/thermostat-manager.h @@ -0,0 +1,72 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +class ThermostatManager +{ +public: + CHIP_ERROR Init(); + + /// @brief Callback called when any attribute changed on the device + void AttributeChangeHandler(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, + uint16_t size); + + chip::app::Clusters::Thermostat::SystemModeEnum GetSystemMode(); + chip::app::Clusters::Thermostat::ThermostatRunningModeEnum GetRunningMode(); + int16_t GetCurrentTemperature(); + int16_t GetCurrentHeatingSetPoint(); + int16_t GetCurrentCoolingSetPoint(); + uint8_t GetNumberOfPresets(); + CHIP_ERROR SetSystemMode(chip::app::Clusters::Thermostat::SystemModeEnum systemMode); + CHIP_ERROR SetRunningMode(chip::app::Clusters::Thermostat::ThermostatRunningModeEnum runningMode); + CHIP_ERROR SetCurrentTemperature(int16_t temperature); + CHIP_ERROR SetCurrentHeatingSetPoint(int16_t heatingSetpoint); + CHIP_ERROR SetCurrentCoolingSetPoint(int16_t coolingSetpoint); + +private: + friend ThermostatManager & ThermostatMgr(); + + chip::app::Clusters::Thermostat::SystemModeEnum mSystemMode; + chip::app::Clusters::Thermostat::ThermostatRunningModeEnum mRunningMode; + int16_t mLocalTemperature; + int16_t mOccupiedCoolingSetpoint; + int16_t mOccupiedHeatingSetpoint; + uint8_t mOccupiedSetback; + + static ThermostatManager sThermostatMgr; + + /// @brief attribute handler for the thermostat endpoint + void ThermostatEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, uint16_t size); + void ThermostatClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); + void LocalTemperatureMeasurementEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, + uint16_t size); + void LocalTemperatureMeasurementClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); + + /// @brief Main method that evaluates the current thermostat state and updates attributes + void EvalThermostatState(); + void UpdateRunningModeForHeating(); + void UpdateRunningModeForCooling(); +}; + +inline ThermostatManager & ThermostatMgr() +{ + return ThermostatManager::sThermostatMgr; +} diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp index b9f82696e8ce79..2279f02bef3963 100644 --- a/examples/thermostat/linux/main.cpp +++ b/examples/thermostat/linux/main.cpp @@ -22,6 +22,8 @@ #include #include +#include "thermostat-manager.h" + using namespace chip; using namespace chip::app; // using namespace chip::app::Clusters; @@ -74,7 +76,19 @@ void ApplicationShutdown() {} int main(int argc, char * argv[]) { - VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); + if (ChipLinuxAppInit(argc, argv) != 0) + { + return -1; + } + ChipLogProgress(Zcl, "Starting Thermostat Manager"); + CHIP_ERROR err = ThermostatManager().Init(); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to initialize thermostat manager: %" CHIP_ERROR_FORMAT, err.Format()); + chip::DeviceLayer::PlatformMgr().Shutdown(); + return -1; + } ChipLinuxAppMainLoop(); return 0; } diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp new file mode 100644 index 00000000000000..76e9ee4eec5f6c --- /dev/null +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -0,0 +1,245 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "include/thermostat-delegate-impl.h" + +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Structs; + +ThermostatDelegate ThermostatDelegate::sInstance; + +namespace { + +/** + * @brief Checks if the presets are matching i.e the presetHandles are the same. + * + * @param[in] preset The preset to check. + * @param[in] presetToMatch The preset to match with. + * + * @return true If the presets match, false otherwise. If both preset handles are null, returns false + */ +bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) +{ + return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() + && preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); +} + +} // anonymous namespace + +ThermostatDelegate::ThermostatDelegate() +{ + mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType; + mNextFreeIndexInPresetsList = 0; + mNextFreeIndexInPendingPresetsList = 0; + + InitializePresetTypes(); + InitializePresets(); + + memset(mActivePresetHandleData, 0, kPresetHandleSize); + mActivePresetHandleDataSize = 0; +} + +void ThermostatDelegate::InitializePresetTypes() +{ + PresetScenarioEnum presetScenarioEnumArray[kMaxNumberOfPresetTypes] = { PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied, + PresetScenarioEnum::kSleep, PresetScenarioEnum::kWake, PresetScenarioEnum::kVacation, PresetScenarioEnum::kGoingToSleep }; + static_assert(ArraySize(presetScenarioEnumArray) <= ArraySize(mPresetTypes)); + + uint8_t index = 0; + for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) + { + mPresetTypes[index].presetScenario = presetScenario; + mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetTypesOfEachType; + mPresetTypes[index].presetTypeFeatures = + (presetScenario == PresetScenarioEnum::kOccupied || presetScenario == PresetScenarioEnum::kUnoccupied) ? + PresetTypeFeaturesBitmap::kAutomatic : PresetTypeFeaturesBitmap::kSupportsNames; + index++; + } +} + +void ThermostatDelegate::InitializePresets() +{ + // Initilaize the presets with 2 built in presets - occupied and unoccupied. + PresetScenarioEnum presetScenarioEnumArray[2] = { PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied }; + static_assert(ArraySize(presetScenarioEnumArray) <= ArraySize(mPresets)); + + uint8_t index = 0; + for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) + { + ChipLogDetail(Zcl, "initializing preset for scenario %hhu", presetScenario); + mPresets[index].SetPresetScenario(presetScenario); + + // Set the preset handle to the preset scenario value as a unique id. + const uint8_t handle[] = { static_cast(presetScenario) }; + mPresets[index].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); + mPresets[index].SetName(NullOptional); + int16_t coolingSetpointValue = 2500 + index * 100; + mPresets[index].SetCoolingSetpoint(MakeOptional(coolingSetpointValue)); + + int16_t heatingSetpointValue = 2100 - index * 100; + mPresets[index].SetHeatingSetpoint(MakeOptional(heatingSetpointValue)); + mPresets[index].SetBuiltIn(DataModel::MakeNullable(true)); + index++; + } + + // Set the value of the next free index in the presets list. + mNextFreeIndexInPresetsList = index; +} + +CHIP_ERROR ThermostatDelegate::GetPresetTypeAtIndex(size_t index, PresetTypeStruct::Type & presetType) +{ + if (index < ArraySize(mPresetTypes)) + { + presetType = mPresetTypes[index]; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +uint8_t ThermostatDelegate::GetNumberOfPresets() +{ + return mNumberOfPresets; +} + +CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, + PresetStructWithOwnedMembers & preset) +{ + if (index < mNextFreeIndexInPresetsList) + { + preset = mPresets[index]; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(MutableByteSpan & activePresetHandle) +{ + if (mActivePresetHandleDataSize > 0) + { + ByteSpan presetHandleSpan(mActivePresetHandleData, mActivePresetHandleDataSize); + CopySpanToMutableSpan(presetHandleSpan, activePresetHandle); + } + else + { + activePresetHandle.reduce_size(0); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) +{ + if (!newActivePresetHandle.IsNull()) + { + size_t newActivePresetHandleSize = newActivePresetHandle.Value().size(); + if (newActivePresetHandleSize > kPresetHandleSize) + { + ChipLogError(NotSpecified, + "Failed to set ActivePresetHandle. newActivePresetHandle size %ld is larger than preset handle size %ld", + newActivePresetHandleSize, kPresetHandleSize); + return CHIP_ERROR_NO_MEMORY; + } + memcpy(mActivePresetHandleData, newActivePresetHandle.Value().data(), newActivePresetHandleSize); + mActivePresetHandleDataSize = newActivePresetHandleSize; + ChipLogDetail(NotSpecified, "Set ActivePresetHandle to "); + ChipLogByteSpan(NotSpecified, newActivePresetHandle.Value()); + } + else + { + memset(mActivePresetHandleData, 0, kPresetHandleSize); + mActivePresetHandleDataSize = 0; + ChipLogDetail(NotSpecified, "Clear ActivePresetHandle"); + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThermostatDelegate::AppendToPendingPresetList(const PresetStruct::Type & preset) +{ + if (mNextFreeIndexInPendingPresetsList < ArraySize(mPendingPresets)) + { + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetScenario(preset.presetScenario); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(preset.presetHandle); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetName(preset.name); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetCoolingSetpoint(preset.coolingSetpoint); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetHeatingSetpoint(preset.heatingSetpoint); + if (!preset.builtIn.IsNull()) + { + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(preset.builtIn); + } + else + { + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(NullOptional); + } + mNextFreeIndexInPendingPresetsList++; + return CHIP_NO_ERROR; + } else { + return CHIP_ERROR_WRITE_FAILED; + } +} + +CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) +{ + if (index < mNextFreeIndexInPendingPresetsList) + { + preset = mPendingPresets[index]; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() + { + for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) + { + const PresetStructWithOwnedMembers & pendingPreset = mPendingPresets[indexInPendingPresets]; + + bool found = false; + for (uint8_t indexInPresets = 0; indexInPresets < mNextFreeIndexInPresetsList; indexInPresets++) + { + if (PresetHandlesExistAndMatch(mPresets[indexInPresets], pendingPreset)) + { + found = true; + + // Replace the preset with the pending preset + mPresets[indexInPresets] = pendingPreset; + } + } + + // If pending preset was not found in the Presets list, append to the Presets list. + if (!found) + { + + mPresets[mNextFreeIndexInPresetsList] = pendingPreset; + + const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; + mPresets[mNextFreeIndexInPresetsList].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); + mNextFreeIndexInPresetsList++; + } + } + return CHIP_NO_ERROR; +} + +void ThermostatDelegate::ClearPendingPresetList() +{ + mNextFreeIndexInPendingPresetsList = 0; +} diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp new file mode 100644 index 00000000000000..7dd9437229aae9 --- /dev/null +++ b/examples/thermostat/linux/thermostat-manager.cpp @@ -0,0 +1,503 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/********************************************************** + * Includes + *********************************************************/ + +#include "include/thermostat-delegate-impl.h" +#include "include/thermostat-manager.h" + +#include +#include +#include +#include + +/********************************************************** + * Defines and Constants + *********************************************************/ + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::Controller; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Structs; +using namespace chip::app::Clusters::Thermostat::Attributes; +using namespace chip::app::Clusters::TemperatureMeasurement; +using namespace chip::app::Clusters::TemperatureMeasurement::Attributes; + +using namespace chip::DeviceLayer; + +static constexpr EndpointId kThermostatEndpoint = 1; + +static constexpr uint16_t kMaxIntervalCeilingSeconds = 3600; + +static const char * SystemModeString(SystemModeEnum systemMode); +static const char * RunningModeString(ThermostatRunningModeEnum runningMode); + +/********************************************************** + * Variable declarations + *********************************************************/ + +ThermostatManager ThermostatManager::sThermostatMgr; + +namespace { + +template + static void OnAttributeChangeReported(const ConcreteDataAttributePath & path, const DecodableAttributeType & value); + + +template<> +void OnAttributeChangeReported(const ConcreteDataAttributePath & path, + const MeasuredValue::TypeInfo::DecodableType & value) +{ + ClusterId clusterId = path.mClusterId; + if (clusterId != TemperatureMeasurement::Id) { + ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id %u", clusterId); + return; + } + + AttributeId attributeId = path.mAttributeId; + if (attributeId != MeasuredValue::Id) { + ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute %u", attributeId); + return; + } + + if (!value.IsNull()) + { + ChipLogDetail(AppServer, "Attribute change reported for TemperatureMeasurement cluster - MeasuredValue is %d", static_cast(value.Value())); + } +} + +static void OnError(const ConcreteDataAttributePath * path, ChipError err) { + ChipLogError(AppServer, "Subscribing to cluster Id %u and attribute Id %u failed with error %" CHIP_ERROR_FORMAT, path->mClusterId, + path->mAttributeId, err.Format()); +} + +static void OnSubscriptionEstablished(const ReadClient & client, unsigned int value) +{ + ChipLogDetail(AppServer, "OnSubscriptionEstablished with subscription Id: %d", value); +} + +template +void SubscribeToAttribute(ClusterId clusterId, AttributeId attributeId, const EmberBindingTableEntry & binding, + OperationalDeviceProxy * peer_device) +{ + VerifyOrReturn(peer_device->GetSecureSession().HasValue(), ChipLogError(AppServer, "SubscribeToAttribute failed. Secure session is null")); + + SubscribeAttribute(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, clusterId, + attributeId, &OnAttributeChangeReported, &OnError, 0, kMaxIntervalCeilingSeconds, &OnSubscriptionEstablished, nullptr, true /* fabricFiltered */, true /* keepExistingSubscription */); +} + +static void ThermostatBoundDeviceChangedHandler(const EmberBindingTableEntry & binding, + OperationalDeviceProxy * peer_device, void * context) +{ + VerifyOrReturn(binding.clusterId.has_value(), ChipLogError(AppServer, "Cluster Id is null")); + ClusterId clusterId = binding.clusterId.value(); + + switch (clusterId) + { + case TemperatureMeasurement::Id: + + // Subscribe to the MeasuredValue attribute + SubscribeToAttribute(clusterId, MeasuredValue::Id, binding, peer_device); + break; + default: + ChipLogError(AppServer, "Unsupported Cluster Id"); + break; + } +} + +void NotifyBoundClusterChangedForAllClusters() +{ + BindingManager::GetInstance().NotifyBoundClusterChanged(kThermostatEndpoint, TemperatureMeasurement::Id, nullptr); +} + +static void OnPlatformChipDeviceEvent(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) +{ + if (event->Type == DeviceLayer::DeviceEventType::kBindingsChangedViaCluster) + { + NotifyBoundClusterChangedForAllClusters(); + } +} + +void InitBindingManager(intptr_t context) +{ + auto & server = Server::GetInstance(); + CHIP_ERROR error = BindingManager::GetInstance().Init( + { &server.GetFabricTable(), server.GetCASESessionManager(), &server.GetPersistentStorage() }); + + if (error != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to init binding manager"); + } + + BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(ThermostatBoundDeviceChangedHandler); + NotifyBoundClusterChangedForAllClusters(); +} + +} // anonymous namespace + +CHIP_ERROR ThermostatManager::Init() +{ + // Init binding manager + + DeviceLayer::PlatformMgr().AddEventHandler(OnPlatformChipDeviceEvent, reinterpret_cast(this)); + DeviceLayer::PlatformMgr().ScheduleWork(InitBindingManager); + + PlatformMgr().LockChipStack(); + mLocalTemperature = GetCurrentTemperature(); + mSystemMode = GetSystemMode(); + mRunningMode = GetRunningMode(); + mOccupiedCoolingSetpoint = GetCurrentCoolingSetPoint(); + mOccupiedHeatingSetpoint = GetCurrentHeatingSetPoint(); + // TODO: Gotta expose this properly on attribute + mOccupiedSetback = 5; // 0.5 C + + PlatformMgr().UnlockChipStack(); + + ChipLogError(AppServer, + "Initialized a thermostat with \n " + "mSystemMode: %hhu (%s) \n mRunningMode: %hhu (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " + "mOccupiedCoolingSetpoint: %d" "NumberOfPresets: %d", + mSystemMode, SystemModeString(mSystemMode), mRunningMode, RunningModeString(mRunningMode), mLocalTemperature, + mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, GetNumberOfPresets()); + + // TODO: Should this be called later? + EvalThermostatState(); + + return CHIP_NO_ERROR; +} + +void ThermostatManager::AttributeChangeHandler(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint16_t size) +{ + switch (endpointId) + { + case kThermostatEndpoint: + ThermostatEndpointAttributeChangeHandler(clusterId, attributeId, value, size); + break; + + default: + ChipLogError(AppServer, "Attribute change reported for Thermostat on incorrect endpoint. Ignoring."); + break; + } +} + + +void ThermostatManager::ThermostatEndpointAttributeChangeHandler(ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint16_t size) +{ + switch (clusterId) + { + case Thermostat::Id: + ThermostatClusterAttributeChangeHandler(attributeId, value, size); + break; + + default: + ChipLogError(AppServer, "Attribute change reported for Thermostat on incorrect cluster for the thermostat endpoint. Ignoring."); + break; + } +} + +void ThermostatManager::ThermostatClusterAttributeChangeHandler(AttributeId attributeId, uint8_t * value, uint16_t size) +{ + switch (attributeId) + { + case LocalTemperature::Id: { + mLocalTemperature = static_cast(Encoding::LittleEndian::Get16(value)); + ChipLogError(AppServer, "Local temperature changed to %d", mLocalTemperature); + EvalThermostatState(); + } + break; + + case OccupiedCoolingSetpoint::Id: { + mOccupiedCoolingSetpoint = static_cast(Encoding::LittleEndian::Get16(value)); + ChipLogError(AppServer, "Cooling temperature changed to %d", mOccupiedCoolingSetpoint); + EvalThermostatState(); + } + break; + + case OccupiedHeatingSetpoint::Id: { + mOccupiedHeatingSetpoint = static_cast(Encoding::LittleEndian::Get16(value)); + ChipLogError(AppServer, "Heating temperature changed to %d", mOccupiedHeatingSetpoint); + EvalThermostatState(); + } + break; + + case SystemMode::Id: { + mSystemMode = static_cast(*value); + ChipLogError(AppServer, "System mode changed to %hhu (%s)", mSystemMode, SystemModeString(mSystemMode)); + EvalThermostatState(); + } + break; + + case ThermostatRunningMode::Id: { + mRunningMode = static_cast(*value); + ChipLogError(AppServer, "Running mode changed to %hhu (%s)", mRunningMode, RunningModeString(mRunningMode)); + } + break; + + default: { + ChipLogError(AppServer, "Unhandled thermostat attribute %x", attributeId); + return; + } + break; + } +} + +SystemModeEnum ThermostatManager::GetSystemMode() +{ + SystemModeEnum systemMode; + SystemMode::Get(kThermostatEndpoint, &systemMode); + return static_cast(systemMode); +} + +ThermostatRunningModeEnum ThermostatManager::GetRunningMode() +{ + ThermostatRunningModeEnum runningMode; + ThermostatRunningMode::Get(kThermostatEndpoint, &runningMode); + return static_cast(runningMode); +} + +int16_t ThermostatManager::GetCurrentTemperature() +{ + DataModel::Nullable currentTemperature; + currentTemperature.SetNull(); + LocalTemperature::Get(kThermostatEndpoint, currentTemperature); + return (!currentTemperature.IsNull()) ? currentTemperature.Value() : 0; +} + +int16_t ThermostatManager::GetCurrentHeatingSetPoint() +{ + int16_t heatingSetpoint; + OccupiedHeatingSetpoint::Get(kThermostatEndpoint, &heatingSetpoint); + return heatingSetpoint; +} + +int16_t ThermostatManager::GetCurrentCoolingSetPoint() +{ + int16_t coolingSetpoint; + OccupiedCoolingSetpoint::Get(kThermostatEndpoint, &coolingSetpoint); + return coolingSetpoint; +} + +uint8_t ThermostatManager::GetNumberOfPresets() +{ + return ThermostatDelegate::GetInstance().GetNumberOfPresets(); +} + +CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode) +{ + if (mSystemMode == systemMode) + { + ChipLogDetail(AppServer, "Already in system mode: %hhu (%s)", systemMode, SystemModeString(systemMode)); + return CHIP_NO_ERROR; + } + + ChipLogError(AppServer, "Setting system mode: %hhu (%s)", systemMode, SystemModeString(systemMode)); + Protocols::InteractionModel::Status status = SystemMode::Set(kThermostatEndpoint, systemMode); + + // TODO: CHIP_ERROR_WRITE_FAILED might not be the best error code to send + return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; +} + +CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMode) +{ + if (mRunningMode == runningMode) + { + ChipLogDetail(AppServer, "Already in running mode: %hhu (%s)", runningMode, RunningModeString(runningMode)); + return CHIP_NO_ERROR; + } + + ChipLogError(AppServer, "Setting running mode: %hhu (%s)", runningMode, RunningModeString(runningMode)); + Protocols::InteractionModel::Status status = ThermostatRunningMode::Set(kThermostatEndpoint, runningMode); + + // TODO: CHIP_ERROR_WRITE_FAILED might not be the best error code to send + return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; +} + +CHIP_ERROR ThermostatManager::SetCurrentTemperature(int16_t temperature) +{ + Protocols::InteractionModel::Status status = LocalTemperature::Set(kThermostatEndpoint, temperature); + return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; +} + +CHIP_ERROR ThermostatManager::SetCurrentHeatingSetPoint(int16_t heatingSetpoint) +{ + Protocols::InteractionModel::Status status = OccupiedHeatingSetpoint::Set(kThermostatEndpoint, heatingSetpoint); + return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; +} + +CHIP_ERROR ThermostatManager::SetCurrentCoolingSetPoint(int16_t coolingSetpoint) +{ + Protocols::InteractionModel::Status status = OccupiedCoolingSetpoint::Set(kThermostatEndpoint, coolingSetpoint); + return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; +} + +void ThermostatManager::EvalThermostatState() +{ + ChipLogError(AppServer, + "Eval Thermostat Running Mode \n " + "mSystemMode: %hhu (%s) \n mRunningMode: %hhu (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " + "mOccupiedCoolingSetpoint: %d", + mSystemMode, SystemModeString(mSystemMode), mRunningMode, RunningModeString(mRunningMode), mLocalTemperature, + mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint); + + switch (static_cast(mSystemMode)) + { + case SystemModeEnum::kOff: { + SetRunningMode(ThermostatRunningModeEnum::kOff); + break; + } + case SystemModeEnum::kHeat: { + UpdateRunningModeForHeating(); + break; + } + case SystemModeEnum::kCool: { + UpdateRunningModeForCooling(); + break; + } + case SystemModeEnum::kAuto: { + UpdateRunningModeForHeating(); + UpdateRunningModeForCooling(); + break; + } + default: + break; + } +} + +void ThermostatManager::UpdateRunningModeForHeating() +{ + const int16_t heatingOnThreshold = mOccupiedHeatingSetpoint - mOccupiedSetback * 10; + const int16_t heatingOffThreshold = mOccupiedHeatingSetpoint + mOccupiedSetback * 10; + + if (mRunningMode == ThermostatRunningModeEnum::kHeat) + { + if (mLocalTemperature >= heatingOffThreshold) + { + ChipLogDetail(AppServer, "Eval Heat - Turning off"); + SetRunningMode(ThermostatRunningModeEnum::kOff); + } + else + { + ChipLogDetail(AppServer, "Eval Heat - Keep Heating"); + } + } + else + { + if (mLocalTemperature <= heatingOnThreshold) + { + ChipLogDetail(AppServer, "Eval Heat - Turn on"); + SetRunningMode(ThermostatRunningModeEnum::kHeat); + } + else + { + ChipLogDetail(AppServer, "Eval Heat - Nothing to do"); + } + } +} + +void ThermostatManager::UpdateRunningModeForCooling() +{ + const int16_t coolingOffThreshold = mOccupiedCoolingSetpoint - mOccupiedSetback * 10; + const int16_t coolingOnThreshold = mOccupiedCoolingSetpoint + mOccupiedSetback * 10; + + if (mRunningMode == ThermostatRunningModeEnum::kCool) + { + if (mLocalTemperature <= coolingOffThreshold) + { + ChipLogDetail(AppServer, "Eval Cool - Turning off"); + SetRunningMode(ThermostatRunningModeEnum::kOff); + } + else + { + ChipLogDetail(AppServer, "Eval Cool - Keep Cooling"); + } + } + else + { + if (mLocalTemperature >= coolingOnThreshold) + { + ChipLogDetail(AppServer, "Eval Cool - Turn on"); + SetRunningMode(ThermostatRunningModeEnum::kCool); + } + else + { + ChipLogDetail(AppServer, "Eval Cool - Nothing to do"); + } + } +} + +static const char * SystemModeString(SystemModeEnum systemMode) +{ + switch (systemMode) + { + case SystemModeEnum::kOff: + return "Off"; + case SystemModeEnum::kAuto: + return "Auto"; + case SystemModeEnum::kCool: + return "Cool"; + case SystemModeEnum::kHeat: + return "Heat"; + default: + return "Unknown"; + } +} + +static const char * RunningModeString(ThermostatRunningModeEnum runningMode) +{ + switch (runningMode) + { + case ThermostatRunningModeEnum::kOff: + return "Off"; + case ThermostatRunningModeEnum::kCool: + return "Cool"; + case ThermostatRunningModeEnum::kHeat: + return "Heat"; + default: + return "Unknown"; + } +} + +void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, + uint8_t * value) +{ + ClusterId clusterId = attributePath.mClusterId; + AttributeId attributeId = attributePath.mAttributeId; + ChipLogProgress(AppServer, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + + ChipLogProgress(AppServer, "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: %d Type: %u Value: %u, length %u", + ChipLogValueMEI(attributeId), attributePath.mEndpointId, clusterId, type, *value, size); + + ThermostatMgr().AttributeChangeHandler(attributePath.mEndpointId, clusterId, attributeId, value, size); +} + +void emberAfThermostatClusterInitCallback(EndpointId endpoint) +{ + // Register the delegate for the Thermostat + auto & delegate = ThermostatDelegate::GetInstance(); + + // Set the default delegate for endpoint kThermostatEndpoint. + VerifyOrDie(endpoint == kThermostatEndpoint); + SetDefaultDelegate(endpoint, &delegate); +} diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 43cae6aee44148..8a0304c57b1e13 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -1951,7 +1951,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -2077,11 +2078,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -2187,8 +2183,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2232,10 +2227,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -2254,8 +2245,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } endpoint 0 { diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 356347c1e7bf02..3d823c4fb62a85 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -1862,7 +1862,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1988,11 +1989,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -2098,8 +2094,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2143,10 +2138,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -2165,8 +2156,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } endpoint 0 { diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index 7d90277b06091e..6f8adc8f2cf3f6 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -1559,7 +1559,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1685,11 +1686,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1795,8 +1791,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1840,10 +1835,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -1862,8 +1853,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 3246155268aca9..9209bdff98df28 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -1739,7 +1739,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -1865,11 +1866,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -1975,8 +1971,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2020,10 +2015,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -2042,8 +2033,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ @@ -2488,13 +2477,22 @@ endpoint 1 { ram attribute minSetpointDeadBand default = 0x19; ram attribute controlSequenceOfOperation default = 0x04; persist attribute systemMode default = 0x01; + callback attribute presetTypes; + ram attribute numberOfPresets default = 0; + ram attribute activePresetHandle; + callback attribute presets; + ram attribute presetsSchedulesEditable; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 0x23; + ram attribute featureMap default = 0x123; ram attribute clusterRevision default = 6; handle command SetpointRaiseLower; + handle command SetActivePresetRequest; + handle command StartPresetsSchedulesEditRequest; + handle command CancelPresetsSchedulesEditRequest; + handle command CommitPresetsSchedulesRequest; } server cluster ThermostatUserInterfaceConfiguration { diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 288a84a921636c..483b79d7d434f5 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -4659,6 +4659,38 @@ "source": "client", "isIncoming": 1, "isEnabled": 1 + }, + { + "name": "SetActivePresetRequest", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StartPresetsSchedulesEditRequest", + "code": 7, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CancelPresetsSchedulesEditRequest", + "code": 8, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CommitPresetsSchedulesRequest", + "code": 9, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 } ], "attributes": [ @@ -4886,6 +4918,86 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "PresetTypes", + "code": 72, + "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": "NumberOfPresets", + "code": 74, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActivePresetHandle", + "code": 78, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Presets", + "code": 80, + "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": "PresetsSchedulesEditable", + "code": 82, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -4944,7 +5056,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x23", + "defaultValue": "0x123", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index f2c082b1d0d4a1..c60950077fb372 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -355,7 +355,7 @@ } // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 1056 +#define GENERATED_ATTRIBUTE_COUNT 1055 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1400,8 +1400,7 @@ { ZAP_EMPTY_DEFAULT(), 0x00000051, 0, ZAP_TYPE(ARRAY), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* Schedules */ \ { ZAP_EMPTY_DEFAULT(), 0x00000052, 1, ZAP_TYPE(BOOLEAN), 0 }, /* PresetsSchedulesEditable */ \ - { ZAP_SIMPLE_DEFAULT(0), 0x00000053, 1, ZAP_TYPE(BITMAP8), 0 }, /* TemperatureSetpointHoldPolicy */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000054, 4, ZAP_TYPE(EPOCH_S), \ + { ZAP_SIMPLE_DEFAULT(0), 0x00000053, 4, ZAP_TYPE(EPOCH_S), \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* SetpointHoldExpiryTimestamp */ \ { ZAP_SIMPLE_DEFAULT(0x0023), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ @@ -3749,8 +3748,8 @@ /* Endpoint: 1, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ .attributes = ZAP_ATTRIBUTE_INDEX(616), \ - .attributeCount = 28, \ - .clusterSize = 74, \ + .attributeCount = 27, \ + .clusterSize = 73, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ), \ @@ -3761,7 +3760,7 @@ { \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ .clusterId = 0x00000202, \ - .attributes = ZAP_ATTRIBUTE_INDEX(644), \ + .attributes = ZAP_ATTRIBUTE_INDEX(643), \ .attributeCount = 14, \ .clusterSize = 18, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -3774,7 +3773,7 @@ { \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ .clusterId = 0x00000204, \ - .attributes = ZAP_ATTRIBUTE_INDEX(658), \ + .attributes = ZAP_ATTRIBUTE_INDEX(657), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -3787,7 +3786,7 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(663), \ + .attributes = ZAP_ATTRIBUTE_INDEX(662), \ .attributeCount = 54, \ .clusterSize = 345, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -3800,7 +3799,7 @@ { \ /* Endpoint: 1, Cluster: Ballast Configuration (server) */ \ .clusterId = 0x00000301, \ - .attributes = ZAP_ATTRIBUTE_INDEX(717), \ + .attributes = ZAP_ATTRIBUTE_INDEX(716), \ .attributeCount = 16, \ .clusterSize = 58, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3813,7 +3812,7 @@ { \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ .clusterId = 0x00000400, \ - .attributes = ZAP_ATTRIBUTE_INDEX(733), \ + .attributes = ZAP_ATTRIBUTE_INDEX(732), \ .attributeCount = 7, \ .clusterSize = 15, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3826,7 +3825,7 @@ { \ /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(740), \ + .attributes = ZAP_ATTRIBUTE_INDEX(739), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3839,7 +3838,7 @@ { \ /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ .clusterId = 0x00000403, \ - .attributes = ZAP_ATTRIBUTE_INDEX(746), \ + .attributes = ZAP_ATTRIBUTE_INDEX(745), \ .attributeCount = 5, \ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3852,7 +3851,7 @@ { \ /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ .clusterId = 0x00000404, \ - .attributes = ZAP_ATTRIBUTE_INDEX(751), \ + .attributes = ZAP_ATTRIBUTE_INDEX(750), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3865,7 +3864,7 @@ { \ /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ .clusterId = 0x00000405, \ - .attributes = ZAP_ATTRIBUTE_INDEX(757), \ + .attributes = ZAP_ATTRIBUTE_INDEX(756), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3878,7 +3877,7 @@ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(763), \ + .attributes = ZAP_ATTRIBUTE_INDEX(762), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -3891,7 +3890,7 @@ { \ /* Endpoint: 1, Cluster: Carbon Monoxide Concentration Measurement (server) */ \ .clusterId = 0x0000040C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(768), \ + .attributes = ZAP_ATTRIBUTE_INDEX(767), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3904,7 +3903,7 @@ { \ /* Endpoint: 1, Cluster: Carbon Dioxide Concentration Measurement (server) */ \ .clusterId = 0x0000040D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(781), \ + .attributes = ZAP_ATTRIBUTE_INDEX(780), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3917,7 +3916,7 @@ { \ /* Endpoint: 1, Cluster: Nitrogen Dioxide Concentration Measurement (server) */ \ .clusterId = 0x00000413, \ - .attributes = ZAP_ATTRIBUTE_INDEX(794), \ + .attributes = ZAP_ATTRIBUTE_INDEX(793), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3930,7 +3929,7 @@ { \ /* Endpoint: 1, Cluster: Ozone Concentration Measurement (server) */ \ .clusterId = 0x00000415, \ - .attributes = ZAP_ATTRIBUTE_INDEX(807), \ + .attributes = ZAP_ATTRIBUTE_INDEX(806), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3943,7 +3942,7 @@ { \ /* Endpoint: 1, Cluster: PM2.5 Concentration Measurement (server) */ \ .clusterId = 0x0000042A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(820), \ + .attributes = ZAP_ATTRIBUTE_INDEX(819), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3956,7 +3955,7 @@ { \ /* Endpoint: 1, Cluster: Formaldehyde Concentration Measurement (server) */ \ .clusterId = 0x0000042B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(833), \ + .attributes = ZAP_ATTRIBUTE_INDEX(832), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3969,7 +3968,7 @@ { \ /* Endpoint: 1, Cluster: PM1 Concentration Measurement (server) */ \ .clusterId = 0x0000042C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(846), \ + .attributes = ZAP_ATTRIBUTE_INDEX(845), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3982,7 +3981,7 @@ { \ /* Endpoint: 1, Cluster: PM10 Concentration Measurement (server) */ \ .clusterId = 0x0000042D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(859), \ + .attributes = ZAP_ATTRIBUTE_INDEX(858), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3995,7 +3994,7 @@ { \ /* Endpoint: 1, Cluster: Total Volatile Organic Compounds Concentration Measurement (server) */ \ .clusterId = 0x0000042E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(872), \ + .attributes = ZAP_ATTRIBUTE_INDEX(871), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4008,7 +4007,7 @@ { \ /* Endpoint: 1, Cluster: Radon Concentration Measurement (server) */ \ .clusterId = 0x0000042F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(885), \ + .attributes = ZAP_ATTRIBUTE_INDEX(884), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4021,7 +4020,7 @@ { \ /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ .clusterId = 0x00000503, \ - .attributes = ZAP_ATTRIBUTE_INDEX(898), \ + .attributes = ZAP_ATTRIBUTE_INDEX(897), \ .attributeCount = 3, \ .clusterSize = 19, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4034,7 +4033,7 @@ { \ /* Endpoint: 1, Cluster: Low Power (server) */ \ .clusterId = 0x00000508, \ - .attributes = ZAP_ATTRIBUTE_INDEX(901), \ + .attributes = ZAP_ATTRIBUTE_INDEX(900), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4047,7 +4046,7 @@ { \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ .clusterId = 0x00000B04, \ - .attributes = ZAP_ATTRIBUTE_INDEX(903), \ + .attributes = ZAP_ATTRIBUTE_INDEX(902), \ .attributeCount = 13, \ .clusterSize = 32, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4060,7 +4059,7 @@ { \ /* Endpoint: 1, Cluster: Unit Testing (server) */ \ .clusterId = 0xFFF1FC05, \ - .attributes = ZAP_ATTRIBUTE_INDEX(916), \ + .attributes = ZAP_ATTRIBUTE_INDEX(915), \ .attributeCount = 84, \ .clusterSize = 2290, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4073,7 +4072,7 @@ { \ /* Endpoint: 2, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1000), \ + .attributes = ZAP_ATTRIBUTE_INDEX(999), \ .attributeCount = 4, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -4086,7 +4085,7 @@ { \ /* Endpoint: 2, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1004), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1003), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -4099,7 +4098,7 @@ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1007), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1006), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -4112,7 +4111,7 @@ { \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1014), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1013), \ .attributeCount = 7, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4125,7 +4124,7 @@ { \ /* Endpoint: 2, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1021), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1020), \ .attributeCount = 9, \ .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4138,7 +4137,7 @@ { \ /* Endpoint: 2, Cluster: Scenes Management (server) */ \ .clusterId = 0x00000062, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1030), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1029), \ .attributeCount = 5, \ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -4151,7 +4150,7 @@ { \ /* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1035), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1034), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -4164,7 +4163,7 @@ { \ /* Endpoint: 65534, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1040), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1039), \ .attributeCount = 6, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4177,7 +4176,7 @@ { \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1046), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1045), \ .attributeCount = 10, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4196,7 +4195,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 29, 349 }, { ZAP_CLUSTER_INDEX(29), 74, 3523 }, { ZAP_CLUSTER_INDEX(103), 7, 126 }, \ + { ZAP_CLUSTER_INDEX(0), 29, 349 }, { ZAP_CLUSTER_INDEX(29), 74, 3522 }, { ZAP_CLUSTER_INDEX(103), 7, 126 }, \ { ZAP_CLUSTER_INDEX(110), 2, 0 }, \ } @@ -4209,7 +4208,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (36) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3998) +#define ATTRIBUTE_MAX_SIZE (3997) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (4) diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp new file mode 100644 index 00000000000000..eb7adbc3d865fe --- /dev/null +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -0,0 +1,153 @@ +/** + * + * Copyright (c) 2024 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 "PresetStructWithOwnedMembers.h" + +using namespace chip; +using namespace chip::app; +using namespace DataModel; +using namespace chip::app::Clusters::Thermostat::Structs; + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +PresetStructWithOwnedMembers::PresetStructWithOwnedMembers(const PresetStruct::Type & other) +{ + *this = other; +} + +void PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) +{ + SetPresetScenario(other.presetScenario); + CHIP_ERROR err = SetPresetHandle(other.presetHandle); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Failed to set Preset handle with err %" CHIP_ERROR_FORMAT, err.Format()); + } + err = SetName(other.name); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Failed to set Preset name with err %" CHIP_ERROR_FORMAT, err.Format()); + } + SetCoolingSetpoint(other.coolingSetpoint); + SetHeatingSetpoint(other.heatingSetpoint); + SetBuiltIn(other.builtIn); +} + +void PresetStructWithOwnedMembers::SetPresetScenario(PresetScenarioEnum enumValue) +{ + presetScenario = enumValue; +} + +CHIP_ERROR PresetStructWithOwnedMembers::SetPresetHandle(const Nullable & newPresetHandle) +{ + if (!newPresetHandle.IsNull()) + { + size_t newPresetHandleSize = newPresetHandle.Value().size(); + if (newPresetHandleSize > kPresetHandleSize) + { + ChipLogError(Zcl, "Failed to set Preset handle. New preset handle size (%ld) > allowed preset handle size (%ld)", newPresetHandleSize, kPresetNameSize); + return CHIP_ERROR_NO_MEMORY; + } + MutableByteSpan targetSpan(presetHandleData); + ReturnErrorOnFailure(CopySpanToMutableSpan(newPresetHandle.Value(), targetSpan)); + presetHandle.SetNonNull(targetSpan); + } + else + { + presetHandle.SetNull(); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PresetStructWithOwnedMembers::SetName(const Optional> & newName) +{ + if (newName.HasValue() && !newName.Value().IsNull()) + { + size_t newNameSize = newName.Value().Value().size(); + if (newNameSize > kPresetNameSize) + { + ChipLogError(Zcl, "Failed to set Preset name. New name size (%ld) > allowed preset name size (%ld)", newNameSize, kPresetNameSize); + return CHIP_ERROR_NO_MEMORY; + } + MutableCharSpan targetSpan(presetNameData); + CharSpan newNameSpan = newName.Value().Value(); + ReturnErrorOnFailure(CopyCharSpanToMutableCharSpan(newNameSpan, targetSpan)); + + DataModel::Nullable nullableCharSpan; + nullableCharSpan.SetNonNull(targetSpan); + name.SetValue(nullableCharSpan); + } + else + { + name.ClearValue(); + } + return CHIP_NO_ERROR; +} + +void PresetStructWithOwnedMembers::SetCoolingSetpoint(const Optional & newCoolingSetpoint) +{ + coolingSetpoint = newCoolingSetpoint; +} + +void PresetStructWithOwnedMembers::SetHeatingSetpoint(const Optional & newHeatingSetpoint) +{ + heatingSetpoint = newHeatingSetpoint; +} + +void PresetStructWithOwnedMembers::SetBuiltIn(DataModel::Nullable newBuiltIn) +{ + builtIn = newBuiltIn; +} + +PresetScenarioEnum PresetStructWithOwnedMembers::GetPresetScenario() const +{ + return presetScenario; +} + +DataModel::Nullable PresetStructWithOwnedMembers::GetPresetHandle() const +{ + return presetHandle; +} + +Optional> PresetStructWithOwnedMembers::GetName() const +{ + return name; +} + +Optional PresetStructWithOwnedMembers::GetCoolingSetpoint() const +{ + return coolingSetpoint; +} + +Optional PresetStructWithOwnedMembers::GetHeatingSetpoint() const +{ + return heatingSetpoint; +} + +DataModel::Nullable PresetStructWithOwnedMembers::GetBuiltIn() const +{ + return builtIn; +} + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h new file mode 100644 index 00000000000000..9fc7f5cc3bc77c --- /dev/null +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h @@ -0,0 +1,72 @@ +/** + * + * Copyright (c) 2024 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 + * @brief This class has a struct PresetStructWithOwnedMembers that inherits from + * Structs::PresetStruct::Type and manages the storage of the preset handle + * member which it owns. + * + ******************************************************************************* + ******************************************************************************/ + +#pragma once + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +static constexpr size_t kPresetHandleSize = 16; + +static constexpr size_t kPresetNameSize = 64; + +struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type +{ +public: + PresetStructWithOwnedMembers() = default; + PresetStructWithOwnedMembers(const Structs::PresetStruct::Type & other); + void operator=(const Structs::PresetStruct::Type & other); + + void SetPresetScenario(PresetScenarioEnum enumValue); + CHIP_ERROR SetPresetHandle(const DataModel::Nullable & newPresetHandle); + CHIP_ERROR SetName(const Optional> & newName); + void SetCoolingSetpoint(const Optional & newCoolingSetpoint); + void SetHeatingSetpoint(const Optional & newHeatingSetpoint); + void SetBuiltIn(DataModel::Nullable newBuiltIn); + + PresetScenarioEnum GetPresetScenario() const; + DataModel::Nullable GetPresetHandle() const; + Optional> GetName() const; + Optional GetCoolingSetpoint() const; + Optional GetHeatingSetpoint() const; + DataModel::Nullable GetBuiltIn() const; + + using Structs::PresetStruct::Type::Encode; + using Structs::PresetStruct::Type::kIsFabricScoped; + +private: + uint8_t presetHandleData[kPresetHandleSize] = { 0 }; + char presetNameData[kPresetNameSize]; +}; + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h new file mode 100644 index 00000000000000..5a2a2055c18f2d --- /dev/null +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -0,0 +1,127 @@ +/** + * + * Copyright (c) 2024 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 "PresetStructWithOwnedMembers.h" +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +/** @brief + * Defines methods for implementing application-specific logic for the extensions to the thermostat cluster. + * It defines the interfaces that a thermostat should implement to support Presets and other extension features. + */ +class Delegate +{ +public: + Delegate() = default; + + virtual ~Delegate() = default; + + /** + * @brief Get the preset type at a given index in the PresetTypes attribute + * + * @param[in] index The index of the preset type in the list. + * @param[out] presetType The preset type at the given index in the list. + * @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the preset types list. + */ + virtual CHIP_ERROR GetPresetTypeAtIndex(size_t index, Structs::PresetTypeStruct::Type & presetType) = 0; + + /** + * @brief Get the NumberOfPresets attribute value. + * + * @return The max number of presets supported. Return 0 if not set. + */ + virtual uint8_t GetNumberOfPresets() = 0; + + /** + * @brief Get the preset at a given index in the Presets attribute. + * + * @param[in] index The index of the preset in the list. + * @param[out] preset The PresetStructWithOwnedMembers struct that has the data from the preset + * at the given index in the Presets attribute list. + * @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the presets list. + */ + virtual CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) = 0; + + /** + * @brief Get the ActivePresetHandle attribute value. + * + * @param[out] activePresetHandle The MutableByteSpan to copy the active preset handle into. On success, + * the callee must update the length to the length of the copied data. If the value of + * the attribute is null, the callee must set the MutableByteSpan to empty. + */ + virtual CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) = 0; + + /** + * @brief Set the ActivePresetHandle attribute value. + * + * @param[in] newActivePresetHandle The octet string to set the active preset handle to. + */ + virtual CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) = 0; + + /** + * @brief Appends a preset to the pending presets list maintained by the delegate. + * The delegate must ensure it makes a copy of the provided preset and the data + * of its preset handle, if any. For example, it could create a PresetStructWithOwnedMembers + * from the provided preset. + * + * @param[in] preset The preset to add to the list. + * + * @return CHIP_NO_ERROR if the preset was appended to the list successfully. + * @return CHIP_ERROR if there was an error adding the preset to the list. + */ + virtual CHIP_ERROR AppendToPendingPresetList(const Structs::PresetStruct::Type & preset) = 0; + + /** + * @brief Get the Preset at a given index in the pending presets list. + * + * @param[in] index The index of the preset in the list. + * @param[out] preset The PresetStructWithOwnedMembers struct that has the data from the pending preset + * list at the given index. + * @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the pending presets list. + */ + virtual CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) = 0; + + /** + * @brief Updates the presets attribute with the content of the pending presets list. If the preset in the pending presets list matches i.e. has the + * same presetHandle as an existing entry in the Presets attribute, the thermostat will update the entry with the new preset values, otherwise + * it will add a new preset to the Presets attribute. This will be called when the Thermostat receives a CommitPresetsSchedulesRequest + * command to commit the pending preset changes. + * + * @return CHIP_NO_ERROR if the updates to the presets attribute has been committed successfully. + * @return CHIP_ERROR if the updates to the presets attribute failed to commit for some reason. + * + */ + virtual CHIP_ERROR ApplyPendingPresets() = 0; + + /** + * @brief Clears the pending presets list. + * + */ + virtual void ClearPendingPresetList() = 0; +}; + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index c650a30c871989..7c1d229c77c00b 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -15,7 +15,9 @@ * limitations under the License. */ -#include +#include "PresetStructWithOwnedMembers.h" +#include "thermostat-server.h" + #include #include @@ -26,11 +28,13 @@ #include #include #include +#include using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::Thermostat; +using namespace chip::app::Clusters::Thermostat::Structs; using namespace chip::app::Clusters::Thermostat::Attributes; using imcode = Protocols::InteractionModel::Status; @@ -65,16 +69,635 @@ constexpr int8_t kDefaultDeadBand = 25; // 2.5C is the default namespace { -class ThermostatAttrAccess : public AttributeAccessInterface +ThermostatAttrAccess gThermostatAttrAccess; + +static_assert(kThermostatEndpointCount <= kEmberInvalidEndpointIndex, "Thermostat Delegate table size error"); + +Delegate * gDelegateTable[kThermostatEndpointCount] = { nullptr }; + +Delegate * GetDelegate(EndpointId endpoint) +{ + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= ArraySize(gDelegateTable) ? nullptr : gDelegateTable[ep]); +} + +/** + * @brief Check if a preset is valid. + * + * @param[in] preset The preset to check. + * + * @return true If the preset is valid i.e the PresetHandle (if not null) fits within size constraints and the presetScenario enum + * value is valid. Otherwise, return false. + */ +bool IsValidPresetEntry(const PresetStruct::Type & preset) +{ + // If the presetHandle is not null, the size of the handle does not exceed 16 bytes, return true. + if (!preset.presetHandle.IsNull() && preset.presetHandle.Value().size() > kPresetHandleSize) + { + return false; + } + + // Return true if the preset scenario is valid, false otherwise. + return (preset.presetScenario != PresetScenarioEnum::kUnknownEnumValue); +} + +/** + * @brief Callback that is called when the timeout for editing the presets expires. + * + * @param[in] systemLayer The system layer. + * @param[in] callbackContext The context passed to the timer callback. + */ +void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) +{ + EndpointId endpoint = static_cast(reinterpret_cast(callbackContext)); + + Delegate * delegate = GetDelegate(endpoint); + VerifyOrReturn(delegate != nullptr, ChipLogError(Zcl, "Delegate is null. Unable to handle timer expired")); + + delegate->ClearPendingPresetList(); + gThermostatAttrAccess.SetPresetsEditable(endpoint, false); +} + +/** + * @brief Schedules a timer for the given timeout in seconds. + * + * @param[in] endpoint The endpoint to use. + * @param[in] timeoutSeconds The timeout in seconds. + */ +void ScheduleTimer(EndpointId endpoint, uint16_t timeoutSeconds) +{ + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(timeoutSeconds), + TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Clears the currently scheduled timer. + * + * @param[in] endpoint The endpoint to use. + */ +void ClearTimer(EndpointId endpoint) +{ + DeviceLayer::SystemLayer().CancelTimer(TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Extends the currently scheduled timer to a new timeout value in seconds + * + * @param[in] endpoint The endpoint to use. + * @param[in] timeoutSeconds The timeout in seconds to extend the timer to. + */ +void ExtendTimer(EndpointId endpoint, uint16_t timeoutSeconds) +{ + DeviceLayer::SystemLayer().ExtendTimerTo(System::Clock::Seconds16(timeoutSeconds), + TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); +} + +/** + * @brief Checks if the preset is built-in + * + * @param[in] preset The preset to check. + * + * @return true If the preset is built-in, false otherwise. + */ +bool IsBuiltIn(const PresetStructWithOwnedMembers & preset) +{ + return preset.GetBuiltIn().ValueOr(false); +} + +/** + * @brief Checks if the presets are matching i.e the presetHandles are the same. + * + * @param[in] preset The preset to check. + * @param[in] presetToMatch The preset to match with. + * + * @return true If the presets match, false otherwise. If both preset handles are null, returns false + */ +bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) +{ + return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() + && preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); +} + +/** + * @brief Get the source scoped node id. + * + * @param[in] commandObj The command handler object. + * + * @return The scoped node id of the source node. If the scoped node id is not retreived, return ScopedNodeId(). + */ +ScopedNodeId GetSourceScopedNodeId(CommandHandler * commandObj) +{ + ScopedNodeId sourceNodeId = ScopedNodeId(); + auto sessionHandle = commandObj->GetExchangeContext()->GetSessionHandle(); + + if (sessionHandle->IsSecureSession()) + { + sourceNodeId = sessionHandle->AsSecureSession()->GetPeer(); + } else if (sessionHandle->IsGroupSession()) + { + sourceNodeId = sessionHandle->AsIncomingGroupSession()->GetPeer(); + } + return sourceNodeId; +} + +/** + * @brief Utility to clean up state by clearing the pending presets list, canceling the timer + * and setting PresetsEditable to false and clear the originator scoped node id. + * + * @param[in] delegate The delegate to use. + * @param[in] endpoint The endpoint to use. + */ +void CleanUp(Delegate * delegate, EndpointId endpoint) +{ + if (delegate != nullptr) + { + delegate->ClearPendingPresetList(); + } + ClearTimer(endpoint); + gThermostatAttrAccess.SetPresetsEditable(endpoint, false); + gThermostatAttrAccess.SetOriginatorScopedNodeId(endpoint, ScopedNodeId()); +} + +/** + * @brief Sends a response for the command and cleans up state by calling CleanUp() + * + * @param[in] delegate The delegate to use. + * @param[in] endpoint The endpoint to use. + * @param[in] commandObj The command handler to use to add the status response. + * @param[in] commandPath The command path. + * @param[in] status The status code to send as the response. + * + * @return true to indicate the response has been sent and command has been handled. + */ +bool SendResponseAndCleanUp(Delegate * delegate, EndpointId endpoint, CommandHandler * commandObj, const ConcreteCommandPath & commandPath, imcode status) +{ + commandObj->AddStatus(commandPath, status); + CleanUp(delegate, endpoint); + return true; +} + +/** + * @brief Finds an entry in the pending presets list that matches a preset. + * The presetHandle of the two presets must match. + * + * @param[in] delegate The delegate to use. + * @param[in] presetToMatch The preset to match with. + * + * @return true if a matching entry was found in the pending presets list, false otherwise. + */ +bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, preset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "MatchingPendingPresetExists: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return false; + } + + if (PresetHandlesExistAndMatch(preset, presetToMatch)) + { + return true; + } + } + return false; +} + +/** + * @brief Finds and returns an entry in the Presets attribute list that matches a preset. + * The presetHandle of the two presets must match. + * + * @param[in] delegate The delegate to use. + * @param[in] presetToMatch The preset to match with. + * @param[out] matchingPreset The preset in the Presets attribute list that has the same PresetHandle as the presetToMatch. + * + * @return true if a matching entry was found in the presets attribute list, false otherwise. + */ +bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch, PresetStructWithOwnedMembers & matchingPreset) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "GetMatchingPresetInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return false; + } + + if (PresetHandlesExistAndMatch(matchingPreset, presetToMatch)) + { + return true; + } + } + return false; +} + +/** + * @brief Checks if the given preset handle is present in the presets attribute + * @param[in] delegate The delegate to use. + * @param[in] presetHandleToMatch The preset handle to match with. + * + * @return true if the given preset handle is present in the presets attribute list, false otherwise. + */ +bool IsPresetHandlePresentInPresets(Delegate * delegate, const ByteSpan & presetHandleToMatch) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + PresetStructWithOwnedMembers matchingPreset; + for (uint8_t i = 0; true; i++) + { + CHIP_ERROR err = delegate->GetPresetAtIndex(i, matchingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return false; + } + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "IsPresetHandlePresentInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return false; + } + + if (!matchingPreset.GetPresetHandle().IsNull() && matchingPreset.GetPresetHandle().Value().data_equal(presetHandleToMatch)) + { + return true; + } + } + return false; +} + +/** + * @brief Returns the length of the list of presets if the pending presets were to be applied. The calculation is done by + * adding the number of presets in Presets attribute list to the number of pending presets in the pending + * presets list and subtracting the number of duplicate presets. This is called before changes are actually applied. + * + * @param[in] delegate The delegate to use. + * + * @return count of the updated Presets attribute if the pending presets were applied to it. Return 0 for error cases. + */ +uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) +{ + uint8_t numberOfPresets = 0; + uint8_t numberOfMatches = 0; + uint8_t numberOfPendingPresets = 0; + + VerifyOrReturnValue(delegate != nullptr, 0); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + CHIP_ERROR err = delegate->GetPresetAtIndex(i, preset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "GetUpdatedPresetsCount: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return 0; + } + numberOfPresets++; + + bool found = MatchingPendingPresetExists(delegate, preset); + + if (found) + { + numberOfMatches++; + } + } + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers pendingPreset; + CHIP_ERROR err = delegate->GetPendingPresetAtIndex(i, pendingPreset); + + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "GetUpdatedPresetsCount: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return 0; + } + numberOfPendingPresets++; + } + + return numberOfPresets + numberOfPendingPresets - numberOfMatches; +} + +/** + * @brief Checks if the presetScenario is present in the PresetTypes attribute. + * + * @param[in] delegate The delegate to use. + * @param[in] presetScenario The presetScenario to match with. + * + * @return true if the presetScenario is found, false otherwise. + */ +bool FindPresetScenarioInPresetTypes(Delegate * delegate, PresetScenarioEnum presetScenario) +{ + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err != CHIP_NO_ERROR) + { + return false; + } + + if (presetType.presetScenario == presetScenario) + { + return true; + } + } + return false; +} + + +/** + * @brief Returns the count of preset entries in the pending presets list that have the matching presetHandle. + * @param[in] delegate The delegate to use. + * @param[in] presetHandleToMatch The preset handle to match. + * + * @return count of the number of presets found with the matching presetHandle. Returns 0 if no matching presets were found. + */ +uint8_t CountPresetsInPendingListWithPresetHandle(Delegate * delegate, const ByteSpan & presetHandleToMatch) +{ + uint8_t count = 0; + VerifyOrReturnValue(delegate != nullptr, count); + + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + auto err = delegate->GetPendingPresetAtIndex(i, preset); + if (err != CHIP_NO_ERROR) + { + return count; + } + + DataModel::Nullable presetHandle = preset.GetPresetHandle(); + if (!presetHandle.IsNull() && presetHandle.Value().data_equal(presetHandleToMatch)) + { + count++; + } + } + return count; +} + +/** + * @brief Checks if the presetType for the given preset scenario supports names in the presetTypeFeatures bitmap. + * + * @param[in] delegate The delegate to use. + * @param[in] presetScenario The presetScenario to match with. + * + * @return true if the presetType for the given preset scenario supports names, false otherwise. + */ +bool PresetTypeSupportsNames(Delegate * delegate, PresetScenarioEnum scenario) { -public: - ThermostatAttrAccess() : AttributeAccessInterface(Optional::Missing(), Thermostat::Id) {} + VerifyOrReturnValue(delegate != nullptr, false); + + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err != CHIP_NO_ERROR) + { + return false; + } + + if (presetType.presetScenario == scenario) + { + return (presetType.presetTypeFeatures == PresetTypeFeaturesBitmap::kSupportsNames); + } + } + return false; +} + +int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoint) +{ + // Optional Mfg supplied limits + int16_t AbsMinHeatSetpointLimit = kDefaultAbsMinHeatSetpointLimit; + int16_t AbsMaxHeatSetpointLimit = kDefaultAbsMaxHeatSetpointLimit; + + // Optional User supplied limits + int16_t MinHeatSetpointLimit = kDefaultMinHeatSetpointLimit; + int16_t MaxHeatSetpointLimit = kDefaultMaxHeatSetpointLimit; + + // Attempt to read the setpoint limits + // Absmin/max are manufacturer limits + // min/max are user imposed min/max + + // Note that the limits are initialized above per the spec limits + // if they are not present Get() will not update the value so the defaults are used + imcode status; + + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 + // behavior is not specified when Abs * values are not present and user values are present + // implemented behavior accepts the user values without regard to default Abs values. + + // Per global matter data model policy + // if a attribute is not present then it's default shall be used. - CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; - CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; -}; + status = AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMinHeatSetpointLimit missing using default"); + } + + status = AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMaxHeatSetpointLimit missing using default"); + } + status = MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit); + if (status != imcode::Success) + { + MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + } + + status = MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit); + if (status != imcode::Success) + { + MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; + } + + // Make sure the user imposed limits are within the manufacturer imposed limits + + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 + // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed + // This implementation clamps at the limit. + + // resolution of 3725 is to clamp. + + if (MinHeatSetpointLimit < AbsMinHeatSetpointLimit) + MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + + if (MaxHeatSetpointLimit > AbsMaxHeatSetpointLimit) + MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; + + if (HeatingSetpoint < MinHeatSetpointLimit) + HeatingSetpoint = MinHeatSetpointLimit; + + if (HeatingSetpoint > MaxHeatSetpointLimit) + HeatingSetpoint = MaxHeatSetpointLimit; + + return HeatingSetpoint; +} + +int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoint) +{ + // Optional Mfg supplied limits + int16_t AbsMinCoolSetpointLimit = kDefaultAbsMinCoolSetpointLimit; + int16_t AbsMaxCoolSetpointLimit = kDefaultAbsMaxCoolSetpointLimit; + + // Optional User supplied limits + int16_t MinCoolSetpointLimit = kDefaultMinCoolSetpointLimit; + int16_t MaxCoolSetpointLimit = kDefaultMaxCoolSetpointLimit; + + // Attempt to read the setpoint limits + // Absmin/max are manufacturer limits + // min/max are user imposed min/max + + // Note that the limits are initialized above per the spec limits + // if they are not present Get() will not update the value so the defaults are used + imcode status; + + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 + // behavior is not specified when Abs * values are not present and user values are present + // implemented behavior accepts the user values without regard to default Abs values. + + // Per global matter data model policy + // if a attribute is not present then it's default shall be used. + + status = AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMinCoolSetpointLimit missing using default"); + } + + status = AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit); + if (status != imcode::Success) + { + ChipLogError(Zcl, "Warning: AbsMaxCoolSetpointLimit missing using default"); + } + + status = MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit); + if (status != imcode::Success) + { + MinCoolSetpointLimit = AbsMinCoolSetpointLimit; + } + + status = MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit); + if (status != imcode::Success) + { + MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; + } + + // Make sure the user imposed limits are within the manufacture imposed limits + // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 + // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed + // This implementation clamps at the limit. + + // resolution of 3725 is to clamp. + + if (MinCoolSetpointLimit < AbsMinCoolSetpointLimit) + MinCoolSetpointLimit = AbsMinCoolSetpointLimit; + + if (MaxCoolSetpointLimit > AbsMaxCoolSetpointLimit) + MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; + + if (CoolingSetpoint < MinCoolSetpointLimit) + CoolingSetpoint = MinCoolSetpointLimit; + + if (CoolingSetpoint > MaxCoolSetpointLimit) + CoolingSetpoint = MaxCoolSetpointLimit; + + return CoolingSetpoint; +} + +} // anonymous namespace + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) +{ + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + // if endpoint is found, add the delegate in the delegate table + if (ep < ArraySize(gDelegateTable)) + { + gDelegateTable[ep] = delegate; + } +} + +void ThermostatAttrAccess::SetPresetsEditable(EndpointId endpoint, bool presetEditable) +{ + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mPresetsEditables)) + { + mPresetsEditables[ep] = presetEditable; + } +} + +bool ThermostatAttrAccess::GetPresetsEditable(EndpointId endpoint) +{ + bool presetEditable = false; + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mPresetsEditables)) + { + presetEditable = mPresetsEditables[ep]; + } + return presetEditable; +} + +void ThermostatAttrAccess::SetOriginatorScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId) +{ + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) + { + mPresetEditRequestOriginatorNodeIds[ep] = originatorNodeId; + } +} + +ScopedNodeId ThermostatAttrAccess::GetOriginatorScopedNodeId(EndpointId endpoint) +{ + ScopedNodeId originatorNodeId = ScopedNodeId(); + uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); -ThermostatAttrAccess gThermostatAttrAccess; + if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) + { + originatorNodeId = mPresetEditRequestOriginatorNodeIds[ep]; + } + return originatorNodeId; +} CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { @@ -107,11 +730,75 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A } break; case PresetTypes::Id: { - return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { return CHIP_NO_ERROR; }); + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { + for (uint8_t i = 0; true; i++) + { + PresetTypeStruct::Type presetType; + auto err = delegate->GetPresetTypeAtIndex(i, presetType); + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + ReturnErrorOnFailure(encoder.Encode(presetType)); + } + }); + } + break; + case NumberOfPresets::Id: { + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + ReturnErrorOnFailure(aEncoder.Encode(delegate->GetNumberOfPresets())); } break; case Presets::Id: { - return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { return CHIP_NO_ERROR; }); + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + auto err = delegate->GetPresetAtIndex(i, preset); + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + ReturnErrorOnFailure(encoder.Encode(preset)); + } + }); + } + break; + case PresetsSchedulesEditable::Id: { + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + ReturnErrorOnFailure(aEncoder.Encode(gThermostatAttrAccess.GetPresetsEditable(aPath.mEndpointId))); + } + break; + case ActivePresetHandle::Id: { + Delegate * delegate = GetDelegate(aPath.mEndpointId); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + uint8_t buffer[kPresetHandleSize]; + MutableByteSpan activePresetHandle(buffer); + + CHIP_ERROR err = delegate->GetActivePresetHandle(activePresetHandle); + ReturnErrorOnFailure(err); + + if (activePresetHandle.empty()) + { + ReturnErrorOnFailure(aEncoder.EncodeNull()); + } + else + { + ReturnErrorOnFailure(aEncoder.Encode(activePresetHandle)); + } } break; case ScheduleTypes::Id: { @@ -154,10 +841,69 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, } break; case Presets::Id: { - return CHIP_ERROR_NOT_IMPLEMENTED; + + EndpointId endpoint = aPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + + // #1 Presets are not editable, return INVALID_IN_STATE. + VerifyOrReturnError(gThermostatAttrAccess.GetPresetsEditable(endpoint), + CHIP_IM_GLOBAL_STATUS(InvalidInState), ChipLogError(Zcl, "Presets are not editable")); + + // #2 Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, + // otherwise return BUSY. + const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); + ScopedNodeId scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); + + if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != scopedNodeId) + { + ChipLogError(Zcl, "Another node is editing presets. Server is busy. Try again later"); + return CHIP_IM_GLOBAL_STATUS(Busy); + } + + // If the list operation is replace all, clear the existing pending list, iterate over the new presets list + // and add to the pending presets list. + if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) + { + // Clear the pending presets list + delegate->ClearPendingPresetList(); + + Presets::TypeInfo::DecodableType newPresetsList; + ReturnErrorOnFailure(aDecoder.Decode(newPresetsList)); + + // Iterate over the presets and call the delegate to append to the list of pending presets. + auto iter = newPresetsList.begin(); + while (iter.Next()) + { + const PresetStruct::Type & preset = iter.GetValue(); + if (IsValidPresetEntry(preset)) + { + ReturnErrorOnFailure(delegate->AppendToPendingPresetList(preset)); + } + else + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + } + return iter.GetStatus(); + } + + // If the list operation is AppendItem, call the delegate to append the item to the list of pending presets. + if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) + { + PresetStruct::Type preset; + ReturnErrorOnFailure(aDecoder.Decode(preset)); + if (IsValidPresetEntry(preset)) + { + return delegate->AppendToPendingPresetList(preset); + } + else + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + } } break; - case Schedules::Id: { return CHIP_ERROR_NOT_IMPLEMENTED; } @@ -169,7 +915,10 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, return CHIP_NO_ERROR; } -} // anonymous namespace +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip void emberAfThermostatClusterServerInitCallback(chip::EndpointId endpoint) { @@ -187,7 +936,7 @@ void emberAfThermostatClusterServerInitCallback(chip::EndpointId endpoint) // or should this just be the responsibility of the thermostat application? } -Protocols::InteractionModel::Status +imcode MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) { @@ -496,182 +1245,310 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType & commandData) { - // TODO - return false; + EndpointId endpoint = commandPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + + ByteSpan newPresetHandle = commandData.presetHandle; + + // If the preset handle passed in the command is not present in the Presets attribute, return INVALID_COMMAND. + if (!IsPresetHandlePresentInPresets(delegate, newPresetHandle)) + { + commandObj->AddStatus(commandPath, imcode::InvalidCommand); + return true; + } + + CHIP_ERROR err = delegate->SetActivePresetHandle(DataModel::MakeNullable(newPresetHandle)); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Failed to set ActivePresetHandle with error %" CHIP_ERROR_FORMAT, err.Format()); + commandObj->AddStatus(commandPath, imcode::Failure); + return true; + } + + commandObj->AddStatus(commandPath, imcode::Success); + return true; } bool emberAfThermostatClusterStartPresetsSchedulesEditRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::DecodableType & commandData) { - // TODO - return false; + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + + EndpointId endpoint = commandPath.mEndpointId; + + // #1 If the presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command + // is not the same as the one that previously originated a StartPresetsSchedulesEditRequest command, return BUSY. + if (gThermostatAttrAccess.GetPresetsEditable(endpoint) + && (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId)) + { + commandObj->AddStatus(commandPath, imcode::Busy); + return true; + } + + // #2 If presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command + // is the same as the one that previously originated a StartPresetsSchedulesEditRequest command, extend the timer. + if (gThermostatAttrAccess.GetPresetsEditable(endpoint)) + { + ExtendTimer(endpoint, commandData.timeoutSeconds); + commandObj->AddStatus(commandPath, imcode::Success); + return true; + } + + // Set presets editable to true and the scoped originator node id to the source scoped node id, and start a timer with the + // timeout in seconds passed in the command args. Return success. + gThermostatAttrAccess.SetPresetsEditable(endpoint, true); + gThermostatAttrAccess.SetOriginatorScopedNodeId(endpoint, sourceNodeId); + ScheduleTimer(endpoint, commandData.timeoutSeconds); + commandObj->AddStatus(commandPath, imcode::Success); + return true; } bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::DecodableType & commandData) { - // TODO - return false; + EndpointId endpoint = commandPath.mEndpointId; + + // #1 If presets are not editable, return INVALID_IN_STATE. + if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) + { + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + + // #2 If the node id sending the CancelPresetsSchedulesRequest command is not the same as the one which send the + // previous StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. + if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) + { + commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); + return true; + } + + Delegate * delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } + + // Clear the timer, discard the changes and set PresetsEditable to false. + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); } bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::DecodableType & commandData) { - // TODO - return false; -} + EndpointId endpoint = commandPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); -bool emberAfThermostatClusterSetTemperatureSetpointHoldPolicyCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::DecodableType & commandData) -{ - // TODO - return false; -} + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } -int16_t EnforceHeatingSetpointLimits(int16_t HeatingSetpoint, EndpointId endpoint) -{ - // Optional Mfg supplied limits - int16_t AbsMinHeatSetpointLimit = kDefaultAbsMinHeatSetpointLimit; - int16_t AbsMaxHeatSetpointLimit = kDefaultAbsMaxHeatSetpointLimit; + // #1. If presets are not editable, return INVALID_IN_STATE. + if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } - // Optional User supplied limits - int16_t MinHeatSetpointLimit = kDefaultMinHeatSetpointLimit; - int16_t MaxHeatSetpointLimit = kDefaultMaxHeatSetpointLimit; + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); - // Attempt to read the setpoint limits - // Absmin/max are manufacturer limits - // min/max are user imposed min/max + // #2. If the node id sending the CommitPresetsSchedulesRequest command is not the same as the one which send the + // StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. + if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + } - // Note that the limits are initialized above per the spec limits - // if they are not present Get() will not update the value so the defaults are used - imcode status; + PresetStructWithOwnedMembers preset; + CHIP_ERROR err = CHIP_NO_ERROR; - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 - // behavior is not specified when Abs * values are not present and user values are present - // implemented behavior accepts the user values without regard to default Abs values. + // For each preset in the presets attribute, check that the matching preset in the pending presets list does not + // violate any spec constraints. + for (uint8_t i = 0; true; i++) + { + err = delegate->GetPresetAtIndex(i, preset); - // Per global matter data model policy - // if a attribute is not present then it's default shall be used. + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } - status = AbsMinHeatSetpointLimit::Get(endpoint, &AbsMinHeatSetpointLimit); - if (status != imcode::Success) - { - ChipLogError(Zcl, "Warning: AbsMinHeatSetpointLimit missing using default"); + bool found = MatchingPendingPresetExists(delegate, preset); + + // #3. If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return CONSTRAINT_ERROR. + if (IsBuiltIn(preset) && !found) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } } - status = AbsMaxHeatSetpointLimit::Get(endpoint, &AbsMaxHeatSetpointLimit); - if (status != imcode::Success) + // #4. If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle attribute. + // If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle attribute set, continue with + // other checks. + uint8_t buffer[kPresetHandleSize]; + MutableByteSpan activePresetHandle(buffer); + + err = delegate->GetActivePresetHandle(activePresetHandle); + + if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "Warning: AbsMaxHeatSetpointLimit missing using default"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - status = MinHeatSetpointLimit::Get(endpoint, &MinHeatSetpointLimit); - if (status != imcode::Success) + + if (!activePresetHandle.empty()) { - MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, activePresetHandle); + if (count == 0) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } } - status = MaxHeatSetpointLimit::Get(endpoint, &MaxHeatSetpointLimit); - if (status != imcode::Success) + // For each preset in the pending presets list, check that the preset does not violate any spec constraints. + for (uint8_t i = 0; true; i++) { - MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; - } + PresetStructWithOwnedMembers pendingPreset; + err = delegate->GetPendingPresetAtIndex(i, pendingPreset); - // Make sure the user imposed limits are within the manufacturer imposed limits + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + break; + } + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + } - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 - // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed - // This implementation clamps at the limit. + bool isPendingPresetWithNullPresetHandle = pendingPreset.GetPresetHandle().IsNull(); + if (isPendingPresetWithNullPresetHandle) + { + // #5. If the presetHandle for a preset is null, the device should set a unique presetHandle. + const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; + pendingPreset.SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); + } - // resolution of 3725 is to clamp. + // #6. If the preset handle is null and the built in field is set to true, return CONSTRAINT_ERROR. + if (isPendingPresetWithNullPresetHandle && IsBuiltIn(pendingPreset)) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } - if (MinHeatSetpointLimit < AbsMinHeatSetpointLimit) - MinHeatSetpointLimit = AbsMinHeatSetpointLimit; + bool foundMatchingPresetInPresets = false; + PresetStructWithOwnedMembers matchingPreset; + if (!isPendingPresetWithNullPresetHandle) + { + foundMatchingPresetInPresets = GetMatchingPresetInPresets(delegate, pendingPreset, matchingPreset); - if (MaxHeatSetpointLimit > AbsMaxHeatSetpointLimit) - MaxHeatSetpointLimit = AbsMaxHeatSetpointLimit; + // #7. If the presetHandle for the pending preset is not null and a matching preset is not found in the + // presets attribute list, return NOT_FOUND. + if (!foundMatchingPresetInPresets) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::NotFound); + } - if (HeatingSetpoint < MinHeatSetpointLimit) - HeatingSetpoint = MinHeatSetpointLimit; + // #8. Find the number of presets in the pending preset list that match the preset handle. If there are duplicate + // entries, return CONSTRAINT_ERROR. + uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, pendingPreset.GetPresetHandle().Value()); + if (count > 1) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } + } - if (HeatingSetpoint > MaxHeatSetpointLimit) - HeatingSetpoint = MaxHeatSetpointLimit; + // #9. If the preset is found in the presets attribute list and the preset is builtIn in the pending presets list + // but not in the presets attribute list, return UNSUPPORTED_ACCESS. + if (foundMatchingPresetInPresets && (IsBuiltIn(pendingPreset) && !IsBuiltIn(matchingPreset))) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + } - return HeatingSetpoint; -} + // #10. If the preset is found in the presets attribute list and the preset is builtIn in the presets attribute + // but not in the pending presets list, return UNSUPPORTED_ACCESS. + if (foundMatchingPresetInPresets && (!IsBuiltIn(pendingPreset) && IsBuiltIn(matchingPreset))) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + } -int16_t EnforceCoolingSetpointLimits(int16_t CoolingSetpoint, EndpointId endpoint) -{ - // Optional Mfg supplied limits - int16_t AbsMinCoolSetpointLimit = kDefaultAbsMinCoolSetpointLimit; - int16_t AbsMaxCoolSetpointLimit = kDefaultAbsMaxCoolSetpointLimit; + // #11. If the presetScenario is not found in the preset types, return CONSTRAINT_ERROR. + PresetScenarioEnum presetScenario = pendingPreset.GetPresetScenario(); + if (!FindPresetScenarioInPresetTypes(delegate, presetScenario)) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } - // Optional User supplied limits - int16_t MinCoolSetpointLimit = kDefaultMinCoolSetpointLimit; - int16_t MaxCoolSetpointLimit = kDefaultMaxCoolSetpointLimit; + // #12. If the preset type for the preset scenario does not supports names and a name is specified, return CONSTRAINT_ERROR. + if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) + { + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + } - // Attempt to read the setpoint limits - // Absmin/max are manufacturer limits - // min/max are user imposed min/max + // Enforce the Setpoint Limits for both the cooling and heating + Optional coolingSetpointValue = preset.GetCoolingSetpoint(); + if (coolingSetpointValue.HasValue()) + { + pendingPreset.SetCoolingSetpoint(MakeOptional(EnforceCoolingSetpointLimits(coolingSetpointValue.Value(), endpoint))); + } - // Note that the limits are initialized above per the spec limits - // if they are not present Get() will not update the value so the defaults are used - imcode status; + Optional heatingSetpointValue = preset.GetHeatingSetpoint(); + if (heatingSetpointValue.HasValue()) + { + pendingPreset.SetHeatingSetpoint(MakeOptional(EnforceHeatingSetpointLimits(heatingSetpointValue.Value(), endpoint))); + } + } - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3724 - // behavior is not specified when Abs * values are not present and user values are present - // implemented behavior accepts the user values without regard to default Abs values. + uint8_t totalCount = CountUpdatedPresetsAfterApplyingPendingPresets(delegate); - // Per global matter data model policy - // if a attribute is not present then it's default shall be used. + uint8_t numberOfPresetsSupported = delegate->GetNumberOfPresets(); - status = AbsMinCoolSetpointLimit::Get(endpoint, &AbsMinCoolSetpointLimit); - if (status != imcode::Success) + if (numberOfPresetsSupported == 0) { - ChipLogError(Zcl, "Warning: AbsMinCoolSetpointLimit missing using default"); + ChipLogError(Zcl, "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: Failed to get NumberOfPresets"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - status = AbsMaxCoolSetpointLimit::Get(endpoint, &AbsMaxCoolSetpointLimit); - if (status != imcode::Success) + // #12 If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, + // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. + if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) { - ChipLogError(Zcl, "Warning: AbsMaxCoolSetpointLimit missing using default"); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ResourceExhausted); } - status = MinCoolSetpointLimit::Get(endpoint, &MinCoolSetpointLimit); - if (status != imcode::Success) - { - MinCoolSetpointLimit = AbsMinCoolSetpointLimit; - } + // #13 TODO: #25 Check if the number of presets for each presetScenario exceeds the max number of presets supported for that scenario. + // We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. - status = MaxCoolSetpointLimit::Get(endpoint, &MaxCoolSetpointLimit); - if (status != imcode::Success) + // Call the delegate API to apply the pending presets to the presets attribute and update it. + err = delegate->ApplyPendingPresets(); + + if (err != CHIP_NO_ERROR) { - MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - // Make sure the user imposed limits are within the manufacture imposed limits - // https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/3725 - // Spec does not specify the behavior is the requested setpoint exceeds the limit allowed - // This implementation clamps at the limit. - - // resolution of 3725 is to clamp. - - if (MinCoolSetpointLimit < AbsMinCoolSetpointLimit) - MinCoolSetpointLimit = AbsMinCoolSetpointLimit; - - if (MaxCoolSetpointLimit > AbsMaxCoolSetpointLimit) - MaxCoolSetpointLimit = AbsMaxCoolSetpointLimit; - - if (CoolingSetpoint < MinCoolSetpointLimit) - CoolingSetpoint = MinCoolSetpointLimit; - - if (CoolingSetpoint > MaxCoolSetpointLimit) - CoolingSetpoint = MaxCoolSetpointLimit; - - return CoolingSetpoint; + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); } bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * commandObj, diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h new file mode 100644 index 00000000000000..c5ce6e2785ff8c --- /dev/null +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -0,0 +1,105 @@ +/** + * + * Copyright (c) 2024 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 + * @brief APIs for the Thermostat cluster extension. + * + ******************************************************************************* + ******************************************************************************/ + +#pragma once + +#include "thermostat-delegate.h" + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace Thermostat { + +static constexpr size_t kThermostatEndpointCount = + MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; + +/** + * @brief Thermostat Attribute Access Interface. + */ +class ThermostatAttrAccess : public chip::app::AttributeAccessInterface +{ +public: + ThermostatAttrAccess() : AttributeAccessInterface(Optional::Missing(), Thermostat::Id) {} + + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, chip::app::AttributeValueDecoder & aDecoder) override; + + /** + * @brief Sets the scoped node id of the originator that send the last successful + * StartPresetsSchedulesEditRequest for the given endpoint. + * + * @param[in] endpoint The endpoint. + * @param[in] originatorNodeId The originator scoped node id. + */ + void SetOriginatorScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId); + + /** + * @brief Gets the scoped node id of the originator that send the last successful + * StartPresetsSchedulesEditRequest for the given endpoint. + * + * @param[in] endpoint The endpoint. + * + * @return the scoped node id for the given endpoint if set. Otherwise returns ScopedNodeId(). + */ + ScopedNodeId GetOriginatorScopedNodeId(EndpointId endpoint); + + /** + * @brief Sets the presets editable flag for the given endpoint + * + * @param[in] endpoint The endpoint. + * @param[in] presetEditable The value of the presets editable. + */ + void SetPresetsEditable(EndpointId endpoint, bool presetEditable); + + /** + * @brief Gets the prests editable flag value for the given endpoint + * + * @param[in] endpoint The endpoint. + * + * @return the presets editable flag value for the given endpoint if set. Otherwise returns false. + */ + bool GetPresetsEditable(EndpointId endpoint); + +private: + + ScopedNodeId mPresetEditRequestOriginatorNodeIds[kThermostatEndpointCount]; + + bool mPresetsEditables[kThermostatEndpointCount]; +}; + +/** + * @brief Sets the default delegate for the specific thermostat features. + * + * @param[in] endpoint The endpoint to set the default delegate on. + * @param[in] delegate The default delegate. + */ +void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate); + +} // namespace Thermostat +} // namespace Clusters +} // namespace app +} // namespace chip + diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index 91a89497d7c8cc..982ea0e9f7b73e 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -92,12 +92,6 @@ limitations under the License. - - - - - - @@ -206,7 +200,8 @@ limitations under the License. - + + @@ -459,9 +454,8 @@ limitations under the License. PresetsSchedulesEditable - TemperatureSetpointHoldPolicy - SetpointHoldExpiryTimestamp - + SetpointHoldExpiryTimestamp + @@ -513,10 +507,6 @@ limitations under the License. This command is used to notify the server that all edits are done and should be committed. - - This command sets the set point hold policy. - - diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 6acf9fd8c4fb2f..78a39945cd932e 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6589,7 +6589,8 @@ cluster Thermostat = 513 { kSleep = 3; kWake = 4; kVacation = 5; - kUserDefined = 6; + kGoingToSleep = 6; + kUserDefined = 7; } enum SetpointChangeSourceEnum : enum8 { @@ -6715,11 +6716,6 @@ cluster Thermostat = 513 { kSupportsOff = 0x8; } - bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 { - kHoldDurationElapsed = 0x1; - kHoldDurationElapsedOrPresetChanged = 0x2; - } - struct ScheduleTransitionStruct { ScheduleDayOfWeekBitmap dayOfWeek = 0; int16u transitionTime = 1; @@ -6825,8 +6821,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -6870,10 +6865,6 @@ cluster Thermostat = 513 { int16u timeoutSeconds = 0; } - request struct SetTemperatureSetpointHoldPolicyRequest { - TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0; - } - /** Command description for SetpointRaiseLower */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; /** Command description for SetWeeklySchedule */ @@ -6892,8 +6883,6 @@ cluster Thermostat = 513 { command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; /** This command is used to notify the server that all edits are done and should be committed. */ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; - /** This command sets the set point hold policy. */ - command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 66338f93c0b225..7242afb7dac5f8 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -40209,8 +40209,7 @@ public static class ThermostatCluster extends BaseChipCluster { private static final long PRESETS_ATTRIBUTE_ID = 80L; private static final long SCHEDULES_ATTRIBUTE_ID = 81L; private static final long PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID = 82L; - private static final long TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID = 83L; - private static final long SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID = 84L; + private static final long SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID = 83L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -40447,26 +40446,6 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void setTemperatureSetpointHoldPolicy(DefaultClusterCallback callback, Integer temperatureSetpointHoldPolicy) { - setTemperatureSetpointHoldPolicy(callback, temperatureSetpointHoldPolicy, 0); - } - - public void setTemperatureSetpointHoldPolicy(DefaultClusterCallback callback, Integer temperatureSetpointHoldPolicy, int timedInvokeTimeoutMs) { - final long commandId = 11L; - - ArrayList elements = new ArrayList<>(); - final long temperatureSetpointHoldPolicyFieldID = 0L; - BaseTLVType temperatureSetpointHoldPolicytlvValue = new UIntType(temperatureSetpointHoldPolicy); - elements.add(new StructElement(temperatureSetpointHoldPolicyFieldID, temperatureSetpointHoldPolicytlvValue)); - - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - public interface GetWeeklyScheduleResponseCallback extends BaseClusterCallback { void onSuccess(Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, Integer modeForSequence, ArrayList transitions); } @@ -42384,32 +42363,6 @@ public void onSuccess(byte[] tlv) { }, PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readTemperatureSetpointHoldPolicyAttribute( - IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID, true); - } - - public void subscribeTemperatureSetpointHoldPolicyAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readSetpointHoldExpiryTimestampAttribute( SetpointHoldExpiryTimestampAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 6959f3a3d83caa..fa7487aec8e28e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -11892,8 +11892,7 @@ public enum Attribute { Presets(80L), Schedules(81L), PresetsSchedulesEditable(82L), - TemperatureSetpointHoldPolicy(83L), - SetpointHoldExpiryTimestamp(84L), + SetpointHoldExpiryTimestamp(83L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -11948,8 +11947,7 @@ public enum Command { SetActivePresetRequest(6L), StartPresetsSchedulesEditRequest(7L), CancelPresetsSchedulesEditRequest(8L), - CommitPresetsSchedulesRequest(9L), - SetTemperatureSetpointHoldPolicy(11L),; + CommitPresetsSchedulesRequest(9L),; private final long id; Command(long id) { this.id = id; @@ -12069,23 +12067,6 @@ public static StartPresetsSchedulesEditRequestCommandField value(int id) throws } throw new NoSuchFieldError(); } - }public enum SetTemperatureSetpointHoldPolicyCommandField {TemperatureSetpointHoldPolicy(0),; - private final int id; - SetTemperatureSetpointHoldPolicyCommandField(int id) { - this.id = id; - } - - public int getID() { - return id; - } - public static SetTemperatureSetpointHoldPolicyCommandField value(int id) throws NoSuchFieldError { - for (SetTemperatureSetpointHoldPolicyCommandField field : SetTemperatureSetpointHoldPolicyCommandField.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 99bae94690439d..70d351e0ef2751 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -26739,23 +26739,6 @@ public Map> getCommandMap() { ); thermostatClusterInteractionInfoMap.put("commitPresetsSchedulesRequest", thermostatcommitPresetsSchedulesRequestInteractionInfo); - Map thermostatsetTemperatureSetpointHoldPolicyCommandParams = new LinkedHashMap(); - - CommandParameterInfo thermostatsetTemperatureSetpointHoldPolicytemperatureSetpointHoldPolicyCommandParameterInfo = new CommandParameterInfo("temperatureSetpointHoldPolicy", Integer.class, Integer.class); - thermostatsetTemperatureSetpointHoldPolicyCommandParams.put("temperatureSetpointHoldPolicy",thermostatsetTemperatureSetpointHoldPolicytemperatureSetpointHoldPolicyCommandParameterInfo); - InteractionInfo thermostatsetTemperatureSetpointHoldPolicyInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster) - .setTemperatureSetpointHoldPolicy((DefaultClusterCallback) callback - , (Integer) - commandArguments.get("temperatureSetpointHoldPolicy") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - thermostatsetTemperatureSetpointHoldPolicyCommandParams - ); - thermostatClusterInteractionInfoMap.put("setTemperatureSetpointHoldPolicy", thermostatsetTemperatureSetpointHoldPolicyInteractionInfo); - commandMap.put("thermostat", thermostatClusterInteractionInfoMap); Map fanControlClusterInteractionInfoMap = new LinkedHashMap<>(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 04c849e6c0eb9c..d18655ec6203d8 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -12905,17 +12905,6 @@ private static Map readThermostatInteractionInfo() { readThermostatPresetsSchedulesEditableCommandParams ); result.put("readPresetsSchedulesEditableAttribute", readThermostatPresetsSchedulesEditableAttributeInteractionInfo); - Map readThermostatTemperatureSetpointHoldPolicyCommandParams = new LinkedHashMap(); - InteractionInfo readThermostatTemperatureSetpointHoldPolicyAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster).readTemperatureSetpointHoldPolicyAttribute( - (ChipClusters.IntegerAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readThermostatTemperatureSetpointHoldPolicyCommandParams - ); - result.put("readTemperatureSetpointHoldPolicyAttribute", readThermostatTemperatureSetpointHoldPolicyAttributeInteractionInfo); Map readThermostatSetpointHoldExpiryTimestampCommandParams = new LinkedHashMap(); InteractionInfo readThermostatSetpointHoldExpiryTimestampAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt index ed9077402e96af..66db507eb79cd5 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt @@ -582,33 +582,6 @@ class ThermostatCluster(private val controller: MatterController, private val en logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun setTemperatureSetpointHoldPolicy( - temperatureSetpointHoldPolicy: UByte, - timedInvokeTimeout: Duration? = null, - ) { - val commandId: UInt = 11u - - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - - val TAG_TEMPERATURE_SETPOINT_HOLD_POLICY_REQ: Int = 0 - tlvWriter.put( - ContextSpecificTag(TAG_TEMPERATURE_SETPOINT_HOLD_POLICY_REQ), - temperatureSetpointHoldPolicy, - ) - tlvWriter.endStructure() - - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timedInvokeTimeout, - ) - - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } - suspend fun readLocalTemperatureAttribute(): LocalTemperatureAttribute { val ATTRIBUTE_ID: UInt = 0u @@ -7557,103 +7530,8 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun readTemperatureSetpointHoldPolicyAttribute(): UByte? { - val ATTRIBUTE_ID: UInt = 83u - - 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) { - "Temperaturesetpointholdpolicy 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 subscribeTemperatureSetpointHoldPolicyAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 83u - 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) { - "Temperaturesetpointholdpolicy 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 readSetpointHoldExpiryTimestampAttribute(): SetpointHoldExpiryTimestampAttribute { - val ATTRIBUTE_ID: UInt = 84u + val ATTRIBUTE_ID: UInt = 83u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -7697,7 +7575,7 @@ class ThermostatCluster(private val controller: MatterController, private val en minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 84u + val ATTRIBUTE_ID: UInt = 83u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 183a61a505c875..0709c402c08071 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -31025,22 +31025,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jnivalue, value); return value; } - case Attributes::TemperatureSetpointHoldPolicy::Id: { - using TypeInfo = Attributes::TemperatureSetpointHoldPolicy::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.Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, - value); - return value; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { using TypeInfo = Attributes::SetpointHoldExpiryTimestamp::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 1f3b1305b5f52f..fcf0683be36ac0 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -8840,13 +8840,6 @@ class ChipClusters: "args": { }, }, - 0x0000000B: { - "commandId": 0x0000000B, - "commandName": "SetTemperatureSetpointHoldPolicy", - "args": { - "temperatureSetpointHoldPolicy": "int", - }, - }, }, "attributes": { 0x00000000: { @@ -9239,14 +9232,8 @@ class ChipClusters: "reportable": True, }, 0x00000053: { - "attributeName": "TemperatureSetpointHoldPolicy", - "attributeId": 0x00000053, - "type": "int", - "reportable": True, - }, - 0x00000054: { "attributeName": "SetpointHoldExpiryTimestamp", - "attributeId": 0x00000054, + "attributeId": 0x00000053, "type": "int", "reportable": True, }, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index bf94c7ea84ea08..3eef2869c8ba6e 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -32045,8 +32045,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="presets", Tag=0x00000050, Type=typing.Optional[typing.List[Thermostat.Structs.PresetStruct]]), ClusterObjectFieldDescriptor(Label="schedules", Tag=0x00000051, Type=typing.Optional[typing.List[Thermostat.Structs.ScheduleStruct]]), ClusterObjectFieldDescriptor(Label="presetsSchedulesEditable", Tag=0x00000052, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="temperatureSetpointHoldPolicy", Tag=0x00000053, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="setpointHoldExpiryTimestamp", Tag=0x00000054, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="setpointHoldExpiryTimestamp", Tag=0x00000053, Type=typing.Union[None, Nullable, uint]), 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]), @@ -32115,7 +32114,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: presets: 'typing.Optional[typing.List[Thermostat.Structs.PresetStruct]]' = None schedules: 'typing.Optional[typing.List[Thermostat.Structs.ScheduleStruct]]' = None presetsSchedulesEditable: 'typing.Optional[bool]' = None - temperatureSetpointHoldPolicy: 'typing.Optional[uint]' = None setpointHoldExpiryTimestamp: 'typing.Union[None, Nullable, uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None @@ -32199,12 +32197,13 @@ class PresetScenarioEnum(MatterIntEnum): kSleep = 0x03 kWake = 0x04 kVacation = 0x05 - kUserDefined = 0x06 + kGoingToSleep = 0x06 + kUserDefined = 0x07 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving and unknown # enum value. This specific should never be transmitted. - kUnknownEnumValue = 7, + kUnknownEnumValue = 8, class SetpointChangeSourceEnum(MatterIntEnum): kManual = 0x00 @@ -32344,10 +32343,6 @@ class ScheduleTypeFeaturesBitmap(IntFlag): kSupportsNames = 0x4 kSupportsOff = 0x8 - class TemperatureSetpointHoldPolicyBitmap(IntFlag): - kHoldDurationElapsed = 0x1 - kHoldDurationElapsedOrPresetChanged = 0x2 - class Structs: @dataclass class ScheduleTransitionStruct(ClusterObject): @@ -32625,22 +32620,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ]) - @dataclass - class SetTemperatureSetpointHoldPolicy(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000201 - command_id: typing.ClassVar[int] = 0x0000000B - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[str] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="temperatureSetpointHoldPolicy", Tag=0, Type=uint), - ]) - - temperatureSetpointHoldPolicy: 'uint' = 0 - class Attributes: @dataclass class LocalTemperature(ClusterAttributeDescriptor): @@ -33602,22 +33581,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[bool]' = None - @dataclass - class TemperatureSetpointHoldPolicy(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000201 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000053 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - - value: 'typing.Optional[uint]' = None - @dataclass class SetpointHoldExpiryTimestamp(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -33626,7 +33589,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000054 + return 0x00000053 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 0d2f7bca464902..1f8b78979c8798 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -4161,9 +4161,6 @@ static BOOL AttributeIsSpecifiedInThermostatCluster(AttributeId aAttributeId) case Attributes::PresetsSchedulesEditable::Id: { return YES; } - case Attributes::TemperatureSetpointHoldPolicy::Id: { - return YES; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 8ce69c91d5ae56..70d282af25401f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -12470,17 +12470,6 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib value = [NSNumber numberWithBool:cppValue]; return value; } - case Attributes::TemperatureSetpointHoldPolicy::Id: { - using TypeInfo = Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { using TypeInfo = Attributes::SetpointHoldExpiryTimestamp::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 c1ad2950a339f2..3e603ff3763437 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -10012,12 +10012,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)commitPresetsSchedulesRequestWithCompletion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command SetTemperatureSetpointHoldPolicy - * - * This command sets the set point hold policy. - */ -- (void)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeLocalTemperatureWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeLocalTemperatureWithParams:(MTRSubscribeParams *)params @@ -10437,12 +10431,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributePresetsSchedulesEditableWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributeTemperatureSetpointHoldPolicyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeTemperatureSetpointHoldPolicyWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeTemperatureSetpointHoldPolicyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeSetpointHoldExpiryTimestampWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeSetpointHoldExpiryTimestampWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -19754,7 +19742,8 @@ typedef NS_ENUM(uint8_t, MTRThermostatPresetScenario) { MTRThermostatPresetScenarioSleep MTR_PROVISIONALLY_AVAILABLE = 0x03, MTRThermostatPresetScenarioWake MTR_PROVISIONALLY_AVAILABLE = 0x04, MTRThermostatPresetScenarioVacation MTR_PROVISIONALLY_AVAILABLE = 0x05, - MTRThermostatPresetScenarioUserDefined MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRThermostatPresetScenarioGoingToSleep MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRThermostatPresetScenarioUserDefined MTR_PROVISIONALLY_AVAILABLE = 0x07, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRThermostatSetpointChangeSource) { @@ -19911,11 +19900,6 @@ typedef NS_OPTIONS(uint16_t, MTRThermostatScheduleTypeFeaturesBitmap) { MTRThermostatScheduleTypeFeaturesBitmapSupportsOff MTR_PROVISIONALLY_AVAILABLE = 0x8, } MTR_PROVISIONALLY_AVAILABLE; -typedef NS_OPTIONS(uint8_t, MTRThermostatTemperatureSetpointHoldPolicyBitmap) { - MTRThermostatTemperatureSetpointHoldPolicyBitmapHoldDurationElapsed MTR_PROVISIONALLY_AVAILABLE = 0x1, - MTRThermostatTemperatureSetpointHoldPolicyBitmapHoldDurationElapsedOrPresetChanged MTR_PROVISIONALLY_AVAILABLE = 0x2, -} MTR_PROVISIONALLY_AVAILABLE; - typedef NS_ENUM(uint8_t, MTRFanControlAirflowDirection) { MTRFanControlAirflowDirectionForward MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x00, MTRFanControlAirflowDirectionReverse MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index b4f9ee8e82e653..10a6bf8fe0eab8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -67948,30 +67948,6 @@ - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPrese queue:self.callbackQueue completion:responseHandler]; } -- (void)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - (void)readAttributeLocalTemperatureWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { @@ -71093,42 +71069,6 @@ + (void)readAttributePresetsSchedulesEditableWithClusterStateCache:(MTRClusterSt completion:completion]; } -- (void)readAttributeTemperatureSetpointHoldPolicyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributeTemperatureSetpointHoldPolicyWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributeTemperatureSetpointHoldPolicyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::TemperatureSetpointHoldPolicy::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - - (void)readAttributeSetpointHoldExpiryTimestampWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = Thermostat::Attributes::SetpointHoldExpiryTimestamp::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 094d58964241fa..7cc4515e6553f2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -3486,8 +3486,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterThermostatAttributePresetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000050, MTRAttributeIDTypeClusterThermostatAttributeSchedulesID MTR_PROVISIONALLY_AVAILABLE = 0x00000051, MTRAttributeIDTypeClusterThermostatAttributePresetsSchedulesEditableID MTR_PROVISIONALLY_AVAILABLE = 0x00000052, - MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldPolicyID MTR_PROVISIONALLY_AVAILABLE = 0x00000053, - MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000054, + MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000053, MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterThermostatAttributeAcceptedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterThermostatAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -6592,7 +6591,6 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterThermostatCommandStartPresetsSchedulesEditRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, MTRCommandIDTypeClusterThermostatCommandCancelPresetsSchedulesEditRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, MTRCommandIDTypeClusterThermostatCommandCommitPresetsSchedulesRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, - MTRCommandIDTypeClusterThermostatCommandSetTemperatureSetpointHoldPolicyID MTR_PROVISIONALLY_AVAILABLE = 0x0000000B, // Cluster FanControl deprecated command id names diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 91bdbf48d13e74..a3531034733201 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -5766,10 +5766,6 @@ result = @"PresetsSchedulesEditable"; break; - case MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldPolicyID: - result = @"TemperatureSetpointHoldPolicy"; - break; - case MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID: result = @"SetpointHoldExpiryTimestamp"; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 7c4d66189c3b4d..27b2a92f132369 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -4649,7 +4649,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)commitPresetsSchedulesRequestWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeLocalTemperatureWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @@ -4829,8 +4828,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (NSDictionary * _Nullable)readAttributePresetsSchedulesEditableWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributeTemperatureSetpointHoldPolicyWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeSetpointHoldExpiryTimestampWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index b638b2c8f56890..322daa4e9a0524 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -13300,33 +13300,6 @@ - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPrese completion:responseHandler]; } -- (void)setTemperatureSetpointHoldPolicyWithParams:(MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - - (NSDictionary * _Nullable)readAttributeLocalTemperatureWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeLocalTemperatureID) params:params]; @@ -13946,11 +13919,6 @@ - (void)writeAttributeSchedulesWithValue:(NSDictionary *)dataVal return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributePresetsSchedulesEditableID) params:params]; } -- (NSDictionary * _Nullable)readAttributeTemperatureSetpointHoldPolicyWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldPolicyID) params:params]; -} - - (NSDictionary * _Nullable)readAttributeSetpointHoldExpiryTimestampWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 5981d8292c039c..7cf6b74ee856e2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -7920,36 +7920,6 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams : NSObject - -@property (nonatomic, copy) NSNumber * _Nonnull temperatureSetpointHoldPolicy MTR_PROVISIONALLY_AVAILABLE; -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; - -/** - * Controls how much time, in seconds, we will allow for the server to process the command. - * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. - * - * If nil, the framework will try to select an appropriate timeout value itself. - */ -@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; -@end - MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @interface MTRFanControlClusterStepParams : NSObject diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 295f8444db0b63..bdeea4de027e6e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -22577,85 +22577,6 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams -- (instancetype)init -{ - if (self = [super init]) { - - _temperatureSetpointHoldPolicy = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams alloc] init]; - - other.temperatureSetpointHoldPolicy = self.temperatureSetpointHoldPolicy; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: temperatureSetpointHoldPolicy:%@; >", NSStringFromClass([self class]), _temperatureSetpointHoldPolicy]; - return descriptionString; -} - -@end - -@implementation MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader -{ - chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.temperatureSetpointHoldPolicy = static_cast>(self.temperatureSetpointHoldPolicy.unsignedCharValue); - } - - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; - } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; - } - return nil; - } - - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; - } - } - return decodedObj; -} -@end - @implementation MTRFanControlClusterStepParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index d3746f9d936895..db7e9dab35cdf5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -1486,12 +1486,6 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - @interface MTRFanControlClusterStepParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; 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 ca35f4d8464e3c..98e66215739e93 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 @@ -26639,56 +26639,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value) } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, - chip::BitMask * value) -{ - using Traits = NumericAttributeTraits>; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::Thermostat::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value, - MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits>; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BITMAP8_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value) -{ - using Traits = NumericAttributeTraits>; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BITMAP8_ATTRIBUTE_TYPE); -} - -} // namespace TemperatureSetpointHoldPolicy - namespace SetpointHoldExpiryTimestamp { Protocols::InteractionModel::Status 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 78334996c0e75e..d7048f05fc93e5 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 @@ -4162,17 +4162,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty); } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, - chip::BitMask * - value); // TemperatureSetpointHoldPolicyBitmap -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, - chip::BitMask value, - MarkAttributeDirty markDirty); -} // namespace TemperatureSetpointHoldPolicy - namespace SetpointHoldExpiryTimestamp { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 80e42e929fe08a..e77faa965f192a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -6317,12 +6317,6 @@ bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::DecodableType & commandData); -/** - * @brief Thermostat Cluster SetTemperatureSetpointHoldPolicy Command callback (from client) - */ -bool emberAfThermostatClusterSetTemperatureSetpointHoldPolicyCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::DecodableType & commandData); /** * @brief Fan Control Cluster Step Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 13951c0ff2bc00..d4a4bdd1909eb4 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -2702,6 +2702,7 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::PresetScena case EnumType::kSleep: case EnumType::kWake: case EnumType::kVacation: + case EnumType::kGoingToSleep: case EnumType::kUserDefined: return val; default: diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 62bf3473649525..c18204ae3327df 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -3929,18 +3929,19 @@ enum class ControlSequenceOfOperationEnum : uint8_t // Enum for PresetScenarioEnum enum class PresetScenarioEnum : uint8_t { - kUnspecified = 0x00, - kOccupied = 0x01, - kUnoccupied = 0x02, - kSleep = 0x03, - kWake = 0x04, - kVacation = 0x05, - kUserDefined = 0x06, + kUnspecified = 0x00, + kOccupied = 0x01, + kUnoccupied = 0x02, + kSleep = 0x03, + kWake = 0x04, + kVacation = 0x05, + kGoingToSleep = 0x06, + kUserDefined = 0x07, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 7, + kUnknownEnumValue = 8, }; // Enum for SetpointChangeSourceEnum @@ -4127,13 +4128,6 @@ enum class ScheduleTypeFeaturesBitmap : uint16_t kSupportsNames = 0x4, kSupportsOff = 0x8, }; - -// Bitmap for TemperatureSetpointHoldPolicyBitmap -enum class TemperatureSetpointHoldPolicyBitmap : uint8_t -{ - kHoldDurationElapsed = 0x1, - kHoldDurationElapsedOrPresetChanged = 0x2, -}; } // namespace Thermostat namespace FanControl { 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 8fc3c32562d3d7..f06eb2cc350702 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 @@ -21249,40 +21249,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace CommitPresetsSchedulesRequest. -namespace SetTemperatureSetpointHoldPolicy { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kTemperatureSetpointHoldPolicy), temperatureSetpointHoldPolicy); - 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::kTemperatureSetpointHoldPolicy)) - { - err = DataModel::Decode(reader, temperatureSetpointHoldPolicy); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} -} // namespace SetTemperatureSetpointHoldPolicy. } // namespace Commands namespace Attributes { @@ -21410,8 +21376,6 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, schedules); case Attributes::PresetsSchedulesEditable::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, presetsSchedulesEditable); - case Attributes::TemperatureSetpointHoldPolicy::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, temperatureSetpointHoldPolicy); case Attributes::SetpointHoldExpiryTimestamp::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, setpointHoldExpiryTimestamp); case Attributes::GeneratedCommandList::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 9c335d4ba91dcb..cbd58c57f444d7 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 @@ -29252,11 +29252,6 @@ struct Type; struct DecodableType; } // namespace CommitPresetsSchedulesRequest -namespace SetTemperatureSetpointHoldPolicy { -struct Type; -struct DecodableType; -} // namespace SetTemperatureSetpointHoldPolicy - } // namespace Commands namespace Commands { @@ -29592,40 +29587,6 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace CommitPresetsSchedulesRequest -namespace SetTemperatureSetpointHoldPolicy { -enum class Fields : uint8_t -{ - kTemperatureSetpointHoldPolicy = 0, -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetTemperatureSetpointHoldPolicy::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - - chip::BitMask temperatureSetpointHoldPolicy = - static_cast>(0); - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::SetTemperatureSetpointHoldPolicy::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - - chip::BitMask temperatureSetpointHoldPolicy = - static_cast>(0); - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace SetTemperatureSetpointHoldPolicy } // namespace Commands namespace Attributes { @@ -30360,18 +30321,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { -struct TypeInfo -{ - using Type = chip::BitMask; - using DecodableType = chip::BitMask; - using DecodableArgType = chip::BitMask; - - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::TemperatureSetpointHoldPolicy::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace TemperatureSetpointHoldPolicy namespace SetpointHoldExpiryTimestamp { struct TypeInfo { @@ -30503,8 +30452,6 @@ struct TypeInfo Attributes::Presets::TypeInfo::DecodableType presets; Attributes::Schedules::TypeInfo::DecodableType schedules; Attributes::PresetsSchedulesEditable::TypeInfo::DecodableType presetsSchedulesEditable = static_cast(0); - Attributes::TemperatureSetpointHoldPolicy::TypeInfo::DecodableType temperatureSetpointHoldPolicy = - static_cast>(0); Attributes::SetpointHoldExpiryTimestamp::TypeInfo::DecodableType setpointHoldExpiryTimestamp; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; 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 224f09ff69f44d..4bca1b13d93867 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 @@ -5186,12 +5186,8 @@ namespace PresetsSchedulesEditable { static constexpr AttributeId Id = 0x00000052; } // namespace PresetsSchedulesEditable -namespace TemperatureSetpointHoldPolicy { -static constexpr AttributeId Id = 0x00000053; -} // namespace TemperatureSetpointHoldPolicy - namespace SetpointHoldExpiryTimestamp { -static constexpr AttributeId Id = 0x00000054; +static constexpr AttributeId Id = 0x00000053; } // namespace SetpointHoldExpiryTimestamp namespace GeneratedCommandList { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 4a8e4a830a44f7..015e613cdd6f29 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -1328,10 +1328,6 @@ namespace CommitPresetsSchedulesRequest { static constexpr CommandId Id = 0x00000009; } // namespace CommitPresetsSchedulesRequest -namespace SetTemperatureSetpointHoldPolicy { -static constexpr CommandId Id = 0x0000000B; -} // namespace SetTemperatureSetpointHoldPolicy - } // namespace Commands } // namespace Thermostat diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index dd2f2c40082af8..8bc86e168d8c66 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -9395,7 +9395,6 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * StartPresetsSchedulesEditRequest | 0x07 | | * CancelPresetsSchedulesEditRequest | 0x08 | | * CommitPresetsSchedulesRequest | 0x09 | -| * SetTemperatureSetpointHoldPolicy | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | | * LocalTemperature | 0x0000 | @@ -9458,8 +9457,7 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * Presets | 0x0050 | | * Schedules | 0x0051 | | * PresetsSchedulesEditable | 0x0052 | -| * TemperatureSetpointHoldPolicy | 0x0053 | -| * SetpointHoldExpiryTimestamp | 0x0054 | +| * SetpointHoldExpiryTimestamp | 0x0053 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -9817,44 +9815,6 @@ class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::Type mRequest; }; -/* - * Command SetTemperatureSetpointHoldPolicy - */ -class ThermostatSetTemperatureSetpointHoldPolicy : public ClusterCommand -{ -public: - ThermostatSetTemperatureSetpointHoldPolicy(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("set-temperature-setpoint-hold-policy", credsIssuerConfig) - { - AddArgument("TemperatureSetpointHoldPolicy", 0, UINT8_MAX, &mRequest.temperatureSetpointHoldPolicy); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, - commandId, endpointIds.at(0)); - return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); - } - - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, - groupId); - - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); - } - -private: - chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type mRequest; -}; - /*----------------------------------------------------------------------------*\ | Cluster FanControl | 0x0202 | |------------------------------------------------------------------------------| @@ -22929,7 +22889,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // // // Attributes // @@ -23011,8 +22970,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "schedules", Attributes::Schedules::Id, credsIssuerConfig), // make_unique(Id, "presets-schedules-editable", Attributes::PresetsSchedulesEditable::Id, credsIssuerConfig), // - make_unique(Id, "temperature-setpoint-hold-policy", Attributes::TemperatureSetpointHoldPolicy::Id, - credsIssuerConfig), // make_unique(Id, "setpoint-hold-expiry-timestamp", Attributes::SetpointHoldExpiryTimestamp::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // @@ -23181,9 +23138,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c Id, "schedules", Attributes::Schedules::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "presets-schedules-editable", 0, 1, Attributes::PresetsSchedulesEditable::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>( - Id, "temperature-setpoint-hold-policy", 0, UINT8_MAX, Attributes::TemperatureSetpointHoldPolicy::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>(Id, "setpoint-hold-expiry-timestamp", 0, UINT32_MAX, Attributes::SetpointHoldExpiryTimestamp::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -23282,8 +23236,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "schedules", Attributes::Schedules::Id, credsIssuerConfig), // make_unique(Id, "presets-schedules-editable", Attributes::PresetsSchedulesEditable::Id, credsIssuerConfig), // - make_unique(Id, "temperature-setpoint-hold-policy", Attributes::TemperatureSetpointHoldPolicy::Id, - credsIssuerConfig), // make_unique(Id, "setpoint-hold-expiry-timestamp", Attributes::SetpointHoldExpiryTimestamp::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // 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 d062e7aeac77c5..e88c7d0b0d7737 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -14815,11 +14815,6 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("PresetsSchedulesEditable", 1, value); } - case Thermostat::Attributes::TemperatureSetpointHoldPolicy::Id: { - chip::BitMask value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("TemperatureSetpointHoldPolicy", 1, value); - } case Thermostat::Attributes::SetpointHoldExpiryTimestamp::Id: { chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, 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 39f9c949872dfe..543bfe1e3e8f4f 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -106823,7 +106823,6 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * StartPresetsSchedulesEditRequest | 0x07 | | * CancelPresetsSchedulesEditRequest | 0x08 | | * CommitPresetsSchedulesRequest | 0x09 | -| * SetTemperatureSetpointHoldPolicy | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | | * LocalTemperature | 0x0000 | @@ -106886,8 +106885,7 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * Presets | 0x0050 | | * Schedules | 0x0051 | | * PresetsSchedulesEditable | 0x0052 | -| * TemperatureSetpointHoldPolicy | 0x0053 | -| * SetpointHoldExpiryTimestamp | 0x0054 | +| * SetpointHoldExpiryTimestamp | 0x0053 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -107370,59 +107368,6 @@ class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand { private: }; -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command SetTemperatureSetpointHoldPolicy - */ -class ThermostatSetTemperatureSetpointHoldPolicy : public ClusterCommand { -public: - ThermostatSetTemperatureSetpointHoldPolicy() - : ClusterCommand("set-temperature-setpoint-hold-policy") - { -#if MTR_ENABLE_PROVISIONAL - AddArgument("TemperatureSetpointHoldPolicy", 0, UINT8_MAX, &mRequest.temperatureSetpointHoldPolicy); -#endif // MTR_ENABLE_PROVISIONAL - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterSetTemperatureSetpointHoldPolicyParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; -#if MTR_ENABLE_PROVISIONAL - params.temperatureSetpointHoldPolicy = [NSNumber numberWithUnsignedChar:mRequest.temperatureSetpointHoldPolicy.Raw()]; -#endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster setTemperatureSetpointHoldPolicyWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; - } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Thermostat::Commands::SetTemperatureSetpointHoldPolicy::Type mRequest; -}; - #endif // MTR_ENABLE_PROVISIONAL /* @@ -113686,91 +113631,6 @@ class SubscribeAttributeThermostatPresetsSchedulesEditable : public SubscribeAtt #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Attribute TemperatureSetpointHoldPolicy - */ -class ReadThermostatTemperatureSetpointHoldPolicy : public ReadAttribute { -public: - ReadThermostatTemperatureSetpointHoldPolicy() - : ReadAttribute("temperature-setpoint-hold-policy") - { - } - - ~ReadThermostatTemperatureSetpointHoldPolicy() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldPolicy::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 = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeTemperatureSetpointHoldPolicyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHoldPolicy response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("Thermostat TemperatureSetpointHoldPolicy read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatTemperatureSetpointHoldPolicy : public SubscribeAttribute { -public: - SubscribeAttributeThermostatTemperatureSetpointHoldPolicy() - : SubscribeAttribute("temperature-setpoint-hold-policy") - { - } - - ~SubscribeAttributeThermostatTemperatureSetpointHoldPolicy() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldPolicy::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 = [[MTRBaseClusterThermostat 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 subscribeAttributeTemperatureSetpointHoldPolicyWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.TemperatureSetpointHoldPolicy 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 SetpointHoldExpiryTimestamp */ @@ -194079,9 +193939,6 @@ void registerClusterThermostat(Commands & commands) #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // @@ -194257,10 +194114,6 @@ void registerClusterThermostat(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(), // From 5d2c7402dd9ea58190caf79bb20a30064bfb0fdc Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 26 Jul 2024 07:52:53 +0000 Subject: [PATCH 02/63] Restyled by whitespace --- examples/thermostat/linux/thermostat-delegate-impl.cpp | 6 +++--- .../thermostat-server/PresetStructWithOwnedMembers.cpp | 4 ++-- src/app/clusters/thermostat-server/thermostat-server.cpp | 6 +++--- src/app/clusters/thermostat-server/thermostat-server.h | 1 - 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index 76e9ee4eec5f6c..4805e583ad93ab 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -70,7 +70,7 @@ void ThermostatDelegate::InitializePresetTypes() for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) { mPresetTypes[index].presetScenario = presetScenario; - mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetTypesOfEachType; + mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetTypesOfEachType; mPresetTypes[index].presetTypeFeatures = (presetScenario == PresetScenarioEnum::kOccupied || presetScenario == PresetScenarioEnum::kUnoccupied) ? PresetTypeFeaturesBitmap::kAutomatic : PresetTypeFeaturesBitmap::kSupportsNames; @@ -97,7 +97,7 @@ void ThermostatDelegate::InitializePresets() int16_t coolingSetpointValue = 2500 + index * 100; mPresets[index].SetCoolingSetpoint(MakeOptional(coolingSetpointValue)); - int16_t heatingSetpointValue = 2100 - index * 100; + int16_t heatingSetpointValue = 2100 - index * 100; mPresets[index].SetHeatingSetpoint(MakeOptional(heatingSetpointValue)); mPresets[index].SetBuiltIn(DataModel::MakeNullable(true)); index++; @@ -228,7 +228,7 @@ CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() // If pending preset was not found in the Presets list, append to the Presets list. if (!found) { - + mPresets[mNextFreeIndexInPresetsList] = pendingPreset; const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index eb7adbc3d865fe..0320bbbdb3a6a7 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -73,7 +73,7 @@ CHIP_ERROR PresetStructWithOwnedMembers::SetPresetHandle(const Nullable coolingSetpointValue = preset.GetCoolingSetpoint(); diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h index c5ce6e2785ff8c..fa5ef3281a7868 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.h +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -102,4 +102,3 @@ void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate); } // namespace Clusters } // namespace app } // namespace chip - From f14e43e80c714b6e2e76c2cf15569328278c6b97 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 26 Jul 2024 07:52:54 +0000 Subject: [PATCH 03/63] Restyled by clang-format --- .../linux/include/thermostat-delegate-impl.h | 8 +- .../linux/include/thermostat-manager.h | 11 +- .../linux/thermostat-delegate-impl.cpp | 42 +++--- .../thermostat/linux/thermostat-manager.cpp | 61 ++++---- .../PresetStructWithOwnedMembers.cpp | 6 +- .../PresetStructWithOwnedMembers.h | 2 +- .../thermostat-server/thermostat-delegate.h | 8 +- .../thermostat-server/thermostat-server.cpp | 134 ++++++++++-------- .../thermostat-server/thermostat-server.h | 1 - 9 files changed, 150 insertions(+), 123 deletions(-) diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h index 3685faef5f1104..49d0184f6d56e5 100644 --- a/examples/thermostat/linux/include/thermostat-delegate-impl.h +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -26,9 +26,10 @@ namespace Clusters { namespace Thermostat { /** - * The ThermostatDelegate class serves as the instance delegate for storing Presets related information and providing it to the Thermostat server code. - * It also manages the presets attribute and provides methods to write to presets, edit presets, maintain a pending presets list and either commit the - * presets when requested or discard the changes. It also provide API's to get and set the attribute values. + * The ThermostatDelegate class serves as the instance delegate for storing Presets related information and providing it to the + * Thermostat server code. It also manages the presets attribute and provides methods to write to presets, edit presets, maintain a + * pending presets list and either commit the presets when requested or discard the changes. It also provide API's to get and set + * the attribute values. * */ @@ -61,7 +62,6 @@ class ThermostatDelegate : public Delegate void ClearPendingPresetList() override; private: - static ThermostatDelegate sInstance; ThermostatDelegate(); diff --git a/examples/thermostat/linux/include/thermostat-manager.h b/examples/thermostat/linux/include/thermostat-manager.h index 3857e465b190fe..274f66c66917cf 100644 --- a/examples/thermostat/linux/include/thermostat-manager.h +++ b/examples/thermostat/linux/include/thermostat-manager.h @@ -26,8 +26,8 @@ class ThermostatManager CHIP_ERROR Init(); /// @brief Callback called when any attribute changed on the device - void AttributeChangeHandler(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, - uint16_t size); + void AttributeChangeHandler(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, + uint8_t * value, uint16_t size); chip::app::Clusters::Thermostat::SystemModeEnum GetSystemMode(); chip::app::Clusters::Thermostat::ThermostatRunningModeEnum GetRunningMode(); @@ -54,10 +54,11 @@ class ThermostatManager static ThermostatManager sThermostatMgr; /// @brief attribute handler for the thermostat endpoint - void ThermostatEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, uint16_t size); + void ThermostatEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, + uint16_t size); void ThermostatClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); - void LocalTemperatureMeasurementEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t * value, - uint16_t size); + void LocalTemperatureMeasurementEndpointAttributeChangeHandler(chip::ClusterId clusterId, chip::AttributeId attributeId, + uint8_t * value, uint16_t size); void LocalTemperatureMeasurementClusterAttributeChangeHandler(chip::AttributeId attributeId, uint8_t * value, uint16_t size); /// @brief Main method that evaluates the current thermostat state and updates attributes diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index 4805e583ad93ab..76676383e7b892 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -41,16 +41,16 @@ namespace { */ bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) { - return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() - && preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); + return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && + preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); } } // anonymous namespace ThermostatDelegate::ThermostatDelegate() { - mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType; - mNextFreeIndexInPresetsList = 0; + mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType; + mNextFreeIndexInPresetsList = 0; mNextFreeIndexInPendingPresetsList = 0; InitializePresetTypes(); @@ -62,18 +62,21 @@ ThermostatDelegate::ThermostatDelegate() void ThermostatDelegate::InitializePresetTypes() { - PresetScenarioEnum presetScenarioEnumArray[kMaxNumberOfPresetTypes] = { PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied, - PresetScenarioEnum::kSleep, PresetScenarioEnum::kWake, PresetScenarioEnum::kVacation, PresetScenarioEnum::kGoingToSleep }; + PresetScenarioEnum presetScenarioEnumArray[kMaxNumberOfPresetTypes] = { + PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied, PresetScenarioEnum::kSleep, + PresetScenarioEnum::kWake, PresetScenarioEnum::kVacation, PresetScenarioEnum::kGoingToSleep + }; static_assert(ArraySize(presetScenarioEnumArray) <= ArraySize(mPresetTypes)); uint8_t index = 0; for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) { - mPresetTypes[index].presetScenario = presetScenario; + mPresetTypes[index].presetScenario = presetScenario; mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetTypesOfEachType; mPresetTypes[index].presetTypeFeatures = - (presetScenario == PresetScenarioEnum::kOccupied || presetScenario == PresetScenarioEnum::kUnoccupied) ? - PresetTypeFeaturesBitmap::kAutomatic : PresetTypeFeaturesBitmap::kSupportsNames; + (presetScenario == PresetScenarioEnum::kOccupied || presetScenario == PresetScenarioEnum::kUnoccupied) + ? PresetTypeFeaturesBitmap::kAutomatic + : PresetTypeFeaturesBitmap::kSupportsNames; index++; } } @@ -122,8 +125,7 @@ uint8_t ThermostatDelegate::GetNumberOfPresets() return mNumberOfPresets; } -CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, - PresetStructWithOwnedMembers & preset) +CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) { if (index < mNextFreeIndexInPresetsList) { @@ -155,8 +157,8 @@ CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable kPresetHandleSize) { ChipLogError(NotSpecified, - "Failed to set ActivePresetHandle. newActivePresetHandle size %ld is larger than preset handle size %ld", - newActivePresetHandleSize, kPresetHandleSize); + "Failed to set ActivePresetHandle. newActivePresetHandle size %ld is larger than preset handle size %ld", + newActivePresetHandleSize, kPresetHandleSize); return CHIP_ERROR_NO_MEMORY; } memcpy(mActivePresetHandleData, newActivePresetHandle.Value().data(), newActivePresetHandleSize); @@ -192,7 +194,9 @@ CHIP_ERROR ThermostatDelegate::AppendToPendingPresetList(const PresetStruct::Typ } mNextFreeIndexInPendingPresetsList++; return CHIP_NO_ERROR; - } else { + } + else + { return CHIP_ERROR_WRITE_FAILED; } } @@ -208,9 +212,9 @@ CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStruc } CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() - { - for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) - { +{ + for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) + { const PresetStructWithOwnedMembers & pendingPreset = mPendingPresets[indexInPendingPresets]; bool found = false; @@ -235,8 +239,8 @@ CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() mPresets[mNextFreeIndexInPresetsList].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); mNextFreeIndexInPresetsList++; } - } - return CHIP_NO_ERROR; + } + return CHIP_NO_ERROR; } void ThermostatDelegate::ClearPendingPresetList() diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp index 7dd9437229aae9..74b1fd7b600cb4 100644 --- a/examples/thermostat/linux/thermostat-manager.cpp +++ b/examples/thermostat/linux/thermostat-manager.cpp @@ -20,8 +20,8 @@ * Includes *********************************************************/ -#include "include/thermostat-delegate-impl.h" #include "include/thermostat-manager.h" +#include "include/thermostat-delegate-impl.h" #include #include @@ -61,34 +61,39 @@ ThermostatManager ThermostatManager::sThermostatMgr; namespace { template - static void OnAttributeChangeReported(const ConcreteDataAttributePath & path, const DecodableAttributeType & value); +static void OnAttributeChangeReported(const ConcreteDataAttributePath & path, const DecodableAttributeType & value); - -template<> +template <> void OnAttributeChangeReported(const ConcreteDataAttributePath & path, - const MeasuredValue::TypeInfo::DecodableType & value) + const MeasuredValue::TypeInfo::DecodableType & value) { ClusterId clusterId = path.mClusterId; - if (clusterId != TemperatureMeasurement::Id) { - ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id %u", clusterId); + if (clusterId != TemperatureMeasurement::Id) + { + ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id %u", + clusterId); return; } AttributeId attributeId = path.mAttributeId; - if (attributeId != MeasuredValue::Id) { - ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute %u", attributeId); + if (attributeId != MeasuredValue::Id) + { + ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute %u", + attributeId); return; } if (!value.IsNull()) { - ChipLogDetail(AppServer, "Attribute change reported for TemperatureMeasurement cluster - MeasuredValue is %d", static_cast(value.Value())); + ChipLogDetail(AppServer, "Attribute change reported for TemperatureMeasurement cluster - MeasuredValue is %d", + static_cast(value.Value())); } } -static void OnError(const ConcreteDataAttributePath * path, ChipError err) { - ChipLogError(AppServer, "Subscribing to cluster Id %u and attribute Id %u failed with error %" CHIP_ERROR_FORMAT, path->mClusterId, - path->mAttributeId, err.Format()); +static void OnError(const ConcreteDataAttributePath * path, ChipError err) +{ + ChipLogError(AppServer, "Subscribing to cluster Id %u and attribute Id %u failed with error %" CHIP_ERROR_FORMAT, + path->mClusterId, path->mAttributeId, err.Format()); } static void OnSubscriptionEstablished(const ReadClient & client, unsigned int value) @@ -98,16 +103,19 @@ static void OnSubscriptionEstablished(const ReadClient & client, unsigned int va template void SubscribeToAttribute(ClusterId clusterId, AttributeId attributeId, const EmberBindingTableEntry & binding, - OperationalDeviceProxy * peer_device) + OperationalDeviceProxy * peer_device) { - VerifyOrReturn(peer_device->GetSecureSession().HasValue(), ChipLogError(AppServer, "SubscribeToAttribute failed. Secure session is null")); + VerifyOrReturn(peer_device->GetSecureSession().HasValue(), + ChipLogError(AppServer, "SubscribeToAttribute failed. Secure session is null")); - SubscribeAttribute(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, clusterId, - attributeId, &OnAttributeChangeReported, &OnError, 0, kMaxIntervalCeilingSeconds, &OnSubscriptionEstablished, nullptr, true /* fabricFiltered */, true /* keepExistingSubscription */); + SubscribeAttribute( + peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, clusterId, attributeId, + &OnAttributeChangeReported, &OnError, 0, kMaxIntervalCeilingSeconds, &OnSubscriptionEstablished, + nullptr, true /* fabricFiltered */, true /* keepExistingSubscription */); } -static void ThermostatBoundDeviceChangedHandler(const EmberBindingTableEntry & binding, - OperationalDeviceProxy * peer_device, void * context) +static void ThermostatBoundDeviceChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, + void * context) { VerifyOrReturn(binding.clusterId.has_value(), ChipLogError(AppServer, "Cluster Id is null")); ClusterId clusterId = binding.clusterId.value(); @@ -140,7 +148,7 @@ static void OnPlatformChipDeviceEvent(const DeviceLayer::ChipDeviceEvent * event void InitBindingManager(intptr_t context) { - auto & server = Server::GetInstance(); + auto & server = Server::GetInstance(); CHIP_ERROR error = BindingManager::GetInstance().Init( { &server.GetFabricTable(), server.GetCASESessionManager(), &server.GetPersistentStorage() }); @@ -176,7 +184,8 @@ CHIP_ERROR ThermostatManager::Init() ChipLogError(AppServer, "Initialized a thermostat with \n " "mSystemMode: %hhu (%s) \n mRunningMode: %hhu (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " - "mOccupiedCoolingSetpoint: %d" "NumberOfPresets: %d", + "mOccupiedCoolingSetpoint: %d" + "NumberOfPresets: %d", mSystemMode, SystemModeString(mSystemMode), mRunningMode, RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, GetNumberOfPresets()); @@ -201,7 +210,6 @@ void ThermostatManager::AttributeChangeHandler(EndpointId endpointId, ClusterId } } - void ThermostatManager::ThermostatEndpointAttributeChangeHandler(ClusterId clusterId, AttributeId attributeId, uint8_t * value, uint16_t size) { @@ -212,7 +220,8 @@ void ThermostatManager::ThermostatEndpointAttributeChangeHandler(ClusterId clust break; default: - ChipLogError(AppServer, "Attribute change reported for Thermostat on incorrect cluster for the thermostat endpoint. Ignoring."); + ChipLogError(AppServer, + "Attribute change reported for Thermostat on incorrect cluster for the thermostat endpoint. Ignoring."); break; } } @@ -479,14 +488,14 @@ static const char * RunningModeString(ThermostatRunningModeEnum runningMode) } } -void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, - uint8_t * value) +void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) { ClusterId clusterId = attributePath.mClusterId; AttributeId attributeId = attributePath.mAttributeId; ChipLogProgress(AppServer, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - ChipLogProgress(AppServer, "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: %d Type: %u Value: %u, length %u", + ChipLogProgress(AppServer, + "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: %d Type: %u Value: %u, length %u", ChipLogValueMEI(attributeId), attributePath.mEndpointId, clusterId, type, *value, size); ThermostatMgr().AttributeChangeHandler(attributePath.mEndpointId, clusterId, attributeId, value, size); diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index 0320bbbdb3a6a7..da122408155568 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -62,7 +62,8 @@ CHIP_ERROR PresetStructWithOwnedMembers::SetPresetHandle(const Nullable kPresetHandleSize) { - ChipLogError(Zcl, "Failed to set Preset handle. New preset handle size (%ld) > allowed preset handle size (%ld)", newPresetHandleSize, kPresetNameSize); + ChipLogError(Zcl, "Failed to set Preset handle. New preset handle size (%ld) > allowed preset handle size (%ld)", + newPresetHandleSize, kPresetNameSize); return CHIP_ERROR_NO_MEMORY; } MutableByteSpan targetSpan(presetHandleData); @@ -84,7 +85,8 @@ CHIP_ERROR PresetStructWithOwnedMembers::SetName(const Optional kPresetNameSize) { - ChipLogError(Zcl, "Failed to set Preset name. New name size (%ld) > allowed preset name size (%ld)", newNameSize, kPresetNameSize); + ChipLogError(Zcl, "Failed to set Preset name. New name size (%ld) > allowed preset name size (%ld)", newNameSize, + kPresetNameSize); return CHIP_ERROR_NO_MEMORY; } MutableCharSpan targetSpan(presetNameData); diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h index 9fc7f5cc3bc77c..7161fb874989e2 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h @@ -37,7 +37,7 @@ static constexpr size_t kPresetHandleSize = 16; static constexpr size_t kPresetNameSize = 64; -struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type +struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type { public: PresetStructWithOwnedMembers() = default; diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h index 5a2a2055c18f2d..4a01e5b5afb585 100644 --- a/src/app/clusters/thermostat-server/thermostat-delegate.h +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -103,10 +103,10 @@ class Delegate virtual CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) = 0; /** - * @brief Updates the presets attribute with the content of the pending presets list. If the preset in the pending presets list matches i.e. has the - * same presetHandle as an existing entry in the Presets attribute, the thermostat will update the entry with the new preset values, otherwise - * it will add a new preset to the Presets attribute. This will be called when the Thermostat receives a CommitPresetsSchedulesRequest - * command to commit the pending preset changes. + * @brief Updates the presets attribute with the content of the pending presets list. If the preset in the pending presets list + * matches i.e. has the same presetHandle as an existing entry in the Presets attribute, the thermostat will update the entry + * with the new preset values, otherwise it will add a new preset to the Presets attribute. This will be called when the + * Thermostat receives a CommitPresetsSchedulesRequest command to commit the pending preset changes. * * @return CHIP_NO_ERROR if the updates to the presets attribute has been committed successfully. * @return CHIP_ERROR if the updates to the presets attribute failed to commit for some reason. diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 2637c58be7c04e..059616b128f97d 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -15,8 +15,8 @@ * limitations under the License. */ -#include "PresetStructWithOwnedMembers.h" #include "thermostat-server.h" +#include "PresetStructWithOwnedMembers.h" #include @@ -77,7 +77,8 @@ Delegate * gDelegateTable[kThermostatEndpointCount] = { nullptr }; Delegate * GetDelegate(EndpointId endpoint) { - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); return (ep >= ArraySize(gDelegateTable) ? nullptr : gDelegateTable[ep]); } @@ -126,8 +127,8 @@ void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) */ void ScheduleTimer(EndpointId endpoint, uint16_t timeoutSeconds) { - DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(timeoutSeconds), - TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(timeoutSeconds), TimerExpiredCallback, + reinterpret_cast(static_cast(endpoint))); } /** @@ -148,8 +149,8 @@ void ClearTimer(EndpointId endpoint) */ void ExtendTimer(EndpointId endpoint, uint16_t timeoutSeconds) { - DeviceLayer::SystemLayer().ExtendTimerTo(System::Clock::Seconds16(timeoutSeconds), - TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); + DeviceLayer::SystemLayer().ExtendTimerTo(System::Clock::Seconds16(timeoutSeconds), TimerExpiredCallback, + reinterpret_cast(static_cast(endpoint))); } /** @@ -174,8 +175,8 @@ bool IsBuiltIn(const PresetStructWithOwnedMembers & preset) */ bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) { - return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() - && preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); + return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && + preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); } /** @@ -188,12 +189,13 @@ bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, con ScopedNodeId GetSourceScopedNodeId(CommandHandler * commandObj) { ScopedNodeId sourceNodeId = ScopedNodeId(); - auto sessionHandle = commandObj->GetExchangeContext()->GetSessionHandle(); + auto sessionHandle = commandObj->GetExchangeContext()->GetSessionHandle(); if (sessionHandle->IsSecureSession()) { sourceNodeId = sessionHandle->AsSecureSession()->GetPeer(); - } else if (sessionHandle->IsGroupSession()) + } + else if (sessionHandle->IsGroupSession()) { sourceNodeId = sessionHandle->AsIncomingGroupSession()->GetPeer(); } @@ -229,7 +231,8 @@ void CleanUp(Delegate * delegate, EndpointId endpoint) * * @return true to indicate the response has been sent and command has been handled. */ -bool SendResponseAndCleanUp(Delegate * delegate, EndpointId endpoint, CommandHandler * commandObj, const ConcreteCommandPath & commandPath, imcode status) +bool SendResponseAndCleanUp(Delegate * delegate, EndpointId endpoint, CommandHandler * commandObj, + const ConcreteCommandPath & commandPath, imcode status) { commandObj->AddStatus(commandPath, status); CleanUp(delegate, endpoint); @@ -256,12 +259,12 @@ bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwne if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) { - break; + break; } if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, - "MatchingPendingPresetExists: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Zcl, "MatchingPendingPresetExists: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); return false; } @@ -283,7 +286,8 @@ bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwne * * @return true if a matching entry was found in the presets attribute list, false otherwise. */ -bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch, PresetStructWithOwnedMembers & matchingPreset) +bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch, + PresetStructWithOwnedMembers & matchingPreset) { VerifyOrReturnValue(delegate != nullptr, false); @@ -293,7 +297,7 @@ bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStructWithOwned if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) { - break; + break; } if (err != CHIP_NO_ERROR) { @@ -327,12 +331,13 @@ bool IsPresetHandlePresentInPresets(Delegate * delegate, const ByteSpan & preset if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) { - return false; + return false; } if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "IsPresetHandlePresentInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Zcl, "IsPresetHandlePresentInPresets: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); return false; } @@ -355,8 +360,8 @@ bool IsPresetHandlePresentInPresets(Delegate * delegate, const ByteSpan & preset */ uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) { - uint8_t numberOfPresets = 0; - uint8_t numberOfMatches = 0; + uint8_t numberOfPresets = 0; + uint8_t numberOfMatches = 0; uint8_t numberOfPendingPresets = 0; VerifyOrReturnValue(delegate != nullptr, 0); @@ -368,12 +373,11 @@ uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) { - break; + break; } if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, - "GetUpdatedPresetsCount: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Zcl, "GetUpdatedPresetsCount: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); return 0; } numberOfPresets++; @@ -393,12 +397,12 @@ uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) { - break; + break; } if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, - "GetUpdatedPresetsCount: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Zcl, "GetUpdatedPresetsCount: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, + err.Format()); return 0; } numberOfPendingPresets++; @@ -436,7 +440,6 @@ bool FindPresetScenarioInPresetTypes(Delegate * delegate, PresetScenarioEnum pre return false; } - /** * @brief Returns the count of preset entries in the pending presets list that have the matching presetHandle. * @param[in] delegate The delegate to use. @@ -647,7 +650,8 @@ namespace Thermostat { void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) { - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); // if endpoint is found, add the delegate in the delegate table if (ep < ArraySize(gDelegateTable)) { @@ -657,7 +661,8 @@ void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) void ThermostatAttrAccess::SetPresetsEditable(EndpointId endpoint, bool presetEditable) { - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); if (ep < ArraySize(mPresetsEditables)) { @@ -668,7 +673,8 @@ void ThermostatAttrAccess::SetPresetsEditable(EndpointId endpoint, bool presetEd bool ThermostatAttrAccess::GetPresetsEditable(EndpointId endpoint) { bool presetEditable = false; - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); if (ep < ArraySize(mPresetsEditables)) { @@ -679,7 +685,8 @@ bool ThermostatAttrAccess::GetPresetsEditable(EndpointId endpoint) void ThermostatAttrAccess::SetOriginatorScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId) { - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) { @@ -690,7 +697,8 @@ void ThermostatAttrAccess::SetOriginatorScopedNodeId(EndpointId endpoint, Scoped ScopedNodeId ThermostatAttrAccess::GetOriginatorScopedNodeId(EndpointId endpoint) { ScopedNodeId originatorNodeId = ScopedNodeId(); - uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) { @@ -847,13 +855,13 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); // #1 Presets are not editable, return INVALID_IN_STATE. - VerifyOrReturnError(gThermostatAttrAccess.GetPresetsEditable(endpoint), - CHIP_IM_GLOBAL_STATUS(InvalidInState), ChipLogError(Zcl, "Presets are not editable")); + VerifyOrReturnError(gThermostatAttrAccess.GetPresetsEditable(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), + ChipLogError(Zcl, "Presets are not editable")); // #2 Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, // otherwise return BUSY. const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); - ScopedNodeId scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); + ScopedNodeId scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != scopedNodeId) { @@ -882,7 +890,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, } else { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); + return CHIP_IM_GLOBAL_STATUS(ConstraintError); } } return iter.GetStatus(); @@ -899,7 +907,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, } else { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); + return CHIP_IM_GLOBAL_STATUS(ConstraintError); } } } @@ -936,9 +944,8 @@ void emberAfThermostatClusterServerInitCallback(chip::EndpointId endpoint) // or should this just be the responsibility of the thermostat application? } -imcode -MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, - EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) +imcode MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) { EndpointId endpoint = attributePath.mEndpointId; int16_t requested; @@ -1260,8 +1267,8 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( // If the preset handle passed in the command is not present in the Presets attribute, return INVALID_COMMAND. if (!IsPresetHandlePresentInPresets(delegate, newPresetHandle)) { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return true; + commandObj->AddStatus(commandPath, imcode::InvalidCommand); + return true; } CHIP_ERROR err = delegate->SetActivePresetHandle(DataModel::MakeNullable(newPresetHandle)); @@ -1287,11 +1294,11 @@ bool emberAfThermostatClusterStartPresetsSchedulesEditRequestCallback( // #1 If the presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command // is not the same as the one that previously originated a StartPresetsSchedulesEditRequest command, return BUSY. - if (gThermostatAttrAccess.GetPresetsEditable(endpoint) - && (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId)) + if (gThermostatAttrAccess.GetPresetsEditable(endpoint) && + (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId)) { - commandObj->AddStatus(commandPath, imcode::Busy); - return true; + commandObj->AddStatus(commandPath, imcode::Busy); + return true; } // #2 If presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command @@ -1321,8 +1328,8 @@ bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( // #1 If presets are not editable, return INVALID_IN_STATE. if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) { - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; } ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); @@ -1331,8 +1338,8 @@ bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( // previous StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) { - commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); - return true; + commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); + return true; } Delegate * delegate = GetDelegate(endpoint); @@ -1386,27 +1393,30 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) { - break; + break; } if (err != CHIP_NO_ERROR) { ChipLogError(Zcl, - "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPresetAtIndex failed with error " + "%" CHIP_ERROR_FORMAT, + err.Format()); return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } bool found = MatchingPendingPresetExists(delegate, preset); - // #3. If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return CONSTRAINT_ERROR. + // #3. If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return + // CONSTRAINT_ERROR. if (IsBuiltIn(preset) && !found) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); } } - // #4. If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle attribute. - // If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle attribute set, continue with - // other checks. + // #4. If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle + // attribute. If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle + // attribute set, continue with other checks. uint8_t buffer[kPresetHandleSize]; MutableByteSpan activePresetHandle(buffer); @@ -1434,12 +1444,14 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) { - break; + break; } if (err != CHIP_NO_ERROR) { ChipLogError(Zcl, - "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPendingPresetAtIndex failed with error %" CHIP_ERROR_FORMAT, err.Format()); + "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPendingPresetAtIndex failed with error " + "%" CHIP_ERROR_FORMAT, + err.Format()); return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } @@ -1534,11 +1546,11 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ResourceExhausted); + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ResourceExhausted); } - // #13 TODO: #25 Check if the number of presets for each presetScenario exceeds the max number of presets supported for that scenario. - // We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. + // #13 TODO: #25 Check if the number of presets for each presetScenario exceeds the max number of presets supported for that + // scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. // Call the delegate API to apply the pending presets to the presets attribute and update it. err = delegate->ApplyPendingPresets(); diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h index fa5ef3281a7868..4f4fae159e1a81 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.h +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -84,7 +84,6 @@ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface bool GetPresetsEditable(EndpointId endpoint); private: - ScopedNodeId mPresetEditRequestOriginatorNodeIds[kThermostatEndpointCount]; bool mPresetsEditables[kThermostatEndpointCount]; From dfe9f7cdee7ba9bea9e9502ee2b084da3cc5e431 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 26 Jul 2024 07:52:54 +0000 Subject: [PATCH 04/63] Restyled by gn. --- examples/thermostat/linux/BUILD.gn | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index d65f6b6648fae9..7530a878da6c11 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -17,12 +17,12 @@ import("//build_overrides/chip.gni") executable("thermostat-app") { sources = [ + "${chip_root}/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp", "include/low-power/LowPowerManager.cpp", "include/low-power/LowPowerManager.h", - "${chip_root}/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp", "main.cpp", - "thermostat-manager.cpp", "thermostat-delegate-impl.cpp", + "thermostat-manager.cpp", ] deps = [ @@ -31,9 +31,7 @@ executable("thermostat-app") { "${chip_root}/src/lib", ] - include_dirs = [ - "include" - ] + include_dirs = [ "include" ] cflags = [ "-Wconversion" ] From 3dad3f356f4ae57bea6a6e9bb85c06dd52ca56aa Mon Sep 17 00:00:00 2001 From: Nivedita Sarkar Date: Fri, 26 Jul 2024 01:09:54 -0700 Subject: [PATCH 05/63] Fix build error for Linux configure build of all-clusters-app --- src/app/clusters/thermostat-server/thermostat-server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 059616b128f97d..a7895849dd319e 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -408,7 +408,7 @@ uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) numberOfPendingPresets++; } - return numberOfPresets + numberOfPendingPresets - numberOfMatches; + return static_cast(numberOfPresets + numberOfPendingPresets - numberOfMatches); } /** From 8e6db6eb83370994cde02dc05767caeef73e7aa9 Mon Sep 17 00:00:00 2001 From: Nivedita Sarkar Date: Fri, 26 Jul 2024 11:19:31 -0700 Subject: [PATCH 06/63] Fix Darwin CI issues Editorial fixes --- .../linux/thermostat-delegate-impl.cpp | 6 +-- .../thermostat/linux/thermostat-manager.cpp | 34 +++++++------- .../thermostat-server/thermostat-server.cpp | 45 +++++++++---------- 3 files changed, 38 insertions(+), 47 deletions(-) diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index 76676383e7b892..b648f9bcda4ce2 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -90,7 +90,6 @@ void ThermostatDelegate::InitializePresets() uint8_t index = 0; for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) { - ChipLogDetail(Zcl, "initializing preset for scenario %hhu", presetScenario); mPresets[index].SetPresetScenario(presetScenario); // Set the preset handle to the preset scenario value as a unique id. @@ -195,10 +194,7 @@ CHIP_ERROR ThermostatDelegate::AppendToPendingPresetList(const PresetStruct::Typ mNextFreeIndexInPendingPresetsList++; return CHIP_NO_ERROR; } - else - { - return CHIP_ERROR_WRITE_FAILED; - } + return CHIP_ERROR_WRITE_FAILED; } CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp index 74b1fd7b600cb4..6134ba5326b523 100644 --- a/examples/thermostat/linux/thermostat-manager.cpp +++ b/examples/thermostat/linux/thermostat-manager.cpp @@ -170,7 +170,6 @@ CHIP_ERROR ThermostatManager::Init() DeviceLayer::PlatformMgr().AddEventHandler(OnPlatformChipDeviceEvent, reinterpret_cast(this)); DeviceLayer::PlatformMgr().ScheduleWork(InitBindingManager); - PlatformMgr().LockChipStack(); mLocalTemperature = GetCurrentTemperature(); mSystemMode = GetSystemMode(); mRunningMode = GetRunningMode(); @@ -179,14 +178,11 @@ CHIP_ERROR ThermostatManager::Init() // TODO: Gotta expose this properly on attribute mOccupiedSetback = 5; // 0.5 C - PlatformMgr().UnlockChipStack(); - ChipLogError(AppServer, "Initialized a thermostat with \n " - "mSystemMode: %hhu (%s) \n mRunningMode: %hhu (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " - "mOccupiedCoolingSetpoint: %d" - "NumberOfPresets: %d", - mSystemMode, SystemModeString(mSystemMode), mRunningMode, RunningModeString(mRunningMode), mLocalTemperature, + "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " + "mOccupiedCoolingSetpoint: %d" "NumberOfPresets: %d", + static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, GetNumberOfPresets()); // TODO: Should this be called later? @@ -253,14 +249,14 @@ void ThermostatManager::ThermostatClusterAttributeChangeHandler(AttributeId attr case SystemMode::Id: { mSystemMode = static_cast(*value); - ChipLogError(AppServer, "System mode changed to %hhu (%s)", mSystemMode, SystemModeString(mSystemMode)); + ChipLogError(AppServer, "System mode changed to %u (%s)", *value, SystemModeString(mSystemMode)); EvalThermostatState(); } break; case ThermostatRunningMode::Id: { mRunningMode = static_cast(*value); - ChipLogError(AppServer, "Running mode changed to %hhu (%s)", mRunningMode, RunningModeString(mRunningMode)); + ChipLogError(AppServer, "Running mode changed to %u (%s)", *value, RunningModeString(mRunningMode)); } break; @@ -276,14 +272,14 @@ SystemModeEnum ThermostatManager::GetSystemMode() { SystemModeEnum systemMode; SystemMode::Get(kThermostatEndpoint, &systemMode); - return static_cast(systemMode); + return systemMode; } ThermostatRunningModeEnum ThermostatManager::GetRunningMode() { ThermostatRunningModeEnum runningMode; ThermostatRunningMode::Get(kThermostatEndpoint, &runningMode); - return static_cast(runningMode); + return runningMode; } int16_t ThermostatManager::GetCurrentTemperature() @@ -315,13 +311,14 @@ uint8_t ThermostatManager::GetNumberOfPresets() CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode) { + uint8_t systemModeValue = static_cast(systemMode); if (mSystemMode == systemMode) { - ChipLogDetail(AppServer, "Already in system mode: %hhu (%s)", systemMode, SystemModeString(systemMode)); + ChipLogDetail(AppServer, "Already in system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); return CHIP_NO_ERROR; } - ChipLogError(AppServer, "Setting system mode: %hhu (%s)", systemMode, SystemModeString(systemMode)); + ChipLogError(AppServer, "Setting system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); Protocols::InteractionModel::Status status = SystemMode::Set(kThermostatEndpoint, systemMode); // TODO: CHIP_ERROR_WRITE_FAILED might not be the best error code to send @@ -330,13 +327,14 @@ CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode) CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMode) { + uint8_t runningModeValue = static_cast(runningMode); if (mRunningMode == runningMode) { - ChipLogDetail(AppServer, "Already in running mode: %hhu (%s)", runningMode, RunningModeString(runningMode)); + ChipLogDetail(AppServer, "Already in running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); return CHIP_NO_ERROR; } - ChipLogError(AppServer, "Setting running mode: %hhu (%s)", runningMode, RunningModeString(runningMode)); + ChipLogError(AppServer, "Setting running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); Protocols::InteractionModel::Status status = ThermostatRunningMode::Set(kThermostatEndpoint, runningMode); // TODO: CHIP_ERROR_WRITE_FAILED might not be the best error code to send @@ -365,12 +363,12 @@ void ThermostatManager::EvalThermostatState() { ChipLogError(AppServer, "Eval Thermostat Running Mode \n " - "mSystemMode: %hhu (%s) \n mRunningMode: %hhu (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " + "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " "mOccupiedCoolingSetpoint: %d", - mSystemMode, SystemModeString(mSystemMode), mRunningMode, RunningModeString(mRunningMode), mLocalTemperature, + static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint); - switch (static_cast(mSystemMode)) + switch (mSystemMode) { case SystemModeEnum::kOff: { SetRunningMode(ThermostatRunningModeEnum::kOff); diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index a7895849dd319e..4554d8dc2be04c 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -854,11 +854,11 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, Delegate * delegate = GetDelegate(endpoint); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); - // #1 Presets are not editable, return INVALID_IN_STATE. + // Presets are not editable, return INVALID_IN_STATE. VerifyOrReturnError(gThermostatAttrAccess.GetPresetsEditable(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), ChipLogError(Zcl, "Presets are not editable")); - // #2 Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, + // Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, // otherwise return BUSY. const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); ScopedNodeId scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); @@ -905,10 +905,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, { return delegate->AppendToPendingPresetList(preset); } - else - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } + return CHIP_IM_GLOBAL_STATUS(ConstraintError); } } break; @@ -1292,7 +1289,7 @@ bool emberAfThermostatClusterStartPresetsSchedulesEditRequestCallback( EndpointId endpoint = commandPath.mEndpointId; - // #1 If the presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command + // If the presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command // is not the same as the one that previously originated a StartPresetsSchedulesEditRequest command, return BUSY. if (gThermostatAttrAccess.GetPresetsEditable(endpoint) && (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId)) @@ -1301,7 +1298,7 @@ bool emberAfThermostatClusterStartPresetsSchedulesEditRequestCallback( return true; } - // #2 If presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command + // If presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command // is the same as the one that previously originated a StartPresetsSchedulesEditRequest command, extend the timer. if (gThermostatAttrAccess.GetPresetsEditable(endpoint)) { @@ -1325,7 +1322,7 @@ bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( { EndpointId endpoint = commandPath.mEndpointId; - // #1 If presets are not editable, return INVALID_IN_STATE. + // If presets are not editable, return INVALID_IN_STATE. if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) { commandObj->AddStatus(commandPath, imcode::InvalidInState); @@ -1334,7 +1331,7 @@ bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); - // #2 If the node id sending the CancelPresetsSchedulesRequest command is not the same as the one which send the + // If the node id sending the CancelPresetsSchedulesRequest command is not the same as the one which send the // previous StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) { @@ -1367,7 +1364,7 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - // #1. If presets are not editable, return INVALID_IN_STATE. + // If presets are not editable, return INVALID_IN_STATE. if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); @@ -1375,7 +1372,7 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); - // #2. If the node id sending the CommitPresetsSchedulesRequest command is not the same as the one which send the + // If the node id sending the CommitPresetsSchedulesRequest command is not the same as the one which send the // StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) { @@ -1406,7 +1403,7 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( bool found = MatchingPendingPresetExists(delegate, preset); - // #3. If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return + // If a built in preset in the Presets attribute list is removed and not found in the pending presets list, return // CONSTRAINT_ERROR. if (IsBuiltIn(preset) && !found) { @@ -1414,7 +1411,7 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( } } - // #4. If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle + // If there is an ActivePresetHandle set, find the preset in the pending presets list that matches the ActivePresetHandle // attribute. If a preset is not found with the same presetHandle, return INVALID_IN_STATE. If there is no ActivePresetHandle // attribute set, continue with other checks. uint8_t buffer[kPresetHandleSize]; @@ -1458,12 +1455,12 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( bool isPendingPresetWithNullPresetHandle = pendingPreset.GetPresetHandle().IsNull(); if (isPendingPresetWithNullPresetHandle) { - // #5. If the presetHandle for a preset is null, the device should set a unique presetHandle. + // If the presetHandle for a preset is null, the device should set a unique presetHandle. const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; pendingPreset.SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); } - // #6. If the preset handle is null and the built in field is set to true, return CONSTRAINT_ERROR. + // If the preset handle is null and the built in field is set to true, return CONSTRAINT_ERROR. if (isPendingPresetWithNullPresetHandle && IsBuiltIn(pendingPreset)) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); @@ -1475,14 +1472,14 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( { foundMatchingPresetInPresets = GetMatchingPresetInPresets(delegate, pendingPreset, matchingPreset); - // #7. If the presetHandle for the pending preset is not null and a matching preset is not found in the + // If the presetHandle for the pending preset is not null and a matching preset is not found in the // presets attribute list, return NOT_FOUND. if (!foundMatchingPresetInPresets) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::NotFound); } - // #8. Find the number of presets in the pending preset list that match the preset handle. If there are duplicate + // Find the number of presets in the pending preset list that match the preset handle. If there are duplicate // entries, return CONSTRAINT_ERROR. uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, pendingPreset.GetPresetHandle().Value()); if (count > 1) @@ -1491,28 +1488,28 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( } } - // #9. If the preset is found in the presets attribute list and the preset is builtIn in the pending presets list + // If the preset is found in the presets attribute list and the preset is builtIn in the pending presets list // but not in the presets attribute list, return UNSUPPORTED_ACCESS. if (foundMatchingPresetInPresets && (IsBuiltIn(pendingPreset) && !IsBuiltIn(matchingPreset))) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); } - // #10. If the preset is found in the presets attribute list and the preset is builtIn in the presets attribute + // If the preset is found in the presets attribute list and the preset is builtIn in the presets attribute // but not in the pending presets list, return UNSUPPORTED_ACCESS. if (foundMatchingPresetInPresets && (!IsBuiltIn(pendingPreset) && IsBuiltIn(matchingPreset))) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); } - // #11. If the presetScenario is not found in the preset types, return CONSTRAINT_ERROR. + // If the presetScenario is not found in the preset types, return CONSTRAINT_ERROR. PresetScenarioEnum presetScenario = pendingPreset.GetPresetScenario(); if (!FindPresetScenarioInPresetTypes(delegate, presetScenario)) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); } - // #12. If the preset type for the preset scenario does not supports names and a name is specified, return CONSTRAINT_ERROR. + // If the preset type for the preset scenario does not supports names and a name is specified, return CONSTRAINT_ERROR. if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); @@ -1542,14 +1539,14 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } - // #12 If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, + // If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ResourceExhausted); } - // #13 TODO: #25 Check if the number of presets for each presetScenario exceeds the max number of presets supported for that + // TODO: Check if the number of presets for each presetScenario exceeds the max number of presets supported for that // scenario. We plan to support only one preset for each presetScenario for our use cases so defer this for re-evaluation. // Call the delegate API to apply the pending presets to the presets attribute and update it. From 362ca128d3e089ce2252ab20b4ca18e3d6db143e Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 26 Jul 2024 18:24:36 +0000 Subject: [PATCH 07/63] Restyled by clang-format --- examples/thermostat/linux/thermostat-manager.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp index 6134ba5326b523..e0ccc9f8ad6de3 100644 --- a/examples/thermostat/linux/thermostat-manager.cpp +++ b/examples/thermostat/linux/thermostat-manager.cpp @@ -181,9 +181,11 @@ CHIP_ERROR ThermostatManager::Init() ChipLogError(AppServer, "Initialized a thermostat with \n " "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " - "mOccupiedCoolingSetpoint: %d" "NumberOfPresets: %d", - static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), RunningModeString(mRunningMode), mLocalTemperature, - mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, GetNumberOfPresets()); + "mOccupiedCoolingSetpoint: %d" + "NumberOfPresets: %d", + static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), + RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, + GetNumberOfPresets()); // TODO: Should this be called later? EvalThermostatState(); @@ -365,8 +367,8 @@ void ThermostatManager::EvalThermostatState() "Eval Thermostat Running Mode \n " "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " "mOccupiedCoolingSetpoint: %d", - static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), RunningModeString(mRunningMode), mLocalTemperature, - mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint); + static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), + RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint); switch (mSystemMode) { From cb966150383464865083e4f4728775dd8c25daac Mon Sep 17 00:00:00 2001 From: Nivedita Sarkar Date: Fri, 26 Jul 2024 11:59:54 -0700 Subject: [PATCH 08/63] More fixes --- .../linux/thermostat-delegate-impl.cpp | 16 ++++------------ .../PresetStructWithOwnedMembers.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index b648f9bcda4ce2..949ea26947cdaf 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -138,8 +138,7 @@ CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(MutableByteSpan & activePre { if (mActivePresetHandleDataSize > 0) { - ByteSpan presetHandleSpan(mActivePresetHandleData, mActivePresetHandleDataSize); - CopySpanToMutableSpan(presetHandleSpan, activePresetHandle); + CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle); } else { @@ -156,8 +155,8 @@ CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable kPresetHandleSize) { ChipLogError(NotSpecified, - "Failed to set ActivePresetHandle. newActivePresetHandle size %ld is larger than preset handle size %ld", - newActivePresetHandleSize, kPresetHandleSize); + "Failed to set ActivePresetHandle. newActivePresetHandle size %u is larger than preset handle size %u", + static_cast(newActivePresetHandleSize), static_cast(kPresetHandleSize)); return CHIP_ERROR_NO_MEMORY; } memcpy(mActivePresetHandleData, newActivePresetHandle.Value().data(), newActivePresetHandleSize); @@ -183,14 +182,7 @@ CHIP_ERROR ThermostatDelegate::AppendToPendingPresetList(const PresetStruct::Typ mPendingPresets[mNextFreeIndexInPendingPresetsList].SetName(preset.name); mPendingPresets[mNextFreeIndexInPendingPresetsList].SetCoolingSetpoint(preset.coolingSetpoint); mPendingPresets[mNextFreeIndexInPendingPresetsList].SetHeatingSetpoint(preset.heatingSetpoint); - if (!preset.builtIn.IsNull()) - { - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(preset.builtIn); - } - else - { - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(NullOptional); - } + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(preset.builtIn); mNextFreeIndexInPendingPresetsList++; return CHIP_NO_ERROR; } diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index da122408155568..279f9fc8052451 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -62,8 +62,8 @@ CHIP_ERROR PresetStructWithOwnedMembers::SetPresetHandle(const Nullable kPresetHandleSize) { - ChipLogError(Zcl, "Failed to set Preset handle. New preset handle size (%ld) > allowed preset handle size (%ld)", - newPresetHandleSize, kPresetNameSize); + ChipLogError(Zcl, "Failed to set Preset handle. New preset handle size (%u) > allowed preset handle size (%u)", + static_cast(newPresetHandleSize), static_cast(kPresetNameSize)); return CHIP_ERROR_NO_MEMORY; } MutableByteSpan targetSpan(presetHandleData); @@ -85,8 +85,8 @@ CHIP_ERROR PresetStructWithOwnedMembers::SetName(const Optional kPresetNameSize) { - ChipLogError(Zcl, "Failed to set Preset name. New name size (%ld) > allowed preset name size (%ld)", newNameSize, - kPresetNameSize); + ChipLogError(Zcl, "Failed to set Preset name. New name size (%u) > allowed preset name size (%u)", static_cast(newNameSize), + static_cast(kPresetNameSize)); return CHIP_ERROR_NO_MEMORY; } MutableCharSpan targetSpan(presetNameData); From 07e78e0cd530831d70456aea2c4feadc02e3b70e Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 26 Jul 2024 19:19:26 +0000 Subject: [PATCH 09/63] Restyled by clang-format --- .../thermostat-server/PresetStructWithOwnedMembers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index 279f9fc8052451..19c40359a1c4c1 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -85,8 +85,8 @@ CHIP_ERROR PresetStructWithOwnedMembers::SetName(const Optional kPresetNameSize) { - ChipLogError(Zcl, "Failed to set Preset name. New name size (%u) > allowed preset name size (%u)", static_cast(newNameSize), - static_cast(kPresetNameSize)); + ChipLogError(Zcl, "Failed to set Preset name. New name size (%u) > allowed preset name size (%u)", + static_cast(newNameSize), static_cast(kPresetNameSize)); return CHIP_ERROR_NO_MEMORY; } MutableCharSpan targetSpan(presetNameData); From 9c511bf5c708453043294247495dd2b84554f057 Mon Sep 17 00:00:00 2001 From: Nivedita Sarkar Date: Fri, 26 Jul 2024 14:49:30 -0700 Subject: [PATCH 10/63] BUILD.gn fixes for CI --- examples/thermostat/linux/BUILD.gn | 1 - src/app/chip_data_model.gni | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index 7530a878da6c11..71c0eccfcfae50 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -17,7 +17,6 @@ import("//build_overrides/chip.gni") executable("thermostat-app") { sources = [ - "${chip_root}/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp", "include/low-power/LowPowerManager.cpp", "include/low-power/LowPowerManager.h", "main.cpp", diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 90b5bd1cfec3f3..e5ac7d0d1b48cd 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -400,6 +400,14 @@ template("chip_data_model") { "${_app_root}/clusters/${cluster}/DefaultThreadNetworkDirectoryStorage.h", "${_app_root}/clusters/${cluster}/ThreadNetworkDirectoryStorage.h", ] + } else if (cluster == "thermostat-server") { + sources += [ + "${_app_root}/clusters/${cluster}/${cluster}.cpp", + "${_app_root}/clusters/${cluster}/${cluster}.h", + "${_app_root}/clusters/${cluster}/PresetStructWithOwnedMembers.cpp", + "${_app_root}/clusters/${cluster}/PresetStructWithOwnedMembers.h", + "${_app_root}/clusters/${cluster}/thermostat-delegate.h", + ] } else { sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ] } From f027069a0da93f74bd697086db5af6a7fe7cd7ae Mon Sep 17 00:00:00 2001 From: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:07:04 -0700 Subject: [PATCH 11/63] Apply suggestions from code review Co-authored-by: Boris Zbarsky --- .../linux/include/thermostat-delegate-impl.h | 4 ++-- .../linux/thermostat-delegate-impl.cpp | 18 +++++------------- .../thermostat/linux/thermostat-manager.cpp | 2 +- .../PresetStructWithOwnedMembers.cpp | 2 +- .../thermostat-server/thermostat-server.cpp | 18 +++++++++--------- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h index 49d0184f6d56e5..dfb36e1957dc26 100644 --- a/examples/thermostat/linux/include/thermostat-delegate-impl.h +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -28,7 +28,7 @@ namespace Thermostat { /** * The ThermostatDelegate class serves as the instance delegate for storing Presets related information and providing it to the * Thermostat server code. It also manages the presets attribute and provides methods to write to presets, edit presets, maintain a - * pending presets list and either commit the presets when requested or discard the changes. It also provide API's to get and set + * pending presets list and either commit the presets when requested or discard the changes. It also provides APIs to get and set * the attribute values. * */ @@ -36,7 +36,7 @@ namespace Thermostat { static constexpr uint8_t kMaxNumberOfPresetTypes = 6; // We will support only one preset of each preset type. -static constexpr uint8_t kMaxNumberOfPresetTypesOfEachType = 1; +static constexpr uint8_t kMaxNumberOfPresetsOfEachType = 1; class ThermostatDelegate : public Delegate { diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index 949ea26947cdaf..04dc3b63f14e84 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -56,7 +56,7 @@ ThermostatDelegate::ThermostatDelegate() InitializePresetTypes(); InitializePresets(); - memset(mActivePresetHandleData, 0, kPresetHandleSize); + memset(mActivePresetHandleData, 0, sizeof(mActivePresetHandleData)); mActivePresetHandleDataSize = 0; } @@ -83,7 +83,7 @@ void ThermostatDelegate::InitializePresetTypes() void ThermostatDelegate::InitializePresets() { - // Initilaize the presets with 2 built in presets - occupied and unoccupied. + // Initialize the presets with 2 built in presets - occupied and unoccupied. PresetScenarioEnum presetScenarioEnumArray[2] = { PresetScenarioEnum::kOccupied, PresetScenarioEnum::kUnoccupied }; static_assert(ArraySize(presetScenarioEnumArray) <= ArraySize(mPresets)); @@ -136,15 +136,7 @@ CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, PresetStructWithOw CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(MutableByteSpan & activePresetHandle) { - if (mActivePresetHandleDataSize > 0) - { - CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle); - } - else - { - activePresetHandle.reduce_size(0); - } - return CHIP_NO_ERROR; + return CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle); } CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) @@ -152,7 +144,7 @@ CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable kPresetHandleSize) + if (newActivePresetHandleSize > sizeof(mActivePresetHandleData)) { ChipLogError(NotSpecified, "Failed to set ActivePresetHandle. newActivePresetHandle size %u is larger than preset handle size %u", @@ -166,7 +158,7 @@ CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable currentTemperature; currentTemperature.SetNull(); LocalTemperature::Get(kThermostatEndpoint, currentTemperature); - return (!currentTemperature.IsNull()) ? currentTemperature.Value() : 0; + return currentTemperature.ValueOr(0); } int16_t ThermostatManager::GetCurrentHeatingSetPoint() diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index 19c40359a1c4c1..86f354192540e6 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -86,7 +86,7 @@ CHIP_ERROR PresetStructWithOwnedMembers::SetName(const Optional kPresetNameSize) { ChipLogError(Zcl, "Failed to set Preset name. New name size (%u) > allowed preset name size (%u)", - static_cast(newNameSize), static_cast(kPresetNameSize)); + static_cast(newNameSize), static_cast(kPresetNameSize)); return CHIP_ERROR_NO_MEMORY; } MutableCharSpan targetSpan(presetNameData); diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 4554d8dc2be04c..81a1b9c31ca9ad 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -92,13 +92,13 @@ Delegate * GetDelegate(EndpointId endpoint) */ bool IsValidPresetEntry(const PresetStruct::Type & preset) { - // If the presetHandle is not null, the size of the handle does not exceed 16 bytes, return true. + // Check that the preset handle is not too long. if (!preset.presetHandle.IsNull() && preset.presetHandle.Value().size() > kPresetHandleSize) { return false; } - // Return true if the preset scenario is valid, false otherwise. + // Ensure we have a valid PresetScenario. return (preset.presetScenario != PresetScenarioEnum::kUnknownEnumValue); } @@ -419,7 +419,7 @@ uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) * * @return true if the presetScenario is found, false otherwise. */ -bool FindPresetScenarioInPresetTypes(Delegate * delegate, PresetScenarioEnum presetScenario) +bool PresetScenarioExistsInPresetTypes(Delegate * delegate, PresetScenarioEnum presetScenario) { VerifyOrReturnValue(delegate != nullptr, false); @@ -786,7 +786,7 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A Delegate * delegate = GetDelegate(aPath.mEndpointId); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); - ReturnErrorOnFailure(aEncoder.Encode(gThermostatAttrAccess.GetPresetsEditable(aPath.mEndpointId))); + ReturnErrorOnFailure(aEncoder.Encode(GetPresetsEditable(aPath.mEndpointId))); } break; case ActivePresetHandle::Id: { @@ -855,7 +855,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); // Presets are not editable, return INVALID_IN_STATE. - VerifyOrReturnError(gThermostatAttrAccess.GetPresetsEditable(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), + VerifyOrReturnError(GetPresetsEditable(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), ChipLogError(Zcl, "Presets are not editable")); // Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, @@ -863,7 +863,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); ScopedNodeId scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); - if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != scopedNodeId) + if (GetOriginatorScopedNodeId(endpoint) != scopedNodeId) { ChipLogError(Zcl, "Another node is editing presets. Server is busy. Try again later"); return CHIP_IM_GLOBAL_STATUS(Busy); @@ -1273,7 +1273,7 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( if (err != CHIP_NO_ERROR) { ChipLogError(Zcl, "Failed to set ActivePresetHandle with error %" CHIP_ERROR_FORMAT, err.Format()); - commandObj->AddStatus(commandPath, imcode::Failure); + commandObj->AddStatus(commandPath, StatusIB(err).mStatus); return true; } @@ -1509,7 +1509,7 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); } - // If the preset type for the preset scenario does not supports names and a name is specified, return CONSTRAINT_ERROR. + // If the preset type for the preset scenario does not supports name and a name is specified, return CONSTRAINT_ERROR. if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); @@ -1522,7 +1522,7 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( pendingPreset.SetCoolingSetpoint(MakeOptional(EnforceCoolingSetpointLimits(coolingSetpointValue.Value(), endpoint))); } - Optional heatingSetpointValue = preset.GetHeatingSetpoint(); + Optional heatingSetpointValue = pendingPreset.GetHeatingSetpoint(); if (heatingSetpointValue.HasValue()) { pendingPreset.SetHeatingSetpoint(MakeOptional(EnforceHeatingSetpointLimits(heatingSetpointValue.Value(), endpoint))); From a2bb5d6110427a4056b96b52c71448f96a254bc4 Mon Sep 17 00:00:00 2001 From: Nivedita Sarkar Date: Fri, 26 Jul 2024 20:38:09 -0700 Subject: [PATCH 12/63] Address review comments. --- .../air-purifier-app.matter | 2 +- .../all-clusters-app.matter | 2 +- .../all-clusters-minimal-app.matter | 2 +- ...umiditysensor_thermostat_56de3d5f45.matter | 2 +- ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 2 +- ...tnode_roomairconditioner_9cf3607804.matter | 2 +- .../rootnode_thermostat_bm3fb8dhYi.matter | 2 +- .../placeholder/linux/apps/app1/config.matter | 4 +- .../placeholder/linux/apps/app2/config.matter | 4 +- .../linux/include/thermostat-delegate-impl.h | 5 +- .../linux/thermostat-delegate-impl.cpp | 9 ++- .../thermostat/linux/thermostat-manager.cpp | 60 +++++++++---------- .../nxp/zap/thermostat_matter_thread.matter | 2 +- .../nxp/zap/thermostat_matter_wifi.matter | 2 +- .../qpg/zap/thermostaticRadiatorValve.matter | 2 +- .../thermostat-common/thermostat.matter | 2 +- .../thermostat-server/thermostat-delegate.h | 10 ++-- .../thermostat-server/thermostat-server.cpp | 38 ++++++------ .../thermostat-server/thermostat-server.h | 2 +- .../data-model/chip/thermostat-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../python/chip/clusters/Objects.py | 4 +- .../CHIP/zap-generated/MTRBaseClusters.h | 2 +- .../app-common/zap-generated/cluster-enums.h | 4 +- 24 files changed, 87 insertions(+), 81 deletions(-) diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index 9e3b6da2deaa71..b9daf0cb550080 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1278,7 +1278,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { 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 719f13ce379f84..59886807143f6f 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 @@ -5007,7 +5007,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 224d37a2a32af1..c8fa5ea7e1c6e1 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -3552,7 +3552,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index 1eb8cd15cabcc9..27e38141a4e1b6 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1201,7 +1201,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 7ae87d191298b2..22111d45d62eab 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -1558,7 +1558,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index c21a5adf0fdb78..66d34c451a7f92 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1141,7 +1141,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index e76f99dd0e63e7..eb6b301b559a3c 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1361,7 +1361,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index dff3bdb93c0011..5b91706480d3f9 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -4798,7 +4798,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -5148,7 +5148,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 10a4ff89f5285c..3499926c146506 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -4755,7 +4755,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { @@ -5105,7 +5105,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h index dfb36e1957dc26..c4daef5fde1d6a 100644 --- a/examples/thermostat/linux/include/thermostat-delegate-impl.h +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -35,6 +35,7 @@ namespace Thermostat { static constexpr uint8_t kMaxNumberOfPresetTypes = 6; +// TODO: #34556 Support multiple presets of each type. // We will support only one preset of each preset type. static constexpr uint8_t kMaxNumberOfPresetsOfEachType = 1; @@ -83,8 +84,8 @@ class ThermostatDelegate : public Delegate uint8_t mNumberOfPresets; Structs::PresetTypeStruct::Type mPresetTypes[kMaxNumberOfPresetTypes]; - PresetStructWithOwnedMembers mPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType]; - PresetStructWithOwnedMembers mPendingPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType]; + PresetStructWithOwnedMembers mPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType]; + PresetStructWithOwnedMembers mPendingPresets[kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType]; uint8_t mNextFreeIndexInPendingPresetsList; uint8_t mNextFreeIndexInPresetsList; diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index 04dc3b63f14e84..fa7bd9a259a475 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -49,7 +49,7 @@ bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, con ThermostatDelegate::ThermostatDelegate() { - mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetTypesOfEachType; + mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType; mNextFreeIndexInPresetsList = 0; mNextFreeIndexInPendingPresetsList = 0; @@ -72,7 +72,7 @@ void ThermostatDelegate::InitializePresetTypes() for (PresetScenarioEnum presetScenario : presetScenarioEnumArray) { mPresetTypes[index].presetScenario = presetScenario; - mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetTypesOfEachType; + mPresetTypes[index].numberOfPresets = kMaxNumberOfPresetsOfEachType; mPresetTypes[index].presetTypeFeatures = (presetScenario == PresetScenarioEnum::kOccupied || presetScenario == PresetScenarioEnum::kUnoccupied) ? PresetTypeFeaturesBitmap::kAutomatic @@ -193,6 +193,8 @@ CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStruc CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() { + + // TODO: #34546 - Need to support deletion of presets that are removed from Presets. for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) { const PresetStructWithOwnedMembers & pendingPreset = mPendingPresets[indexInPendingPresets]; @@ -215,6 +217,9 @@ CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() mPresets[mNextFreeIndexInPresetsList] = pendingPreset; + // TODO: #34556 Since we support only one preset of each type, using the octet string containing the preset scenario + // suffices as the unique preset handle. Need to fix this to actually provide unique handles once multiple presets of + // each type are supported. const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; mPresets[mNextFreeIndexInPresetsList].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); mNextFreeIndexInPresetsList++; diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp index ad5bdb7b700a18..526c38f9fb375c 100644 --- a/examples/thermostat/linux/thermostat-manager.cpp +++ b/examples/thermostat/linux/thermostat-manager.cpp @@ -42,6 +42,7 @@ using namespace chip::app::Clusters::Thermostat::Structs; using namespace chip::app::Clusters::Thermostat::Attributes; using namespace chip::app::Clusters::TemperatureMeasurement; using namespace chip::app::Clusters::TemperatureMeasurement::Attributes; +using namespace Protocols::InteractionModel; using namespace chip::DeviceLayer; @@ -60,6 +61,12 @@ ThermostatManager ThermostatManager::sThermostatMgr; namespace { +CHIP_ERROR ChipErrorFromStatusCode(Status status) +{ + StatusIB statusIB(status); + return statusIB.ToChipError(); +} + template static void OnAttributeChangeReported(const ConcreteDataAttributePath & path, const DecodableAttributeType & value); @@ -70,30 +77,30 @@ void OnAttributeChangeReported(const Con ClusterId clusterId = path.mClusterId; if (clusterId != TemperatureMeasurement::Id) { - ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id %u", - clusterId); + ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id " ChipLogFormatMEI, + ChipLogValueMEI(clusterId)); return; } AttributeId attributeId = path.mAttributeId; if (attributeId != MeasuredValue::Id) { - ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute %u", - attributeId); + ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute" ChipLogFormatMEI, + ChipLogValueMEI(attributeId)); return; } if (!value.IsNull()) { ChipLogDetail(AppServer, "Attribute change reported for TemperatureMeasurement cluster - MeasuredValue is %d", - static_cast(value.Value())); + value.Value()); } } static void OnError(const ConcreteDataAttributePath * path, ChipError err) { - ChipLogError(AppServer, "Subscribing to cluster Id %u and attribute Id %u failed with error %" CHIP_ERROR_FORMAT, - path->mClusterId, path->mAttributeId, err.Format()); + ChipLogError(AppServer, "Subscribing to cluster Id " ChipLogFormatMEI " and attribute Id " ChipLogFormatMEI " failed with error %" CHIP_ERROR_FORMAT, + ChipLogValueMEI(path->mClusterId), ChipLogValueMEI(path->mAttributeId), err.Format()); } static void OnSubscriptionEstablished(const ReadClient & client, unsigned int value) @@ -111,7 +118,7 @@ void SubscribeToAttribute(ClusterId clusterId, AttributeId attributeId, const Em SubscribeAttribute( peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, clusterId, attributeId, &OnAttributeChangeReported, &OnError, 0, kMaxIntervalCeilingSeconds, &OnSubscriptionEstablished, - nullptr, true /* fabricFiltered */, true /* keepExistingSubscription */); + nullptr, true /* fabricFiltered */, false /* keepExistingSubscription */); } static void ThermostatBoundDeviceChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, @@ -183,7 +190,7 @@ CHIP_ERROR ThermostatManager::Init() "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " "mOccupiedCoolingSetpoint: %d" "NumberOfPresets: %d", - static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), + to_underlying(mSystemMode), SystemModeString(mSystemMode), to_underlying(mRunningMode), RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint, GetNumberOfPresets()); @@ -229,21 +236,21 @@ void ThermostatManager::ThermostatClusterAttributeChangeHandler(AttributeId attr switch (attributeId) { case LocalTemperature::Id: { - mLocalTemperature = static_cast(Encoding::LittleEndian::Get16(value)); + memcpy(&mLocalTemperature, value, size); ChipLogError(AppServer, "Local temperature changed to %d", mLocalTemperature); EvalThermostatState(); } break; case OccupiedCoolingSetpoint::Id: { - mOccupiedCoolingSetpoint = static_cast(Encoding::LittleEndian::Get16(value)); + memcpy(&mOccupiedCoolingSetpoint, value, size); ChipLogError(AppServer, "Cooling temperature changed to %d", mOccupiedCoolingSetpoint); EvalThermostatState(); } break; case OccupiedHeatingSetpoint::Id: { - mOccupiedHeatingSetpoint = static_cast(Encoding::LittleEndian::Get16(value)); + memcpy(&mOccupiedHeatingSetpoint, value, size); ChipLogError(AppServer, "Heating temperature changed to %d", mOccupiedHeatingSetpoint); EvalThermostatState(); } @@ -313,7 +320,7 @@ uint8_t ThermostatManager::GetNumberOfPresets() CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode) { - uint8_t systemModeValue = static_cast(systemMode); + uint8_t systemModeValue = to_underlying(systemMode); if (mSystemMode == systemMode) { ChipLogDetail(AppServer, "Already in system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); @@ -321,15 +328,12 @@ CHIP_ERROR ThermostatManager::SetSystemMode(SystemModeEnum systemMode) } ChipLogError(AppServer, "Setting system mode: %u (%s)", systemModeValue, SystemModeString(systemMode)); - Protocols::InteractionModel::Status status = SystemMode::Set(kThermostatEndpoint, systemMode); - - // TODO: CHIP_ERROR_WRITE_FAILED might not be the best error code to send - return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; + return ChipErrorFromStatusCode(SystemMode::Set(kThermostatEndpoint, systemMode)); } CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMode) { - uint8_t runningModeValue = static_cast(runningMode); + uint8_t runningModeValue = to_underlying(runningMode); if (mRunningMode == runningMode) { ChipLogDetail(AppServer, "Already in running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); @@ -337,28 +341,22 @@ CHIP_ERROR ThermostatManager::SetRunningMode(ThermostatRunningModeEnum runningMo } ChipLogError(AppServer, "Setting running mode: %u (%s)", runningModeValue, RunningModeString(runningMode)); - Protocols::InteractionModel::Status status = ThermostatRunningMode::Set(kThermostatEndpoint, runningMode); - - // TODO: CHIP_ERROR_WRITE_FAILED might not be the best error code to send - return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; + return ChipErrorFromStatusCode(ThermostatRunningMode::Set(kThermostatEndpoint, runningMode)); } CHIP_ERROR ThermostatManager::SetCurrentTemperature(int16_t temperature) { - Protocols::InteractionModel::Status status = LocalTemperature::Set(kThermostatEndpoint, temperature); - return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; + return ChipErrorFromStatusCode(LocalTemperature::Set(kThermostatEndpoint, temperature)); } CHIP_ERROR ThermostatManager::SetCurrentHeatingSetPoint(int16_t heatingSetpoint) { - Protocols::InteractionModel::Status status = OccupiedHeatingSetpoint::Set(kThermostatEndpoint, heatingSetpoint); - return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; + return ChipErrorFromStatusCode(OccupiedHeatingSetpoint::Set(kThermostatEndpoint, heatingSetpoint)); } CHIP_ERROR ThermostatManager::SetCurrentCoolingSetPoint(int16_t coolingSetpoint) { - Protocols::InteractionModel::Status status = OccupiedCoolingSetpoint::Set(kThermostatEndpoint, coolingSetpoint); - return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR : CHIP_ERROR_WRITE_FAILED; + return ChipErrorFromStatusCode(OccupiedCoolingSetpoint::Set(kThermostatEndpoint, coolingSetpoint)); } void ThermostatManager::EvalThermostatState() @@ -367,7 +365,7 @@ void ThermostatManager::EvalThermostatState() "Eval Thermostat Running Mode \n " "mSystemMode: %u (%s) \n mRunningMode: %u (%s) \n mLocalTemperature: %d \n mOccupiedHeatingSetpoint: %d \n " "mOccupiedCoolingSetpoint: %d", - static_cast(mSystemMode), SystemModeString(mSystemMode), static_cast(mRunningMode), + to_underlying(mSystemMode), SystemModeString(mSystemMode), to_underlying(mRunningMode), RunningModeString(mRunningMode), mLocalTemperature, mOccupiedHeatingSetpoint, mOccupiedCoolingSetpoint); switch (mSystemMode) @@ -495,8 +493,8 @@ void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePa ChipLogProgress(AppServer, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); ChipLogProgress(AppServer, - "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: %d Type: %u Value: %u, length %u", - ChipLogValueMEI(attributeId), attributePath.mEndpointId, clusterId, type, *value, size); + "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: " ChipLogFormatMEI " Type: %u Value: %u, length %u", + ChipLogValueMEI(attributeId), attributePath.mEndpointId, ChipLogValueMEI(clusterId), type, *value, size); ThermostatMgr().AttributeChangeHandler(attributePath.mEndpointId, clusterId, attributeId, value, size); } diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 8a0304c57b1e13..76dace386a25f2 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -1952,7 +1952,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 3d823c4fb62a85..f8154996ad20e2 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -1863,7 +1863,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index 6f8adc8f2cf3f6..8060f63590c3c4 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -1560,7 +1560,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 9209bdff98df28..f7139b07b43595 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -1740,7 +1740,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h index 4a01e5b5afb585..86c1e532b92fc2 100644 --- a/src/app/clusters/thermostat-server/thermostat-delegate.h +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -27,8 +27,9 @@ namespace Clusters { namespace Thermostat { /** @brief - * Defines methods for implementing application-specific logic for the extensions to the thermostat cluster. - * It defines the interfaces that a thermostat should implement to support Presets and other extension features. + * Defines methods for implementing application-specific logic for handling Presets in the thermostat cluster. + * It defines the interfaces that a thermostat should implement to enable support for reading and writing the + * Presets attribute and reading and writing the ActivePresetHandle attribute. */ class Delegate { @@ -105,8 +106,9 @@ class Delegate /** * @brief Updates the presets attribute with the content of the pending presets list. If the preset in the pending presets list * matches i.e. has the same presetHandle as an existing entry in the Presets attribute, the thermostat will update the entry - * with the new preset values, otherwise it will add a new preset to the Presets attribute. This will be called when the - * Thermostat receives a CommitPresetsSchedulesRequest command to commit the pending preset changes. + * with the new preset values, otherwise it will add a new preset to the Presets attribute. For new presets that get added, + * it is the responsibility of this API to allocate unique preset handles to the presets before saving the preset. This will be + * called when the Thermostat receives a CommitPresetsSchedulesRequest command to commit the pending preset changes. * * @return CHIP_NO_ERROR if the updates to the presets attribute has been committed successfully. * @return CHIP_ERROR if the updates to the presets attribute failed to commit for some reason. diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 81a1b9c31ca9ad..2aed5ab9bb0610 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -408,6 +408,8 @@ uint8_t CountUpdatedPresetsAfterApplyingPendingPresets(Delegate * delegate) numberOfPendingPresets++; } + // TODO: #34546 - Need to support deletion of presets that are removed from Presets. + // This API needs to modify its logic for the deletion case. return static_cast(numberOfPresets + numberOfPendingPresets - numberOfMatches); } @@ -471,12 +473,12 @@ uint8_t CountPresetsInPendingListWithPresetHandle(Delegate * delegate, const Byt } /** - * @brief Checks if the presetType for the given preset scenario supports names in the presetTypeFeatures bitmap. + * @brief Checks if the presetType for the given preset scenario supports name in the presetTypeFeatures bitmap. * * @param[in] delegate The delegate to use. * @param[in] presetScenario The presetScenario to match with. * - * @return true if the presetType for the given preset scenario supports names, false otherwise. + * @return true if the presetType for the given preset scenario supports name, false otherwise. */ bool PresetTypeSupportsNames(Delegate * delegate, PresetScenarioEnum scenario) { @@ -493,7 +495,7 @@ bool PresetTypeSupportsNames(Delegate * delegate, PresetScenarioEnum scenario) if (presetType.presetScenario == scenario) { - return (presetType.presetTypeFeatures == PresetTypeFeaturesBitmap::kSupportsNames); + return (presetType.presetTypeFeatures.Has(PresetTypeFeaturesBitmap::kSupportsNames)); } } return false; @@ -783,9 +785,6 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A } break; case PresetsSchedulesEditable::Id: { - Delegate * delegate = GetDelegate(aPath.mEndpointId); - VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); - ReturnErrorOnFailure(aEncoder.Encode(GetPresetsEditable(aPath.mEndpointId))); } break; @@ -861,7 +860,13 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, // otherwise return BUSY. const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); - ScopedNodeId scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); + ScopedNodeId scopedNodeId = ScopedNodeId(); + + // Get the node id if the authentication mode is CASE. + if (subjectDescriptor.authMode == Access::AuthMode::kCase) + { + scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); + } if (GetOriginatorScopedNodeId(endpoint) != scopedNodeId) { @@ -941,7 +946,7 @@ void emberAfThermostatClusterServerInitCallback(chip::EndpointId endpoint) // or should this just be the responsibility of the thermostat application? } -imcode MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, +Protocols::InteractionModel::Status MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) { EndpointId endpoint = attributePath.mEndpointId; @@ -1376,7 +1381,8 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( // StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); + return true; } PresetStructWithOwnedMembers preset; @@ -1453,12 +1459,6 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( } bool isPendingPresetWithNullPresetHandle = pendingPreset.GetPresetHandle().IsNull(); - if (isPendingPresetWithNullPresetHandle) - { - // If the presetHandle for a preset is null, the device should set a unique presetHandle. - const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; - pendingPreset.SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); - } // If the preset handle is null and the built in field is set to true, return CONSTRAINT_ERROR. if (isPendingPresetWithNullPresetHandle && IsBuiltIn(pendingPreset)) @@ -1504,19 +1504,19 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( // If the presetScenario is not found in the preset types, return CONSTRAINT_ERROR. PresetScenarioEnum presetScenario = pendingPreset.GetPresetScenario(); - if (!FindPresetScenarioInPresetTypes(delegate, presetScenario)) + if (!PresetScenarioExistsInPresetTypes(delegate, presetScenario)) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); } - // If the preset type for the preset scenario does not supports name and a name is specified, return CONSTRAINT_ERROR. + // If the preset type for the preset scenario does not support name and a name is specified, return CONSTRAINT_ERROR. if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); } - // Enforce the Setpoint Limits for both the cooling and heating - Optional coolingSetpointValue = preset.GetCoolingSetpoint(); + // Enforce the Setpoint Limits for both the cooling and heating setpoints in the pending preset. + Optional coolingSetpointValue = pendingPreset.GetCoolingSetpoint(); if (coolingSetpointValue.HasValue()) { pendingPreset.SetCoolingSetpoint(MakeOptional(EnforceCoolingSetpointLimits(coolingSetpointValue.Value(), endpoint))); diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h index 4f4fae159e1a81..955ab9e5c5a777 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.h +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -17,7 +17,7 @@ /**************************************************************************** * @file - * @brief APIs for the Thermostat cluster extension. + * @brief APIs for the Thermostat cluster. * ******************************************************************************* ******************************************************************************/ diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index 982ea0e9f7b73e..0e2de159d0b6d0 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -201,7 +201,7 @@ limitations under the License. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 78a39945cd932e..626ebc5bcfa446 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6590,7 +6590,7 @@ cluster Thermostat = 513 { kWake = 4; kVacation = 5; kGoingToSleep = 6; - kUserDefined = 7; + kUserDefined = 254; } enum SetpointChangeSourceEnum : enum8 { diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 3eef2869c8ba6e..480ab3e7d0226c 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -32198,12 +32198,12 @@ class PresetScenarioEnum(MatterIntEnum): kWake = 0x04 kVacation = 0x05 kGoingToSleep = 0x06 - kUserDefined = 0x07 + kUserDefined = 0xFE # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving and unknown # enum value. This specific should never be transmitted. - kUnknownEnumValue = 8, + kUnknownEnumValue = 7, class SetpointChangeSourceEnum(MatterIntEnum): kManual = 0x00 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 3e603ff3763437..bcdee4fc6798b6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -19743,7 +19743,7 @@ typedef NS_ENUM(uint8_t, MTRThermostatPresetScenario) { MTRThermostatPresetScenarioWake MTR_PROVISIONALLY_AVAILABLE = 0x04, MTRThermostatPresetScenarioVacation MTR_PROVISIONALLY_AVAILABLE = 0x05, MTRThermostatPresetScenarioGoingToSleep MTR_PROVISIONALLY_AVAILABLE = 0x06, - MTRThermostatPresetScenarioUserDefined MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTRThermostatPresetScenarioUserDefined MTR_PROVISIONALLY_AVAILABLE = 0xFE, } MTR_PROVISIONALLY_AVAILABLE; typedef NS_ENUM(uint8_t, MTRThermostatSetpointChangeSource) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index c18204ae3327df..d8092bee42e3ea 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -3936,12 +3936,12 @@ enum class PresetScenarioEnum : uint8_t kWake = 0x04, kVacation = 0x05, kGoingToSleep = 0x06, - kUserDefined = 0x07, + kUserDefined = 0xFE, // All received enum values that are not listed above will be mapped // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 8, + kUnknownEnumValue = 7, }; // Enum for SetpointChangeSourceEnum From 0147c71725caa2189986c7b928b1354c4bb6cec9 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 27 Jul 2024 03:51:23 +0000 Subject: [PATCH 13/63] Restyled by clang-format --- examples/thermostat/linux/thermostat-manager.cpp | 13 +++++++++---- .../thermostat-server/thermostat-server.cpp | 7 ++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp index 526c38f9fb375c..00266161007d59 100644 --- a/examples/thermostat/linux/thermostat-manager.cpp +++ b/examples/thermostat/linux/thermostat-manager.cpp @@ -77,7 +77,8 @@ void OnAttributeChangeReported(const Con ClusterId clusterId = path.mClusterId; if (clusterId != TemperatureMeasurement::Id) { - ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id " ChipLogFormatMEI, + ChipLogError(AppServer, + "Attribute change reported for TemperatureMeasurement cluster on incorrect cluster id " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); return; } @@ -85,7 +86,8 @@ void OnAttributeChangeReported(const Con AttributeId attributeId = path.mAttributeId; if (attributeId != MeasuredValue::Id) { - ChipLogError(AppServer, "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute" ChipLogFormatMEI, + ChipLogError(AppServer, + "Attribute change reported for TemperatureMeasurement cluster for incorrect attribute" ChipLogFormatMEI, ChipLogValueMEI(attributeId)); return; } @@ -99,7 +101,9 @@ void OnAttributeChangeReported(const Con static void OnError(const ConcreteDataAttributePath * path, ChipError err) { - ChipLogError(AppServer, "Subscribing to cluster Id " ChipLogFormatMEI " and attribute Id " ChipLogFormatMEI " failed with error %" CHIP_ERROR_FORMAT, + ChipLogError(AppServer, + "Subscribing to cluster Id " ChipLogFormatMEI " and attribute Id " ChipLogFormatMEI + " failed with error %" CHIP_ERROR_FORMAT, ChipLogValueMEI(path->mClusterId), ChipLogValueMEI(path->mAttributeId), err.Format()); } @@ -493,7 +497,8 @@ void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePa ChipLogProgress(AppServer, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); ChipLogProgress(AppServer, - "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: " ChipLogFormatMEI " Type: %u Value: %u, length %u", + "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: " ChipLogFormatMEI + " Type: %u Value: %u, length %u", ChipLogValueMEI(attributeId), attributePath.mEndpointId, ChipLogValueMEI(clusterId), type, *value, size); ThermostatMgr().AttributeChangeHandler(attributePath.mEndpointId, clusterId, attributeId, value, size); diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 2aed5ab9bb0610..fe6cbb28e7d5d3 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -860,7 +860,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, // otherwise return BUSY. const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); - ScopedNodeId scopedNodeId = ScopedNodeId(); + ScopedNodeId scopedNodeId = ScopedNodeId(); // Get the node id if the authentication mode is CASE. if (subjectDescriptor.authMode == Access::AuthMode::kCase) @@ -946,8 +946,9 @@ void emberAfThermostatClusterServerInitCallback(chip::EndpointId endpoint) // or should this just be the responsibility of the thermostat application? } -Protocols::InteractionModel::Status MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, - EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) +Protocols::InteractionModel::Status +MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, uint8_t * value) { EndpointId endpoint = attributePath.mEndpointId; int16_t requested; From 029e9a45006c22314e51791420c15b6e74c4d060 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 28 Jul 2024 07:31:58 -0400 Subject: [PATCH 14/63] Regenerate Thermostat XML from spec --- .../data-model/chip/thermostat-cluster.xml | 249 +++++++++--------- 1 file changed, 126 insertions(+), 123 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index 0e2de159d0b6d0..e9c16b39bb0d6b 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -35,6 +35,11 @@ limitations under the License. + + + + + @@ -92,6 +97,13 @@ limitations under the License. + + + + + + + @@ -145,7 +157,7 @@ limitations under the License. - + @@ -194,7 +206,6 @@ limitations under the License. - @@ -204,10 +215,16 @@ limitations under the License. + + + + + + - + @@ -219,20 +236,19 @@ limitations under the License. - - + - + - + @@ -244,7 +260,7 @@ limitations under the License. - + @@ -265,15 +281,14 @@ limitations under the License. THERMOSTAT_CLUSTER true true - - + - + @@ -281,7 +296,7 @@ limitations under the License. - + @@ -304,59 +319,52 @@ limitations under the License. - - - - + - + - - - LocalTemperature - OutdoorTemperature - Occupancy - - AbsMinHeatSetpointLimit - AbsMaxHeatSetpointLimit - AbsMinCoolSetpointLimit - AbsMaxCoolSetpointLimit - PICoolingDemand - PIHeatingDemand - + LocalTemperature + OutdoorTemperature + Occupancy + AbsMinHeatSetpointLimit + AbsMaxHeatSetpointLimit + AbsMinCoolSetpointLimit + AbsMaxCoolSetpointLimit + PICoolingDemand + PIHeatingDemand + HVACSystemTypeConfiguration - - + LocalTemperatureCalibration - OccupiedCoolingSetpoint - OccupiedHeatingSetpoint - UnoccupiedCoolingSetpoint - UnoccupiedHeatingSetpoint - + OccupiedCoolingSetpoint + OccupiedHeatingSetpoint + UnoccupiedCoolingSetpoint + UnoccupiedHeatingSetpoint + MinHeatSetpointLimit - + MaxHeatSetpointLimit - + MinCoolSetpointLimit - + MaxCoolSetpointLimit - + MinSetpointDeadBand @@ -364,23 +372,23 @@ limitations under the License. RemoteSensing - + ControlSequenceOfOperation - + SystemMode - ThermostatRunningMode - StartOfWeek - NumberOfWeeklyTransitions - NumberOfDailyTransitions + ThermostatRunningMode + StartOfWeek + NumberOfWeeklyTransitions + NumberOfDailyTransitions TemperatureSetpointHold - + TemperatureSetpointHoldDuration @@ -388,23 +396,23 @@ limitations under the License. ThermostatProgrammingOperationMode - ThermostatRunningState - SetpointChangeSource - SetpointChangeAmount - SetpointChangeSourceTimestamp - + ThermostatRunningState + SetpointChangeSource + SetpointChangeAmount + SetpointChangeSourceTimestamp + OccupiedSetback - OccupiedSetbackMin - OccupiedSetbackMax - + OccupiedSetbackMin + OccupiedSetbackMax + UnoccupiedSetback - UnoccupiedSetbackMin - UnoccupiedSetbackMax - + UnoccupiedSetbackMin + UnoccupiedSetbackMax + EmergencyHeatDelta @@ -412,7 +420,7 @@ limitations under the License. ACType - + ACCapacity @@ -424,7 +432,7 @@ limitations under the License. ACCompressorType - + ACErrorCode @@ -432,93 +440,88 @@ limitations under the License. ACLouverPosition - ACCoilTemperature - - ACCapacityformat + ACCoilTemperature + + ACCapacityFormat - PresetTypes - ScheduleTypes - NumberOfPresets - NumberOfSchedules - NumberOfScheduleTransitions - NumberOfScheduleTransitionPerDay - ActivePresetHandle - ActiveScheduleHandle - + PresetTypes + ScheduleTypes + NumberOfPresets + NumberOfSchedules + NumberOfScheduleTransitions + NumberOfScheduleTransitionPerDay + ActivePresetHandle + ActiveScheduleHandle + Presets - + Schedules - PresetsSchedulesEditable - SetpointHoldExpiryTimestamp - + SetpointHoldExpiryTimestamp - - - Command description for SetpointRaiseLower - - - + Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. + + + - - Command description for SetWeeklySchedule - + Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the - - - - + + + + + - - Command description for GetWeeklySchedule - - - + Upon receipt, the unit SHOULD send in return the Get + + + - This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. + This command is used to clear the weekly schedule. - + + - This command is used to set the active schedule. - + Upon receipt, if the + + - This command is used to set the active preset. - - - - This command is used to start editing the presets and schedules. - - - - - This command is used to cancel editing presets and schedules. - - - - This command is used to notify the server that all edits are done and should be committed. - + ID + + + This command has the same payload format as the Set Weekly Schedule. + + + + + + + + Returns the status of an atomic write + + + + - - - The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. - - - - - + + Begins, Commits or Cancels an atomic write + + + + - \ No newline at end of file + From 48ac309429b99f93efa659935d6b5a0a56ee6580 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Fri, 26 Jul 2024 17:31:20 -0400 Subject: [PATCH 15/63] Move atomic enum to global-enums.xml, actually # Conflicts: # src/app/zap-templates/zcl/data-model/chip/global-structs.xml --- .github/workflows/tests.yaml | 2 + scripts/rules.matterlint | 2 + src/app/zap-templates/zcl/data-model/all.xml | 2 + .../zcl/data-model/chip/global-bitmaps.xml | 36 +++++++++++++++ .../zcl/data-model/chip/global-enums.xml | 44 +++++++++++++++++++ .../zcl/data-model/chip/global-structs.xml | 18 ++++++++ .../data-model/chip/thermostat-cluster.xml | 13 ------ .../zcl/zcl-with-test-extensions.json | 2 + src/app/zap-templates/zcl/zcl.json | 2 + 9 files changed, 108 insertions(+), 13 deletions(-) create mode 100644 src/app/zap-templates/zcl/data-model/chip/global-bitmaps.xml create mode 100644 src/app/zap-templates/zcl/data-model/chip/global-enums.xml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d559612d2be60d..796f94a1585a54 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -91,6 +91,8 @@ jobs: --no-print \ --log-level info \ src/app/zap-templates/zcl/data-model/chip/global-attributes.xml \ + src/app/zap-templates/zcl/data-model/chip/global-bitmaps.xml \ + src/app/zap-templates/zcl/data-model/chip/global-enums.xml \ src/app/zap-templates/zcl/data-model/chip/global-structs.xml \ src/app/zap-templates/zcl/data-model/chip/semantic-tag-namespace-enums.xml \ src/app/zap-templates/zcl/data-model/chip/access-control-definitions.xml \ diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index f44681febd112d..7802bb293a1930 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -43,6 +43,8 @@ load "../src/app/zap-templates/zcl/data-model/chip/flow-measurement-cluster.xml" load "../src/app/zap-templates/zcl/data-model/chip/general-commissioning-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/general-diagnostics-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/global-attributes.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/global-bitmaps.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/global-enums.xml"; load "../src/app/zap-templates/zcl/data-model/chip/global-structs.xml"; load "../src/app/zap-templates/zcl/data-model/chip/groups-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/group-key-mgmt-cluster.xml"; diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index 6003a7cf4a3f1a..e60c52fc97d999 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -46,6 +46,8 @@ + + diff --git a/src/app/zap-templates/zcl/data-model/chip/global-bitmaps.xml b/src/app/zap-templates/zcl/data-model/chip/global-bitmaps.xml new file mode 100644 index 00000000000000..fc70c0bf5143a9 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/global-bitmaps.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/global-enums.xml b/src/app/zap-templates/zcl/data-model/chip/global-enums.xml new file mode 100644 index 00000000000000..26c3fa33a9d7a7 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/global-enums.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml index 54b4f69bc93bb8..666b6df9f80322 100644 --- a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml +++ b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml @@ -23,6 +23,13 @@ TODO: Make these structures global rather than defining them for each cluster. + + + + + + + @@ -31,4 +38,15 @@ TODO: Make these structures global rather than defining them for each cluster. + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index e9c16b39bb0d6b..42ae8744f79964 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -97,13 +97,6 @@ limitations under the License. - - - - - - - @@ -215,12 +208,6 @@ limitations under the License. - - - - - - 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 513144d3d32ad9..a992901c606945 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -62,6 +62,8 @@ "general-commissioning-cluster.xml", "general-diagnostics-cluster.xml", "global-attributes.xml", + "global-bitmaps.xml", + "global-enums.xml", "global-structs.xml", "groups-cluster.xml", "group-key-mgmt-cluster.xml", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index b497281e585578..ac031f9595b130 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -60,6 +60,8 @@ "general-commissioning-cluster.xml", "general-diagnostics-cluster.xml", "global-attributes.xml", + "global-bitmaps.xml", + "global-enums.xml", "global-structs.xml", "groups-cluster.xml", "group-key-mgmt-cluster.xml", From 521641543298a2d84a03599608e28dfc3077f136 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 28 Jul 2024 10:48:58 -0400 Subject: [PATCH 16/63] Regenerate XML and convert thermostat-server to atomic writes --- .../air-purifier-app.matter | 78 +++-- .../all-clusters-app.matter | 81 +++-- .../all-clusters-minimal-app.matter | 78 +++-- ...umiditysensor_thermostat_56de3d5f45.matter | 78 +++-- ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 78 +++-- ...tnode_roomairconditioner_9cf3607804.matter | 78 +++-- .../rootnode_thermostat_bm3fb8dhYi.matter | 78 +++-- .../placeholder/linux/apps/app1/config.matter | 158 +++++---- .../placeholder/linux/apps/app2/config.matter | 158 +++++---- .../linux/include/thermostat-delegate-impl.h | 6 + .../linux/thermostat-delegate-impl.cpp | 38 +- .../nxp/zap/thermostat_matter_thread.matter | 78 +++-- .../nxp/zap/thermostat_matter_wifi.matter | 78 +++-- .../qpg/zap/thermostaticRadiatorValve.matter | 78 +++-- .../thermostat-common/thermostat.matter | 83 +++-- .../app-templates/endpoint_config.h | 93 +++-- .../thermostat-server/thermostat-delegate.h | 6 + .../thermostat-server/thermostat-server.cpp | 273 +++++++++------ .../thermostat-server/thermostat-server.h | 29 +- .../zcl/data-model/chip/global-structs.xml | 4 +- .../data_model/controller-clusters.matter | 78 +++-- .../chip/devicecontroller/ChipClusters.java | 131 +++---- .../chip/devicecontroller/ChipStructs.java | 71 +++- .../devicecontroller/ClusterIDMapping.java | 17 +- .../devicecontroller/ClusterInfoMapping.java | 86 +++-- .../devicecontroller/ClusterReadMapping.java | 21 +- .../devicecontroller/ClusterWriteMapping.java | 16 +- .../chip/devicecontroller/cluster/files.gni | 1 + ...ostatClusterAtomicAttributeStatusStruct.kt | 56 +++ .../ThermostatClusterScheduleStruct.kt | 13 +- .../cluster/clusters/ThermostatCluster.kt | 212 +++++------ .../java/matter/controller/cluster/files.gni | 1 + ...ostatClusterAtomicAttributeStatusStruct.kt | 56 +++ .../ThermostatClusterScheduleStruct.kt | 13 +- .../CHIPAttributeTLVValueDecoder.cpp | 52 +-- .../python/chip/clusters/CHIPClusters.py | 32 +- .../python/chip/clusters/Objects.py | 100 +++--- .../MTRAttributeSpecifiedCheck.mm | 5 +- .../MTRAttributeTLVValueDecoder.mm | 29 +- .../CHIP/zap-generated/MTRBaseClusters.h | 73 ++-- .../CHIP/zap-generated/MTRBaseClusters.mm | 180 ++-------- .../CHIP/zap-generated/MTRClusterConstants.h | 13 +- .../CHIP/zap-generated/MTRClusterNames.mm | 8 +- .../CHIP/zap-generated/MTRClusters.h | 16 +- .../CHIP/zap-generated/MTRClusters.mm | 89 +---- .../zap-generated/MTRCommandPayloadsObjc.h | 67 +--- .../zap-generated/MTRCommandPayloadsObjc.mm | 225 ++++++------ .../MTRCommandPayloads_Internal.h | 12 +- .../CHIP/zap-generated/MTRStructsObjc.h | 6 + .../CHIP/zap-generated/MTRStructsObjc.mm | 30 ++ .../zap-generated/attributes/Accessors.cpp | 113 ++---- .../zap-generated/attributes/Accessors.h | 46 +-- .../app-common/zap-generated/callback.h | 18 +- .../zap-generated/cluster-enums-check.h | 14 +- .../app-common/zap-generated/cluster-enums.h | 23 +- .../zap-generated/cluster-objects.cpp | 109 ++++-- .../zap-generated/cluster-objects.h | 157 ++++----- .../app-common/zap-generated/ids/Attributes.h | 10 +- .../app-common/zap-generated/ids/Commands.h | 16 +- .../zap-generated/cluster/Commands.h | 143 ++------ .../cluster/ComplexArgumentParser.cpp | 40 ++- .../cluster/ComplexArgumentParser.h | 5 + .../cluster/logging/DataModelLogger.cpp | 54 ++- .../cluster/logging/DataModelLogger.h | 5 + .../zap-generated/cluster/Commands.h | 331 +++++------------- 65 files changed, 2208 insertions(+), 2216 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index b9daf0cb550080..ba0e91c3615ec2 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1225,7 +1225,7 @@ cluster ActivatedCarbonFilterMonitoring = 114 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1261,6 +1261,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1271,7 +1277,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1344,7 +1349,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1354,6 +1358,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -1419,7 +1427,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -1451,23 +1464,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -1497,7 +1510,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -1508,8 +1521,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1549,28 +1561,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ 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 59886807143f6f..155fac83daad18 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 @@ -4954,7 +4954,7 @@ cluster PumpConfigurationAndControl = 512 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -4990,6 +4990,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -5000,7 +5006,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -5073,7 +5078,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -5083,6 +5087,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -5148,7 +5156,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -5180,23 +5193,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -5226,7 +5239,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -5237,8 +5250,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5278,28 +5290,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ @@ -8586,8 +8602,7 @@ endpoint 1 { ram attribute activeScheduleHandle; callback attribute presets; callback attribute schedules; - ram attribute presetsSchedulesEditable; - ram attribute setpointHoldExpiryTimestamp default = 0; + ram attribute setpointHoldExpiryTimestamp; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index c8fa5ea7e1c6e1..43539889c68900 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -3499,7 +3499,7 @@ cluster PumpConfigurationAndControl = 512 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -3535,6 +3535,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -3545,7 +3551,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -3618,7 +3623,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -3628,6 +3632,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -3693,7 +3701,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -3725,23 +3738,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -3771,7 +3784,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -3782,8 +3795,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -3823,28 +3835,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index 27e38141a4e1b6..7653880934305a 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1148,7 +1148,7 @@ cluster ActivatedCarbonFilterMonitoring = 114 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1184,6 +1184,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1194,7 +1200,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1267,7 +1272,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1277,6 +1281,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -1342,7 +1350,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -1374,23 +1387,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -1420,7 +1433,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -1431,8 +1444,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1472,28 +1484,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 22111d45d62eab..e0a5f1326a33a9 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -1505,7 +1505,7 @@ cluster FixedLabel = 64 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1541,6 +1541,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1551,7 +1557,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1624,7 +1629,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1634,6 +1638,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -1699,7 +1707,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -1731,23 +1744,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -1777,7 +1790,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -1788,8 +1801,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1829,28 +1841,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 66d34c451a7f92..9aa1fa8c417970 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1088,7 +1088,7 @@ cluster GroupKeyManagement = 63 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1124,6 +1124,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1134,7 +1140,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1207,7 +1212,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1217,6 +1221,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -1282,7 +1290,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -1314,23 +1327,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -1360,7 +1373,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -1371,8 +1384,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1412,28 +1424,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index eb6b301b559a3c..1e71b189ccdd39 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1308,7 +1308,7 @@ cluster FixedLabel = 64 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1344,6 +1344,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1354,7 +1360,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1427,7 +1432,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1437,6 +1441,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -1502,7 +1510,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -1534,23 +1547,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -1580,7 +1593,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -1591,8 +1604,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1632,28 +1644,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 5b91706480d3f9..3b6c723ed690c8 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -4745,7 +4745,7 @@ cluster PumpConfigurationAndControl = 512 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -4781,6 +4781,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -4791,7 +4797,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -4864,7 +4869,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -4874,6 +4878,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -4939,7 +4947,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -4971,23 +4984,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -5017,7 +5030,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -5028,8 +5041,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5069,33 +5081,37 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -5131,6 +5147,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -5141,7 +5163,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -5214,7 +5235,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -5224,6 +5244,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -5289,7 +5313,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -5321,23 +5350,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -5367,7 +5396,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -5378,8 +5407,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5419,28 +5447,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ @@ -8770,7 +8802,7 @@ endpoint 0 { callback attribute ACCompressorType default = 0x00; callback attribute ACLouverPosition default = 0x00; callback attribute ACCoilTemperature; - callback attribute ACCapacityformat default = 0x00; + callback attribute ACCapacityFormat default = 0x00; ram attribute featureMap default = 0x000b; ram attribute clusterRevision default = 6; } diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 3499926c146506..ec42b8a0d96fb6 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -4702,7 +4702,7 @@ cluster PumpConfigurationAndControl = 512 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -4738,6 +4738,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -4748,7 +4754,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -4821,7 +4826,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -4831,6 +4835,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -4896,7 +4904,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -4928,23 +4941,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -4974,7 +4987,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -4985,8 +4998,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5026,33 +5038,37 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -5088,6 +5104,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -5098,7 +5120,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -5171,7 +5192,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -5181,6 +5201,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -5246,7 +5270,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -5278,23 +5307,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -5324,7 +5353,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -5335,8 +5364,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5376,28 +5404,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ @@ -8734,7 +8766,7 @@ endpoint 0 { callback attribute ACCompressorType default = 0x00; callback attribute ACLouverPosition default = 0x00; callback attribute ACCoilTemperature; - callback attribute ACCapacityformat default = 0x00; + callback attribute ACCapacityFormat default = 0x00; ram attribute featureMap default = 0x000b; ram attribute clusterRevision default = 6; } diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h index c4daef5fde1d6a..046f870d0520a3 100644 --- a/examples/thermostat/linux/include/thermostat-delegate-impl.h +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -50,6 +50,12 @@ class ThermostatDelegate : public Delegate CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; + void BeginPendingPresetList() override; + + int GetPendingPresetCount() override; + + CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; + CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) override; CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) override; diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index fa7bd9a259a475..6f21bfbfa1cb7d 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -18,6 +18,7 @@ #include "include/thermostat-delegate-impl.h" +#include "thermostat-delegate-impl.h" #include #include #include @@ -134,6 +135,22 @@ CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, PresetStructWithOw return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; } +void ThermostatDelegate::BeginPendingPresetList() +{ + mNextFreeIndexInPendingPresetsList = 0; + for (uint8_t indexInPresets = 0; indexInPresets < mNextFreeIndexInPresetsList; indexInPresets++) + { + auto preset = mPresets[indexInPresets]; + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(preset.GetPresetHandle()); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetScenario(preset.GetPresetScenario()); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetName(preset.GetName()); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetCoolingSetpoint(preset.GetCoolingSetpoint()); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetHeatingSetpoint(preset.GetHeatingSetpoint()); + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(preset.GetBuiltIn()); + mNextFreeIndexInPendingPresetsList++; + } +} + CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(MutableByteSpan & activePresetHandle) { return CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle); @@ -169,8 +186,19 @@ CHIP_ERROR ThermostatDelegate::AppendToPendingPresetList(const PresetStruct::Typ { if (mNextFreeIndexInPendingPresetsList < ArraySize(mPendingPresets)) { + if (preset.presetHandle.IsNull()) + { + // TODO: #34556 Since we support only one preset of each type, using the octet string containing the preset scenario + // suffices as the unique preset handle. Need to fix this to actually provide unique handles once multiple presets of + // each type are supported. + const uint8_t handle[] = { static_cast(preset.presetScenario) }; + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); + } + else + { + mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(preset.presetHandle); + } mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetScenario(preset.presetScenario); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(preset.presetHandle); mPendingPresets[mNextFreeIndexInPendingPresetsList].SetName(preset.name); mPendingPresets[mNextFreeIndexInPendingPresetsList].SetCoolingSetpoint(preset.coolingSetpoint); mPendingPresets[mNextFreeIndexInPendingPresetsList].SetHeatingSetpoint(preset.heatingSetpoint); @@ -193,7 +221,6 @@ CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStruc CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() { - // TODO: #34546 - Need to support deletion of presets that are removed from Presets. for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) { @@ -214,14 +241,7 @@ CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() // If pending preset was not found in the Presets list, append to the Presets list. if (!found) { - mPresets[mNextFreeIndexInPresetsList] = pendingPreset; - - // TODO: #34556 Since we support only one preset of each type, using the octet string containing the preset scenario - // suffices as the unique preset handle. Need to fix this to actually provide unique handles once multiple presets of - // each type are supported. - const uint8_t handle[] = { static_cast(pendingPreset.GetPresetScenario()) }; - mPresets[mNextFreeIndexInPresetsList].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); mNextFreeIndexInPresetsList++; } } diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 76dace386a25f2..b13d7370f01338 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -1899,7 +1899,7 @@ provisional cluster ScenesManagement = 98 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1935,6 +1935,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1945,7 +1951,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -2018,7 +2023,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -2028,6 +2032,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -2093,7 +2101,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -2125,23 +2138,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -2171,7 +2184,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -2182,8 +2195,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2223,28 +2235,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } endpoint 0 { diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index f8154996ad20e2..42e75ca83469e6 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -1810,7 +1810,7 @@ provisional cluster ScenesManagement = 98 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1846,6 +1846,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1856,7 +1862,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1929,7 +1934,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1939,6 +1943,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -2004,7 +2012,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -2036,23 +2049,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -2082,7 +2095,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -2093,8 +2106,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2134,28 +2146,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } endpoint 0 { diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index 8060f63590c3c4..58db7a02c80874 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -1507,7 +1507,7 @@ cluster UserLabel = 65 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1543,6 +1543,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1553,7 +1559,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1626,7 +1631,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1636,6 +1640,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -1701,7 +1709,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -1733,23 +1746,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -1779,7 +1792,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -1790,8 +1803,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1831,28 +1843,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index f7139b07b43595..0870d1fa6c16a6 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -1687,7 +1687,7 @@ cluster UserLabel = 65 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -1723,6 +1723,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1733,7 +1739,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -1806,7 +1811,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -1816,6 +1820,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -1881,7 +1889,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -1913,23 +1926,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -1959,7 +1972,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -1970,8 +1983,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2011,28 +2023,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */ @@ -2481,7 +2497,7 @@ endpoint 1 { ram attribute numberOfPresets default = 0; ram attribute activePresetHandle; callback attribute presets; - ram attribute presetsSchedulesEditable; + ram attribute setpointHoldExpiryTimestamp; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; @@ -2490,9 +2506,6 @@ endpoint 1 { handle command SetpointRaiseLower; handle command SetActivePresetRequest; - handle command StartPresetsSchedulesEditRequest; - handle command CancelPresetsSchedulesEditRequest; - handle command CommitPresetsSchedulesRequest; } server cluster ThermostatUserInterfaceConfiguration { diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index c60950077fb372..8cf4b1fc93a2df 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -307,7 +307,7 @@ { (uint16_t) 0xBB8, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxHeatSetpointLimit */ \ { (uint16_t) 0x640, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MinCoolSetpointLimit */ \ { (uint16_t) 0xC80, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxCoolSetpointLimit */ \ - { (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x19 }, /* MinSetpointDeadBand */ \ + { (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x7F }, /* MinSetpointDeadBand */ \ { (uint16_t) 0x4, (uint16_t) 0x0, (uint16_t) 0x5 }, /* ControlSequenceOfOperation */ \ { (uint16_t) 0x1, (uint16_t) 0x0, (uint16_t) 0x9 }, /* SystemMode */ \ \ @@ -355,7 +355,7 @@ } // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 1055 +#define GENERATED_ATTRIBUTE_COUNT 1054 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1367,17 +1367,17 @@ { ZAP_SIMPLE_DEFAULT(0x0BB8), 0x00000004, 2, ZAP_TYPE(TEMPERATURE), 0 }, /* AbsMaxHeatSetpointLimit */ \ { ZAP_SIMPLE_DEFAULT(0x0640), 0x00000005, 2, ZAP_TYPE(TEMPERATURE), 0 }, /* AbsMinCoolSetpointLimit */ \ { ZAP_SIMPLE_DEFAULT(0x0C80), 0x00000006, 2, ZAP_TYPE(TEMPERATURE), 0 }, /* AbsMaxCoolSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(13), 0x00000011, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(13), 0x00000011, 2, ZAP_TYPE(TEMPERATURE), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* OccupiedCoolingSetpoint */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(14), 0x00000012, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(14), 0x00000012, 2, ZAP_TYPE(TEMPERATURE), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* OccupiedHeatingSetpoint */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(15), 0x00000015, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(15), 0x00000015, 2, ZAP_TYPE(TEMPERATURE), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MinHeatSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(16), 0x00000016, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(16), 0x00000016, 2, ZAP_TYPE(TEMPERATURE), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MaxHeatSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(17), 0x00000017, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(17), 0x00000017, 2, ZAP_TYPE(TEMPERATURE), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MinCoolSetpointLimit */ \ - { ZAP_MIN_MAX_DEFAULTS_INDEX(18), 0x00000018, 2, ZAP_TYPE(INT16S), \ + { ZAP_MIN_MAX_DEFAULTS_INDEX(18), 0x00000018, 2, ZAP_TYPE(TEMPERATURE), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MaxCoolSetpointLimit */ \ { ZAP_MIN_MAX_DEFAULTS_INDEX(19), 0x00000019, 1, ZAP_TYPE(INT8S), \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* MinSetpointDeadBand */ \ @@ -1399,8 +1399,7 @@ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* Presets */ \ { ZAP_EMPTY_DEFAULT(), 0x00000051, 0, ZAP_TYPE(ARRAY), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* Schedules */ \ - { ZAP_EMPTY_DEFAULT(), 0x00000052, 1, ZAP_TYPE(BOOLEAN), 0 }, /* PresetsSchedulesEditable */ \ - { ZAP_SIMPLE_DEFAULT(0), 0x00000053, 4, ZAP_TYPE(EPOCH_S), \ + { ZAP_EMPTY_DEFAULT(), 0x00000052, 4, ZAP_TYPE(EPOCH_S), \ ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* SetpointHoldExpiryTimestamp */ \ { ZAP_SIMPLE_DEFAULT(0x0023), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(6), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ @@ -3748,8 +3747,8 @@ /* Endpoint: 1, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ .attributes = ZAP_ATTRIBUTE_INDEX(616), \ - .attributeCount = 27, \ - .clusterSize = 73, \ + .attributeCount = 26, \ + .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ), \ @@ -3760,7 +3759,7 @@ { \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ .clusterId = 0x00000202, \ - .attributes = ZAP_ATTRIBUTE_INDEX(643), \ + .attributes = ZAP_ATTRIBUTE_INDEX(642), \ .attributeCount = 14, \ .clusterSize = 18, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -3773,7 +3772,7 @@ { \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ .clusterId = 0x00000204, \ - .attributes = ZAP_ATTRIBUTE_INDEX(657), \ + .attributes = ZAP_ATTRIBUTE_INDEX(656), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -3786,7 +3785,7 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(662), \ + .attributes = ZAP_ATTRIBUTE_INDEX(661), \ .attributeCount = 54, \ .clusterSize = 345, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -3799,7 +3798,7 @@ { \ /* Endpoint: 1, Cluster: Ballast Configuration (server) */ \ .clusterId = 0x00000301, \ - .attributes = ZAP_ATTRIBUTE_INDEX(716), \ + .attributes = ZAP_ATTRIBUTE_INDEX(715), \ .attributeCount = 16, \ .clusterSize = 58, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3812,7 +3811,7 @@ { \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ .clusterId = 0x00000400, \ - .attributes = ZAP_ATTRIBUTE_INDEX(732), \ + .attributes = ZAP_ATTRIBUTE_INDEX(731), \ .attributeCount = 7, \ .clusterSize = 15, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3825,7 +3824,7 @@ { \ /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(739), \ + .attributes = ZAP_ATTRIBUTE_INDEX(738), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3838,7 +3837,7 @@ { \ /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ .clusterId = 0x00000403, \ - .attributes = ZAP_ATTRIBUTE_INDEX(745), \ + .attributes = ZAP_ATTRIBUTE_INDEX(744), \ .attributeCount = 5, \ .clusterSize = 12, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3851,7 +3850,7 @@ { \ /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ .clusterId = 0x00000404, \ - .attributes = ZAP_ATTRIBUTE_INDEX(750), \ + .attributes = ZAP_ATTRIBUTE_INDEX(749), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3864,7 +3863,7 @@ { \ /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ .clusterId = 0x00000405, \ - .attributes = ZAP_ATTRIBUTE_INDEX(756), \ + .attributes = ZAP_ATTRIBUTE_INDEX(755), \ .attributeCount = 6, \ .clusterSize = 14, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3877,7 +3876,7 @@ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(762), \ + .attributes = ZAP_ATTRIBUTE_INDEX(761), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -3890,7 +3889,7 @@ { \ /* Endpoint: 1, Cluster: Carbon Monoxide Concentration Measurement (server) */ \ .clusterId = 0x0000040C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(767), \ + .attributes = ZAP_ATTRIBUTE_INDEX(766), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3903,7 +3902,7 @@ { \ /* Endpoint: 1, Cluster: Carbon Dioxide Concentration Measurement (server) */ \ .clusterId = 0x0000040D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(780), \ + .attributes = ZAP_ATTRIBUTE_INDEX(779), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3916,7 +3915,7 @@ { \ /* Endpoint: 1, Cluster: Nitrogen Dioxide Concentration Measurement (server) */ \ .clusterId = 0x00000413, \ - .attributes = ZAP_ATTRIBUTE_INDEX(793), \ + .attributes = ZAP_ATTRIBUTE_INDEX(792), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3929,7 +3928,7 @@ { \ /* Endpoint: 1, Cluster: Ozone Concentration Measurement (server) */ \ .clusterId = 0x00000415, \ - .attributes = ZAP_ATTRIBUTE_INDEX(806), \ + .attributes = ZAP_ATTRIBUTE_INDEX(805), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3942,7 +3941,7 @@ { \ /* Endpoint: 1, Cluster: PM2.5 Concentration Measurement (server) */ \ .clusterId = 0x0000042A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(819), \ + .attributes = ZAP_ATTRIBUTE_INDEX(818), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3955,7 +3954,7 @@ { \ /* Endpoint: 1, Cluster: Formaldehyde Concentration Measurement (server) */ \ .clusterId = 0x0000042B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(832), \ + .attributes = ZAP_ATTRIBUTE_INDEX(831), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3968,7 +3967,7 @@ { \ /* Endpoint: 1, Cluster: PM1 Concentration Measurement (server) */ \ .clusterId = 0x0000042C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(845), \ + .attributes = ZAP_ATTRIBUTE_INDEX(844), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3981,7 +3980,7 @@ { \ /* Endpoint: 1, Cluster: PM10 Concentration Measurement (server) */ \ .clusterId = 0x0000042D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(858), \ + .attributes = ZAP_ATTRIBUTE_INDEX(857), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3994,7 +3993,7 @@ { \ /* Endpoint: 1, Cluster: Total Volatile Organic Compounds Concentration Measurement (server) */ \ .clusterId = 0x0000042E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(871), \ + .attributes = ZAP_ATTRIBUTE_INDEX(870), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4007,7 +4006,7 @@ { \ /* Endpoint: 1, Cluster: Radon Concentration Measurement (server) */ \ .clusterId = 0x0000042F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(884), \ + .attributes = ZAP_ATTRIBUTE_INDEX(883), \ .attributeCount = 13, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4020,7 +4019,7 @@ { \ /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ .clusterId = 0x00000503, \ - .attributes = ZAP_ATTRIBUTE_INDEX(897), \ + .attributes = ZAP_ATTRIBUTE_INDEX(896), \ .attributeCount = 3, \ .clusterSize = 19, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4033,7 +4032,7 @@ { \ /* Endpoint: 1, Cluster: Low Power (server) */ \ .clusterId = 0x00000508, \ - .attributes = ZAP_ATTRIBUTE_INDEX(900), \ + .attributes = ZAP_ATTRIBUTE_INDEX(899), \ .attributeCount = 2, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4046,7 +4045,7 @@ { \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ .clusterId = 0x00000B04, \ - .attributes = ZAP_ATTRIBUTE_INDEX(902), \ + .attributes = ZAP_ATTRIBUTE_INDEX(901), \ .attributeCount = 13, \ .clusterSize = 32, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4059,7 +4058,7 @@ { \ /* Endpoint: 1, Cluster: Unit Testing (server) */ \ .clusterId = 0xFFF1FC05, \ - .attributes = ZAP_ATTRIBUTE_INDEX(915), \ + .attributes = ZAP_ATTRIBUTE_INDEX(914), \ .attributeCount = 84, \ .clusterSize = 2290, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4072,7 +4071,7 @@ { \ /* Endpoint: 2, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(999), \ + .attributes = ZAP_ATTRIBUTE_INDEX(998), \ .attributeCount = 4, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -4085,7 +4084,7 @@ { \ /* Endpoint: 2, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1003), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1002), \ .attributeCount = 3, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -4098,7 +4097,7 @@ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1006), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1005), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -4111,7 +4110,7 @@ { \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1013), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1012), \ .attributeCount = 7, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4124,7 +4123,7 @@ { \ /* Endpoint: 2, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1020), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1019), \ .attributeCount = 9, \ .clusterSize = 72, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4137,7 +4136,7 @@ { \ /* Endpoint: 2, Cluster: Scenes Management (server) */ \ .clusterId = 0x00000062, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1029), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1028), \ .attributeCount = 5, \ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ @@ -4150,7 +4149,7 @@ { \ /* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1034), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1033), \ .attributeCount = 5, \ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -4163,7 +4162,7 @@ { \ /* Endpoint: 65534, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1039), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1038), \ .attributeCount = 6, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4176,7 +4175,7 @@ { \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(1045), \ + .attributes = ZAP_ATTRIBUTE_INDEX(1044), \ .attributeCount = 10, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -4195,7 +4194,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 29, 349 }, { ZAP_CLUSTER_INDEX(29), 74, 3522 }, { ZAP_CLUSTER_INDEX(103), 7, 126 }, \ + { ZAP_CLUSTER_INDEX(0), 29, 349 }, { ZAP_CLUSTER_INDEX(29), 74, 3521 }, { ZAP_CLUSTER_INDEX(103), 7, 126 }, \ { ZAP_CLUSTER_INDEX(110), 2, 0 }, \ } @@ -4208,7 +4207,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (36) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3997) +#define ATTRIBUTE_MAX_SIZE (3996) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (4) diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h index 86c1e532b92fc2..2f70ec615f178a 100644 --- a/src/app/clusters/thermostat-server/thermostat-delegate.h +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -64,6 +64,12 @@ class Delegate */ virtual CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) = 0; + /** + * @brief Creates a new pending presets list. + * + */ + virtual void BeginPendingPresetList() = 0; + /** * @brief Get the ActivePresetHandle attribute value. * diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index fe6cbb28e7d5d3..d680d2f04cf830 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -116,18 +116,19 @@ void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) VerifyOrReturn(delegate != nullptr, ChipLogError(Zcl, "Delegate is null. Unable to handle timer expired")); delegate->ClearPendingPresetList(); - gThermostatAttrAccess.SetPresetsEditable(endpoint, false); + gThermostatAttrAccess.SetAtomicWrite(endpoint, false); + gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, ScopedNodeId()); } /** - * @brief Schedules a timer for the given timeout in seconds. + * @brief Schedules a timer for the given timeout in milliseconds. * * @param[in] endpoint The endpoint to use. - * @param[in] timeoutSeconds The timeout in seconds. + * @param[in] timeoutMilliseconds The timeout in milliseconds. */ -void ScheduleTimer(EndpointId endpoint, uint16_t timeoutSeconds) +void ScheduleTimer(EndpointId endpoint, uint16_t timeoutMilliseconds) { - DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(timeoutSeconds), TimerExpiredCallback, + DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds16(timeoutMilliseconds), TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); } @@ -141,18 +142,6 @@ void ClearTimer(EndpointId endpoint) DeviceLayer::SystemLayer().CancelTimer(TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); } -/** - * @brief Extends the currently scheduled timer to a new timeout value in seconds - * - * @param[in] endpoint The endpoint to use. - * @param[in] timeoutSeconds The timeout in seconds to extend the timer to. - */ -void ExtendTimer(EndpointId endpoint, uint16_t timeoutSeconds) -{ - DeviceLayer::SystemLayer().ExtendTimerTo(System::Clock::Seconds16(timeoutSeconds), TimerExpiredCallback, - reinterpret_cast(static_cast(endpoint))); -} - /** * @brief Checks if the preset is built-in * @@ -216,8 +205,8 @@ void CleanUp(Delegate * delegate, EndpointId endpoint) delegate->ClearPendingPresetList(); } ClearTimer(endpoint); - gThermostatAttrAccess.SetPresetsEditable(endpoint, false); - gThermostatAttrAccess.SetOriginatorScopedNodeId(endpoint, ScopedNodeId()); + gThermostatAttrAccess.SetAtomicWrite(endpoint, false); + gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, ScopedNodeId()); } /** @@ -661,50 +650,50 @@ void SetDefaultDelegate(EndpointId endpoint, Delegate * delegate) } } -void ThermostatAttrAccess::SetPresetsEditable(EndpointId endpoint, bool presetEditable) +void ThermostatAttrAccess::SetAtomicWrite(EndpointId endpoint, bool inProgress) { uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - if (ep < ArraySize(mPresetsEditables)) + if (ep < ArraySize(mAtomicWriteState)) { - mPresetsEditables[ep] = presetEditable; + mAtomicWriteState[ep] = inProgress; } } -bool ThermostatAttrAccess::GetPresetsEditable(EndpointId endpoint) +bool ThermostatAttrAccess::InAtomicWrite(EndpointId endpoint) { - bool presetEditable = false; + bool inAtomicWrite = false; uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - if (ep < ArraySize(mPresetsEditables)) + if (ep < ArraySize(mAtomicWriteState)) { - presetEditable = mPresetsEditables[ep]; + inAtomicWrite = mAtomicWriteState[ep]; } - return presetEditable; + return inAtomicWrite; } -void ThermostatAttrAccess::SetOriginatorScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId) +void ThermostatAttrAccess::SetAtomicWriteScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId) { uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) + if (ep < ArraySize(mAtomicWriteNodeIds)) { - mPresetEditRequestOriginatorNodeIds[ep] = originatorNodeId; + mAtomicWriteNodeIds[ep] = originatorNodeId; } } -ScopedNodeId ThermostatAttrAccess::GetOriginatorScopedNodeId(EndpointId endpoint) +ScopedNodeId ThermostatAttrAccess::GetAtomicWriteScopedNodeId(EndpointId endpoint) { ScopedNodeId originatorNodeId = ScopedNodeId(); uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, Thermostat::Id, MATTER_DM_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT); - if (ep < ArraySize(mPresetEditRequestOriginatorNodeIds)) + if (ep < ArraySize(mAtomicWriteNodeIds)) { - originatorNodeId = mPresetEditRequestOriginatorNodeIds[ep]; + originatorNodeId = mAtomicWriteNodeIds[ep]; } return originatorNodeId; } @@ -743,6 +732,9 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A Delegate * delegate = GetDelegate(aPath.mEndpointId); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + if (InAtomicWrite(aPath.mEndpointId)) + { + } return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { for (uint8_t i = 0; true; i++) { @@ -784,10 +776,6 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A }); } break; - case PresetsSchedulesEditable::Id: { - ReturnErrorOnFailure(aEncoder.Encode(GetPresetsEditable(aPath.mEndpointId))); - } - break; case ActivePresetHandle::Id: { Delegate * delegate = GetDelegate(aPath.mEndpointId); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); @@ -854,7 +842,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); // Presets are not editable, return INVALID_IN_STATE. - VerifyOrReturnError(GetPresetsEditable(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), + VerifyOrReturnError(InAtomicWrite(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), ChipLogError(Zcl, "Presets are not editable")); // Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, @@ -868,7 +856,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); } - if (GetOriginatorScopedNodeId(endpoint) != scopedNodeId) + if (GetAtomicWriteScopedNodeId(endpoint) != scopedNodeId) { ChipLogError(Zcl, "Another node is editing presets. Server is busy. Try again later"); return CHIP_IM_GLOBAL_STATUS(Busy); @@ -1287,102 +1275,122 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( return true; } -bool emberAfThermostatClusterStartPresetsSchedulesEditRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::DecodableType & commandData) +bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { - ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); - - EndpointId endpoint = commandPath.mEndpointId; - - // If the presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command - // is not the same as the one that previously originated a StartPresetsSchedulesEditRequest command, return BUSY. - if (gThermostatAttrAccess.GetPresetsEditable(endpoint) && - (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId)) + auto attributeIdsIter = commandData.attributeRequests.begin(); + bool requestedPresets, requestedSchedules; + while (attributeIdsIter.Next()) { - commandObj->AddStatus(commandPath, imcode::Busy); - return true; - } + auto & attributeId = attributeIdsIter.GetValue(); - // If presets are editable and the scoped node id of the client sending StartPresetsSchedulesEditRequest command - // is the same as the one that previously originated a StartPresetsSchedulesEditRequest command, extend the timer. - if (gThermostatAttrAccess.GetPresetsEditable(endpoint)) - { - ExtendTimer(endpoint, commandData.timeoutSeconds); - commandObj->AddStatus(commandPath, imcode::Success); - return true; + switch (attributeId) + { + case Presets::Id: + if (requestedPresets) + { + return false; + } + requestedPresets = true; + break; + case Schedules::Id: + if (requestedSchedules) + { + return false; + } + requestedSchedules = true; + break; + default: + return false; + } } - - // Set presets editable to true and the scoped originator node id to the source scoped node id, and start a timer with the - // timeout in seconds passed in the command args. Return success. - gThermostatAttrAccess.SetPresetsEditable(endpoint, true); - gThermostatAttrAccess.SetOriginatorScopedNodeId(endpoint, sourceNodeId); - ScheduleTimer(endpoint, commandData.timeoutSeconds); - commandObj->AddStatus(commandPath, imcode::Success); return true; } -bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::DecodableType & commandData) +bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, + const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { EndpointId endpoint = commandPath.mEndpointId; - // If presets are not editable, return INVALID_IN_STATE. - if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) + if (!commandData.timeout.HasValue()) { - commandObj->AddStatus(commandPath, imcode::InvalidInState); + commandObj->AddStatus(commandPath, imcode::InvalidCommand); return true; } - ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + auto timeout = commandData.timeout.Value(); - // If the node id sending the CancelPresetsSchedulesRequest command is not the same as the one which send the - // previous StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. - if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) + if (!validAtomicAttributes(commandData)) { - commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); + commandObj->AddStatus(commandPath, imcode::InvalidCommand); return true; } - Delegate * delegate = GetDelegate(endpoint); - - if (delegate == nullptr) + bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(endpoint); + if (inAtomicWrite) { - ChipLogError(Zcl, "Delegate is null"); - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; + Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { + { .attributeID = Presets::Id, .statusCode = static_cast(imcode::Busy) }, + { .attributeID = Schedules::Id, .statusCode = static_cast(imcode::Busy) } + }; + + response.statusCode = static_cast(imcode::Failure); + response.attributeStatus = attributeStatus; + commandObj->AddResponse(commandPath, response); + // commandObj->AddStatus(commandPath, imcode::Busy); + return true; } - // Clear the timer, discard the changes and set PresetsEditable to false. - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); + uint16_t maxTimeout = 5000; + timeout = std::min(timeout, maxTimeout); + + ScheduleTimer(endpoint, timeout); + gThermostatAttrAccess.SetAtomicWrite(endpoint, true); + gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); + chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; + Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { + { .attributeID = Presets::Id, .statusCode = static_cast(imcode::Success) }, + { .attributeID = Schedules::Id, .statusCode = static_cast(imcode::Success) } + }; + + response.statusCode = static_cast(imcode::Failure); + response.attributeStatus = attributeStatus; + response.timeout.Emplace(timeout); + commandObj->AddResponse(commandPath, response); + + return true; } -bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::DecodableType & commandData) +bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, + const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { + if (!validAtomicAttributes(commandData)) + { + commandObj->AddStatus(commandPath, imcode::InvalidCommand); + return true; + } EndpointId endpoint = commandPath.mEndpointId; - Delegate * delegate = GetDelegate(endpoint); - - if (delegate == nullptr) + bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(endpoint); + if (!inAtomicWrite) { - ChipLogError(Zcl, "Delegate is null"); - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; } - // If presets are not editable, return INVALID_IN_STATE. - if (!gThermostatAttrAccess.GetPresetsEditable(endpoint)) + if (gThermostatAttrAccess.GetAtomicWriteScopedNodeId(endpoint) != sourceNodeId) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; } - ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + Delegate * delegate = GetDelegate(endpoint); - // If the node id sending the CommitPresetsSchedulesRequest command is not the same as the one which send the - // StartPresetsSchedulesEditRequest, return UNSUPPORTED_ACCESS. - if (gThermostatAttrAccess.GetOriginatorScopedNodeId(endpoint) != sourceNodeId) + if (delegate == nullptr) { - commandObj->AddStatus(commandPath, imcode::UnsupportedAccess); + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, imcode::InvalidInState); return true; } @@ -1439,7 +1447,6 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); } } - // For each preset in the pending presets list, check that the preset does not violate any spec constraints. for (uint8_t i = 0; true; i++) { @@ -1561,6 +1568,64 @@ bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); } +bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, + const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +{ + if (!validAtomicAttributes(commandData)) + { + commandObj->AddStatus(commandPath, imcode::InvalidCommand); + return true; + } + EndpointId endpoint = commandPath.mEndpointId; + bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(endpoint); + if (!inAtomicWrite) + { + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + + if (gThermostatAttrAccess.GetAtomicWriteScopedNodeId(endpoint) != sourceNodeId) + { + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + Delegate * delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); +} + +bool emberAfThermostatClusterAtomicRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +{ + auto & requestType = commandData.requestType; + // auto & timeout = commandData.timeout; + + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + + switch (requestType) + { + case AtomicRequestTypeEnum::kBeginWrite: + return handleAtomicBegin(commandObj, sourceNodeId, commandPath, commandData); + case AtomicRequestTypeEnum::kCommitWrite: + return handleAtomicCommit(commandObj, sourceNodeId, commandPath, commandData); + case AtomicRequestTypeEnum::kRollbackWrite: + return handleAtomicRollback(commandObj, sourceNodeId, commandPath, commandData); + case AtomicRequestTypeEnum::kUnknownEnumValue: + commandObj->AddStatus(commandPath, imcode::InvalidCommand); + return true; + } + + return false; +} + bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const Commands::SetpointRaiseLower::DecodableType & commandData) @@ -1610,13 +1675,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h index 955ab9e5c5a777..64e4bb7bce3c82 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.h +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -48,45 +48,44 @@ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, chip::app::AttributeValueDecoder & aDecoder) override; /** - * @brief Sets the scoped node id of the originator that send the last successful - * StartPresetsSchedulesEditRequest for the given endpoint. + * @brief Sets the scoped node id of the originator that sent the last successful + * AtomicRequest of type BeginWrite for the given endpoint. * * @param[in] endpoint The endpoint. * @param[in] originatorNodeId The originator scoped node id. */ - void SetOriginatorScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId); + void SetAtomicWriteScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId); /** - * @brief Gets the scoped node id of the originator that send the last successful - * StartPresetsSchedulesEditRequest for the given endpoint. + * @brief Gets the scoped node id of the originator that sent the last successful + * AtomicRequest of type BeginWrite for the given endpoint. * * @param[in] endpoint The endpoint. * * @return the scoped node id for the given endpoint if set. Otherwise returns ScopedNodeId(). */ - ScopedNodeId GetOriginatorScopedNodeId(EndpointId endpoint); + ScopedNodeId GetAtomicWriteScopedNodeId(EndpointId endpoint); /** - * @brief Sets the presets editable flag for the given endpoint + * @brief Sets whether an atomic write is in progress for the given endpoint * * @param[in] endpoint The endpoint. - * @param[in] presetEditable The value of the presets editable. + * @param[in] inProgress Whether or not an atomic write is in progress. */ - void SetPresetsEditable(EndpointId endpoint, bool presetEditable); + void SetAtomicWrite(EndpointId endpoint, bool inProgress); /** - * @brief Gets the prests editable flag value for the given endpoint + * @brief Gets whether an atomic write is in progress for the given endpoint * * @param[in] endpoint The endpoint. * - * @return the presets editable flag value for the given endpoint if set. Otherwise returns false. + * @return Whether an atomic write is in progress for the given endpoint */ - bool GetPresetsEditable(EndpointId endpoint); + bool InAtomicWrite(EndpointId endpoint); private: - ScopedNodeId mPresetEditRequestOriginatorNodeIds[kThermostatEndpointCount]; - - bool mPresetsEditables[kThermostatEndpointCount]; + ScopedNodeId mAtomicWriteNodeIds[kThermostatEndpointCount]; + bool mAtomicWriteState[kThermostatEndpointCount]; }; /** diff --git a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml index 666b6df9f80322..c0c28197e69430 100644 --- a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml +++ b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml @@ -26,8 +26,8 @@ TODO: Make these structures global rather than defining them for each cluster. - - + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 626ebc5bcfa446..df435472592eaa 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6537,7 +6537,7 @@ cluster PumpConfigurationAndControl = 512 { /** An interface for configuring and controlling the functionality of a thermostat. */ cluster Thermostat = 513 { - revision 6; + revision 7; enum ACCapacityFormatEnum : enum8 { kBTUh = 0; @@ -6573,6 +6573,12 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } + enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; + } + enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -6583,7 +6589,6 @@ cluster Thermostat = 513 { } enum PresetScenarioEnum : enum8 { - kUnspecified = 0; kOccupied = 1; kUnoccupied = 2; kSleep = 3; @@ -6656,7 +6661,6 @@ cluster Thermostat = 513 { kLocalTemperatureNotExposed = 0x40; kMatterScheduleConfiguration = 0x80; kPresets = 0x100; - kSetpoints = 0x200; } bitmap HVACSystemTypeBitmap : bitmap8 { @@ -6666,6 +6670,10 @@ cluster Thermostat = 513 { kHeatingUsesFuel = 0x20; } + bitmap OccupancyBitmap : bitmap8 { + kOccupied = 0x1; + } + bitmap PresetTypeFeaturesBitmap : bitmap16 { kAutomatic = 0x1; kSupportsNames = 0x2; @@ -6731,7 +6739,12 @@ cluster Thermostat = 513 { optional char_string<64> name = 2; optional octet_string<16> presetHandle = 3; ScheduleTransitionStruct transitions[] = 4; - optional nullable boolean builtIn = 5; + nullable boolean builtIn = 5; + } + + struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; } struct PresetStruct { @@ -6763,23 +6776,23 @@ cluster Thermostat = 513 { readonly attribute nullable temperature localTemperature = 0; readonly attribute optional nullable temperature outdoorTemperature = 1; - readonly attribute optional bitmap8 occupancy = 2; + readonly attribute optional OccupancyBitmap occupancy = 2; readonly attribute optional temperature absMinHeatSetpointLimit = 3; readonly attribute optional temperature absMaxHeatSetpointLimit = 4; readonly attribute optional temperature absMinCoolSetpointLimit = 5; readonly attribute optional temperature absMaxCoolSetpointLimit = 6; readonly attribute optional int8u PICoolingDemand = 7; readonly attribute optional int8u PIHeatingDemand = 8; - attribute access(write: manage) optional bitmap8 HVACSystemTypeConfiguration = 9; + attribute access(write: manage) optional HVACSystemTypeBitmap HVACSystemTypeConfiguration = 9; attribute access(write: manage) optional int8s localTemperatureCalibration = 16; - attribute optional int16s occupiedCoolingSetpoint = 17; - attribute optional int16s occupiedHeatingSetpoint = 18; - attribute optional int16s unoccupiedCoolingSetpoint = 19; - attribute optional int16s unoccupiedHeatingSetpoint = 20; - attribute access(write: manage) optional int16s minHeatSetpointLimit = 21; - attribute access(write: manage) optional int16s maxHeatSetpointLimit = 22; - attribute access(write: manage) optional int16s minCoolSetpointLimit = 23; - attribute access(write: manage) optional int16s maxCoolSetpointLimit = 24; + attribute optional temperature occupiedCoolingSetpoint = 17; + attribute optional temperature occupiedHeatingSetpoint = 18; + attribute optional temperature unoccupiedCoolingSetpoint = 19; + attribute optional temperature unoccupiedHeatingSetpoint = 20; + attribute access(write: manage) optional temperature minHeatSetpointLimit = 21; + attribute access(write: manage) optional temperature maxHeatSetpointLimit = 22; + attribute access(write: manage) optional temperature minCoolSetpointLimit = 23; + attribute access(write: manage) optional temperature maxCoolSetpointLimit = 24; attribute access(write: manage) optional int8s minSetpointDeadBand = 25; attribute access(write: manage) optional RemoteSensingBitmap remoteSensing = 26; attribute access(write: manage) ControlSequenceOfOperationEnum controlSequenceOfOperation = 27; @@ -6809,7 +6822,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -6820,8 +6833,7 @@ cluster Thermostat = 513 { readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79; attribute access(write: manage) optional PresetStruct presets[] = 80; attribute access(write: manage) optional ScheduleStruct schedules[] = 81; - readonly attribute optional boolean presetsSchedulesEditable = 82; - readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 83; + readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 82; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -6861,28 +6873,32 @@ cluster Thermostat = 513 { octet_string<16> presetHandle = 0; } - request struct StartPresetsSchedulesEditRequestRequest { - int16u timeoutSeconds = 0; + response struct AtomicResponse = 253 { + status statusCode = 0; + AtomicAttributeStatusStruct attributeStatus[] = 1; + optional int16u timeout = 2; + } + + request struct AtomicRequestRequest { + AtomicRequestTypeEnum requestType = 0; + attrib_id attributeRequests[] = 1; + optional int16u timeout = 2; } - /** Command description for SetpointRaiseLower */ + /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Command description for SetWeeklySchedule */ + /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Command description for GetWeeklySchedule */ + /** Upon receipt, the unit SHOULD send in return the Get */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; - /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */ + /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** This command is used to set the active schedule. */ + /** Upon receipt, if the */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; - /** This command is used to set the active preset. */ + /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; - /** This command is used to start editing the presets and schedules. */ - command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7; - /** This command is used to cancel editing presets and schedules. */ - command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8; - /** This command is used to notify the server that all edits are done and should be committed. */ - command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9; + /** Begins, Commits or Cancels an atomic write */ + command access(invoke: manage) AtomicRequest(AtomicRequestRequest): AtomicResponse = 254; } /** An interface for controlling a fan in a heating/cooling system. */ diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 7242afb7dac5f8..1c4f37b4650acd 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -40197,7 +40197,7 @@ public static class ThermostatCluster extends BaseChipCluster { private static final long A_C_ERROR_CODE_ATTRIBUTE_ID = 68L; private static final long A_C_LOUVER_POSITION_ATTRIBUTE_ID = 69L; private static final long A_C_COIL_TEMPERATURE_ATTRIBUTE_ID = 70L; - private static final long A_C_CAPACITYFORMAT_ATTRIBUTE_ID = 71L; + private static final long A_C_CAPACITY_FORMAT_ATTRIBUTE_ID = 71L; private static final long PRESET_TYPES_ATTRIBUTE_ID = 72L; private static final long SCHEDULE_TYPES_ATTRIBUTE_ID = 73L; private static final long NUMBER_OF_PRESETS_ATTRIBUTE_ID = 74L; @@ -40208,8 +40208,7 @@ public static class ThermostatCluster extends BaseChipCluster { private static final long ACTIVE_SCHEDULE_HANDLE_ATTRIBUTE_ID = 79L; private static final long PRESETS_ATTRIBUTE_ID = 80L; private static final long SCHEDULES_ATTRIBUTE_ID = 81L; - private static final long PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID = 82L; - private static final long SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID = 83L; + private static final long SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID = 82L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -40394,55 +40393,55 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } - public void startPresetsSchedulesEditRequest(DefaultClusterCallback callback, Integer timeoutSeconds) { - startPresetsSchedulesEditRequest(callback, timeoutSeconds, 0); + public void atomicRequest(AtomicResponseCallback callback, Integer requestType, ArrayList attributeRequests, Optional timeout) { + atomicRequest(callback, requestType, attributeRequests, timeout, 0); } - public void startPresetsSchedulesEditRequest(DefaultClusterCallback callback, Integer timeoutSeconds, int timedInvokeTimeoutMs) { - final long commandId = 7L; + public void atomicRequest(AtomicResponseCallback callback, Integer requestType, ArrayList attributeRequests, Optional timeout, int timedInvokeTimeoutMs) { + final long commandId = 254L; ArrayList elements = new ArrayList<>(); - final long timeoutSecondsFieldID = 0L; - BaseTLVType timeoutSecondstlvValue = new UIntType(timeoutSeconds); - elements.add(new StructElement(timeoutSecondsFieldID, timeoutSecondstlvValue)); + final long requestTypeFieldID = 0L; + BaseTLVType requestTypetlvValue = new UIntType(requestType); + elements.add(new StructElement(requestTypeFieldID, requestTypetlvValue)); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } + final long attributeRequestsFieldID = 1L; + BaseTLVType attributeRequeststlvValue = ArrayType.generateArrayType(attributeRequests, (elementattributeRequests) -> new UIntType(elementattributeRequests)); + elements.add(new StructElement(attributeRequestsFieldID, attributeRequeststlvValue)); - public void cancelPresetsSchedulesEditRequest(DefaultClusterCallback callback) { - cancelPresetsSchedulesEditRequest(callback, 0); - } - - public void cancelPresetsSchedulesEditRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 8L; - - ArrayList elements = new ArrayList<>(); - StructType commandArgs = new StructType(elements); - invoke(new InvokeCallbackImpl(callback) { - @Override - public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); - }}, commandId, commandArgs, timedInvokeTimeoutMs); - } - - public void commitPresetsSchedulesRequest(DefaultClusterCallback callback) { - commitPresetsSchedulesRequest(callback, 0); - } - - public void commitPresetsSchedulesRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) { - final long commandId = 9L; + final long timeoutFieldID = 2L; + BaseTLVType timeouttlvValue = timeout.map((nonOptionaltimeout) -> new UIntType(nonOptionaltimeout)).orElse(new EmptyType()); + elements.add(new StructElement(timeoutFieldID, timeouttlvValue)); - ArrayList elements = new ArrayList<>(); StructType commandArgs = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { @Override public void onResponse(StructType invokeStructValue) { - callback.onSuccess(); + final long statusCodeFieldID = 0L; + Integer statusCode = null; + final long attributeStatusFieldID = 1L; + ArrayList attributeStatus = null; + final long timeoutFieldID = 2L; + Optional timeout = Optional.empty(); + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == statusCodeFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + statusCode = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == attributeStatusFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + attributeStatus = castingValue.map((elementcastingValue) -> ChipStructs.ThermostatClusterAtomicAttributeStatusStruct.decodeTlv(elementcastingValue)); + } + } else if (element.contextTagNum() == timeoutFieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + timeout = Optional.of(castingValue.value(Integer.class)); + } + } + } + callback.onSuccess(statusCode, attributeStatus, timeout); }}, commandId, commandArgs, timedInvokeTimeoutMs); } @@ -40450,6 +40449,10 @@ public interface GetWeeklyScheduleResponseCallback extends BaseClusterCallback { void onSuccess(Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, Integer modeForSequence, ArrayList transitions); } + public interface AtomicResponseCallback extends BaseClusterCallback { + void onSuccess(Integer statusCode, ArrayList attributeStatus, Optional timeout); + } + public interface LocalTemperatureAttributeCallback extends BaseAttributeCallback { void onSuccess(@Nullable Integer value); } @@ -42024,9 +42027,9 @@ public void onSuccess(byte[] tlv) { }, A_C_COIL_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readACCapacityformatAttribute( + public void readACCapacityFormatAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITYFORMAT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42034,21 +42037,21 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITYFORMAT_ATTRIBUTE_ID, true); + }, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID, true); } - public void writeACCapacityformatAttribute(DefaultClusterCallback callback, Integer value) { - writeACCapacityformatAttribute(callback, value, 0); + public void writeACCapacityFormatAttribute(DefaultClusterCallback callback, Integer value) { + writeACCapacityFormatAttribute(callback, value, 0); } - public void writeACCapacityformatAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + public void writeACCapacityFormatAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_CAPACITYFORMAT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_CAPACITY_FORMAT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } - public void subscribeACCapacityformatAttribute( + public void subscribeACCapacityFormatAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITYFORMAT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42056,7 +42059,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITYFORMAT_ATTRIBUTE_ID, minInterval, maxInterval); + }, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID, minInterval, maxInterval); } public void readPresetTypesAttribute( @@ -42337,32 +42340,6 @@ public void onSuccess(byte[] tlv) { }, SCHEDULES_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readPresetsSchedulesEditableAttribute( - BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID); - - readAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID, true); - } - - public void subscribePresetsSchedulesEditableAttribute( - BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID); - - subscribeAttribute(new ReportCallbackImpl(callback, path) { - @Override - public void onSuccess(byte[] tlv) { - Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); - callback.onSuccess(value); - } - }, PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID, minInterval, maxInterval); - } - public void readSetpointHoldExpiryTimestampAttribute( SetpointHoldExpiryTimestampAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SETPOINT_HOLD_EXPIRY_TIMESTAMP_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 c62c3062fa3bc4..bd800063e9101f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -9465,7 +9465,7 @@ public static class ThermostatClusterScheduleStruct { public Optional name; public Optional presetHandle; public ArrayList transitions; - public @Nullable Optional builtIn; + public @Nullable Boolean builtIn; private static final long SCHEDULE_HANDLE_ID = 0L; private static final long SYSTEM_MODE_ID = 1L; private static final long NAME_ID = 2L; @@ -9479,7 +9479,7 @@ public ThermostatClusterScheduleStruct( Optional name, Optional presetHandle, ArrayList transitions, - @Nullable Optional builtIn + @Nullable Boolean builtIn ) { this.scheduleHandle = scheduleHandle; this.systemMode = systemMode; @@ -9496,7 +9496,7 @@ public StructType encodeTlv() { values.add(new StructElement(NAME_ID, name.map((nonOptionalname) -> new StringType(nonOptionalname)).orElse(new EmptyType()))); values.add(new StructElement(PRESET_HANDLE_ID, presetHandle.map((nonOptionalpresetHandle) -> new ByteArrayType(nonOptionalpresetHandle)).orElse(new EmptyType()))); values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); - values.add(new StructElement(BUILT_IN_ID, builtIn != null ? builtIn.map((nonOptionalbuiltIn) -> new BooleanType(nonOptionalbuiltIn)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(BUILT_IN_ID, builtIn != null ? new BooleanType(builtIn) : new NullType())); return new StructType(values); } @@ -9510,7 +9510,7 @@ public static ThermostatClusterScheduleStruct decodeTlv(BaseTLVType tlvValue) { Optional name = Optional.empty(); Optional presetHandle = Optional.empty(); ArrayList transitions = null; - @Nullable Optional builtIn = null; + @Nullable Boolean builtIn = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == SCHEDULE_HANDLE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { @@ -9540,7 +9540,7 @@ public static ThermostatClusterScheduleStruct decodeTlv(BaseTLVType tlvValue) { } else if (element.contextTagNum() == BUILT_IN_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Boolean) { BooleanType castingValue = element.value(BooleanType.class); - builtIn = Optional.of(castingValue.value(Boolean.class)); + builtIn = castingValue.value(Boolean.class); } } } @@ -9580,6 +9580,67 @@ public String toString() { return output.toString(); } } +public static class ThermostatClusterAtomicAttributeStatusStruct { + public Long attributeID; + public Integer statusCode; + private static final long ATTRIBUTE_I_D_ID = 0L; + private static final long STATUS_CODE_ID = 1L; + + public ThermostatClusterAtomicAttributeStatusStruct( + Long attributeID, + Integer statusCode + ) { + this.attributeID = attributeID; + this.statusCode = statusCode; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ATTRIBUTE_I_D_ID, new UIntType(attributeID))); + values.add(new StructElement(STATUS_CODE_ID, new UIntType(statusCode))); + + return new StructType(values); + } + + public static ThermostatClusterAtomicAttributeStatusStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long attributeID = null; + Integer statusCode = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ATTRIBUTE_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + attributeID = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == STATUS_CODE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + statusCode = castingValue.value(Integer.class); + } + } + } + return new ThermostatClusterAtomicAttributeStatusStruct( + attributeID, + statusCode + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThermostatClusterAtomicAttributeStatusStruct {\n"); + output.append("\tattributeID: "); + output.append(attributeID); + output.append("\n"); + output.append("\tstatusCode: "); + output.append(statusCode); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ThermostatClusterPresetStruct { public @Nullable byte[] presetHandle; public Integer presetScenario; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index fa7487aec8e28e..f4c71003ab4d16 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -11880,7 +11880,7 @@ public enum Attribute { ACErrorCode(68L), ACLouverPosition(69L), ACCoilTemperature(70L), - ACCapacityformat(71L), + ACCapacityFormat(71L), PresetTypes(72L), ScheduleTypes(73L), NumberOfPresets(74L), @@ -11891,8 +11891,7 @@ public enum Attribute { ActiveScheduleHandle(79L), Presets(80L), Schedules(81L), - PresetsSchedulesEditable(82L), - SetpointHoldExpiryTimestamp(83L), + SetpointHoldExpiryTimestamp(82L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), @@ -11945,9 +11944,7 @@ public enum Command { ClearWeeklySchedule(3L), SetActiveScheduleRequest(5L), SetActivePresetRequest(6L), - StartPresetsSchedulesEditRequest(7L), - CancelPresetsSchedulesEditRequest(8L), - CommitPresetsSchedulesRequest(9L),; + AtomicRequest(254L),; private final long id; Command(long id) { this.id = id; @@ -12050,17 +12047,17 @@ public static SetActivePresetRequestCommandField value(int id) throws NoSuchFiel } throw new NoSuchFieldError(); } - }public enum StartPresetsSchedulesEditRequestCommandField {TimeoutSeconds(0),; + }public enum AtomicRequestCommandField {RequestType(0),AttributeRequests(1),Timeout(2),; private final int id; - StartPresetsSchedulesEditRequestCommandField(int id) { + AtomicRequestCommandField(int id) { this.id = id; } public int getID() { return id; } - public static StartPresetsSchedulesEditRequestCommandField value(int id) throws NoSuchFieldError { - for (StartPresetsSchedulesEditRequestCommandField field : StartPresetsSchedulesEditRequestCommandField.values()) { + public static AtomicRequestCommandField value(int id) throws NoSuchFieldError { + for (AtomicRequestCommandField field : AtomicRequestCommandField.values()) { if (field.getID() == id) { return field; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 70d351e0ef2751..6b94b9e80926f1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -13801,6 +13801,33 @@ public void onError(Exception error) { callback.onFailure(error); } } + + public static class DelegatedThermostatClusterAtomicResponseCallback implements ChipClusters.ThermostatCluster.AtomicResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer statusCode, ArrayList attributeStatus, Optional timeout) { + Map responseValues = new LinkedHashMap<>(); + + CommandResponseInfo statusCodeResponseValue = new CommandResponseInfo("statusCode", "Integer"); + responseValues.put(statusCodeResponseValue, statusCode); + // attributeStatus: AtomicAttributeStatusStruct + // Conversion from this type to Java is not properly implemented yet + + CommandResponseInfo timeoutResponseValue = new CommandResponseInfo("timeout", "Optional"); + responseValues.put(timeoutResponseValue, timeout); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } public static class DelegatedThermostatClusterLocalTemperatureAttributeCallback implements ChipClusters.ThermostatCluster.LocalTemperatureAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -26698,46 +26725,35 @@ public Map> getCommandMap() { ); thermostatClusterInteractionInfoMap.put("setActivePresetRequest", thermostatsetActivePresetRequestInteractionInfo); - Map thermostatstartPresetsSchedulesEditRequestCommandParams = new LinkedHashMap(); + Map thermostatatomicRequestCommandParams = new LinkedHashMap(); - CommandParameterInfo thermostatstartPresetsSchedulesEditRequesttimeoutSecondsCommandParameterInfo = new CommandParameterInfo("timeoutSeconds", Integer.class, Integer.class); - thermostatstartPresetsSchedulesEditRequestCommandParams.put("timeoutSeconds",thermostatstartPresetsSchedulesEditRequesttimeoutSecondsCommandParameterInfo); - InteractionInfo thermostatstartPresetsSchedulesEditRequestInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster) - .startPresetsSchedulesEditRequest((DefaultClusterCallback) callback - , (Integer) - commandArguments.get("timeoutSeconds") - ); - }, - () -> new DelegatedDefaultClusterCallback(), - thermostatstartPresetsSchedulesEditRequestCommandParams - ); - thermostatClusterInteractionInfoMap.put("startPresetsSchedulesEditRequest", thermostatstartPresetsSchedulesEditRequestInteractionInfo); + CommandParameterInfo thermostatatomicRequestrequestTypeCommandParameterInfo = new CommandParameterInfo("requestType", Integer.class, Integer.class); + thermostatatomicRequestCommandParams.put("requestType",thermostatatomicRequestrequestTypeCommandParameterInfo); - Map thermostatcancelPresetsSchedulesEditRequestCommandParams = new LinkedHashMap(); - InteractionInfo thermostatcancelPresetsSchedulesEditRequestInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster) - .cancelPresetsSchedulesEditRequest((DefaultClusterCallback) callback - ); - }, - () -> new DelegatedDefaultClusterCallback(), - thermostatcancelPresetsSchedulesEditRequestCommandParams - ); - thermostatClusterInteractionInfoMap.put("cancelPresetsSchedulesEditRequest", thermostatcancelPresetsSchedulesEditRequestInteractionInfo); + CommandParameterInfo thermostatatomicRequestattributeRequestsCommandParameterInfo = new CommandParameterInfo("attributeRequests", ArrayList.class, ArrayList.class); + thermostatatomicRequestCommandParams.put("attributeRequests",thermostatatomicRequestattributeRequestsCommandParameterInfo); - Map thermostatcommitPresetsSchedulesRequestCommandParams = new LinkedHashMap(); - InteractionInfo thermostatcommitPresetsSchedulesRequestInteractionInfo = new InteractionInfo( + CommandParameterInfo thermostatatomicRequesttimeoutCommandParameterInfo = new CommandParameterInfo("timeout", Optional.class, Integer.class); + thermostatatomicRequestCommandParams.put("timeout",thermostatatomicRequesttimeoutCommandParameterInfo); + InteractionInfo thermostatatomicRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) - .commitPresetsSchedulesRequest((DefaultClusterCallback) callback - ); - }, - () -> new DelegatedDefaultClusterCallback(), - thermostatcommitPresetsSchedulesRequestCommandParams - ); - thermostatClusterInteractionInfoMap.put("commitPresetsSchedulesRequest", thermostatcommitPresetsSchedulesRequestInteractionInfo); + .atomicRequest((ChipClusters.ThermostatCluster.AtomicResponseCallback) callback + , (Integer) + commandArguments.get("requestType") + + , (ArrayList) + commandArguments.get("attributeRequests") + + , (Optional) + commandArguments.get("timeout") + + ); + }, + () -> new DelegatedThermostatClusterAtomicResponseCallback(), + thermostatatomicRequestCommandParams + ); + thermostatClusterInteractionInfoMap.put("atomicRequest", thermostatatomicRequestInteractionInfo); commandMap.put("thermostat", thermostatClusterInteractionInfoMap); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index d18655ec6203d8..c7b465d726cf83 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -12773,17 +12773,17 @@ private static Map readThermostatInteractionInfo() { readThermostatACCoilTemperatureCommandParams ); result.put("readACCoilTemperatureAttribute", readThermostatACCoilTemperatureAttributeInteractionInfo); - Map readThermostatACCapacityformatCommandParams = new LinkedHashMap(); - InteractionInfo readThermostatACCapacityformatAttributeInteractionInfo = new InteractionInfo( + Map readThermostatACCapacityFormatCommandParams = new LinkedHashMap(); + InteractionInfo readThermostatACCapacityFormatAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster).readACCapacityformatAttribute( + ((ChipClusters.ThermostatCluster) cluster).readACCapacityFormatAttribute( (ChipClusters.IntegerAttributeCallback) callback ); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readThermostatACCapacityformatCommandParams + readThermostatACCapacityFormatCommandParams ); - result.put("readACCapacityformatAttribute", readThermostatACCapacityformatAttributeInteractionInfo); + result.put("readACCapacityFormatAttribute", readThermostatACCapacityFormatAttributeInteractionInfo); Map readThermostatPresetTypesCommandParams = new LinkedHashMap(); InteractionInfo readThermostatPresetTypesAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -12894,17 +12894,6 @@ private static Map readThermostatInteractionInfo() { readThermostatSchedulesCommandParams ); result.put("readSchedulesAttribute", readThermostatSchedulesAttributeInteractionInfo); - Map readThermostatPresetsSchedulesEditableCommandParams = new LinkedHashMap(); - InteractionInfo readThermostatPresetsSchedulesEditableAttributeInteractionInfo = new InteractionInfo( - (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster).readPresetsSchedulesEditableAttribute( - (ChipClusters.BooleanAttributeCallback) callback - ); - }, - () -> new ClusterInfoMapping.DelegatedBooleanAttributeCallback(), - readThermostatPresetsSchedulesEditableCommandParams - ); - result.put("readPresetsSchedulesEditableAttribute", readThermostatPresetsSchedulesEditableAttributeInteractionInfo); Map readThermostatSetpointHoldExpiryTimestampCommandParams = new LinkedHashMap(); InteractionInfo readThermostatSetpointHoldExpiryTimestampAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 28cba2abd728f8..b7c8bc28ffbe1e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -2721,28 +2721,28 @@ public Map> getWriteAttributeMap() { writeThermostatACLouverPositionCommandParams ); writeThermostatInteractionInfo.put("writeACLouverPositionAttribute", writeThermostatACLouverPositionAttributeInteractionInfo); - Map writeThermostatACCapacityformatCommandParams = new LinkedHashMap(); - CommandParameterInfo thermostatACCapacityformatCommandParameterInfo = + Map writeThermostatACCapacityFormatCommandParams = new LinkedHashMap(); + CommandParameterInfo thermostatACCapacityFormatCommandParameterInfo = new CommandParameterInfo( "value", Integer.class, Integer.class ); - writeThermostatACCapacityformatCommandParams.put( + writeThermostatACCapacityFormatCommandParams.put( "value", - thermostatACCapacityformatCommandParameterInfo + thermostatACCapacityFormatCommandParameterInfo ); - InteractionInfo writeThermostatACCapacityformatAttributeInteractionInfo = new InteractionInfo( + InteractionInfo writeThermostatACCapacityFormatAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster).writeACCapacityformatAttribute( + ((ChipClusters.ThermostatCluster) cluster).writeACCapacityFormatAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value") ); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeThermostatACCapacityformatCommandParams + writeThermostatACCapacityFormatCommandParams ); - writeThermostatInteractionInfo.put("writeACCapacityformatAttribute", writeThermostatACCapacityformatAttributeInteractionInfo); + writeThermostatInteractionInfo.put("writeACCapacityFormatAttribute", writeThermostatACCapacityFormatAttributeInteractionInfo); writeAttributeMap.put("thermostat", writeThermostatInteractionInfo); Map writeFanControlInteractionInfo = new LinkedHashMap<>(); Map writeFanControlFanModeCommandParams = new LinkedHashMap(); 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 f50c3e2c82b56e..76b0c82fa08a43 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -123,6 +123,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterPresetTypeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt new file mode 100644 index 00000000000000..7500a9619d6973 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ThermostatClusterAtomicAttributeStatusStruct(val attributeID: ULong, val statusCode: UInt) { + override fun toString(): String = buildString { + append("ThermostatClusterAtomicAttributeStatusStruct {\n") + append("\tattributeID : $attributeID\n") + append("\tstatusCode : $statusCode\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + put(ContextSpecificTag(TAG_STATUS_CODE), statusCode) + endStructure() + } + } + + companion object { + private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_STATUS_CODE = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ThermostatClusterAtomicAttributeStatusStruct { + tlvReader.enterStructure(tlvTag) + val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val statusCode = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS_CODE)) + + tlvReader.exitContainer() + + return ThermostatClusterAtomicAttributeStatusStruct(attributeID, statusCode) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleStruct.kt index 6a3b8727c32860..e05123dd91f361 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterScheduleStruct.kt @@ -30,7 +30,7 @@ class ThermostatClusterScheduleStruct( val name: Optional, val presetHandle: Optional, val transitions: List, - val builtIn: Optional?, + val builtIn: Boolean?, ) { override fun toString(): String = buildString { append("ThermostatClusterScheduleStruct {\n") @@ -66,10 +66,7 @@ class ThermostatClusterScheduleStruct( } endArray() if (builtIn != null) { - if (builtIn.isPresent) { - val optbuiltIn = builtIn.get() - put(ContextSpecificTag(TAG_BUILT_IN), optbuiltIn) - } + put(ContextSpecificTag(TAG_BUILT_IN), builtIn) } else { putNull(ContextSpecificTag(TAG_BUILT_IN)) } @@ -117,11 +114,7 @@ class ThermostatClusterScheduleStruct( } val builtIn = if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_BUILT_IN))) { - Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_BUILT_IN))) - } else { - Optional.empty() - } + tlvReader.getBoolean(ContextSpecificTag(TAG_BUILT_IN)) } else { tlvReader.getNull(ContextSpecificTag(TAG_BUILT_IN)) null diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt index 66db507eb79cd5..bd7dddda1c7cc9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt @@ -22,7 +22,6 @@ import java.util.logging.Level import java.util.logging.Logger import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.transform -import matter.controller.BooleanSubscriptionState import matter.controller.ByteSubscriptionState import matter.controller.InvokeRequest import matter.controller.InvokeResponse @@ -54,6 +53,12 @@ class ThermostatCluster(private val controller: MatterController, private val en val transitions: List, ) + class AtomicResponse( + val statusCode: UByte, + val attributeStatus: List, + val timeout: UShort?, + ) + class LocalTemperatureAttribute(val value: Short?) sealed class LocalTemperatureAttributeSubscriptionState { @@ -522,17 +527,29 @@ class ThermostatCluster(private val controller: MatterController, private val en logger.log(Level.FINE, "Invoke command succeeded: ${response}") } - suspend fun startPresetsSchedulesEditRequest( - timeoutSeconds: UShort, + suspend fun atomicRequest( + requestType: UByte, + attributeRequests: List, + timeout: UShort?, timedInvokeTimeout: Duration? = null, - ) { - val commandId: UInt = 7u + ): AtomicResponse { + val commandId: UInt = 254u val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_TIMEOUT_SECONDS_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_TIMEOUT_SECONDS_REQ), timeoutSeconds) + val TAG_REQUEST_TYPE_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_REQUEST_TYPE_REQ), requestType) + + val TAG_ATTRIBUTE_REQUESTS_REQ: Int = 1 + tlvWriter.startArray(ContextSpecificTag(TAG_ATTRIBUTE_REQUESTS_REQ)) + for (item in attributeRequests.iterator()) { + tlvWriter.put(AnonymousTag, item) + } + tlvWriter.endArray() + + val TAG_TIMEOUT_REQ: Int = 2 + timeout?.let { tlvWriter.put(ContextSpecificTag(TAG_TIMEOUT_REQ), timeout) } tlvWriter.endStructure() val request: InvokeRequest = @@ -544,42 +561,64 @@ class ThermostatCluster(private val controller: MatterController, private val en val response: InvokeResponse = controller.invoke(request) logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } - suspend fun cancelPresetsSchedulesEditRequest(timedInvokeTimeout: Duration? = null) { - val commandId: UInt = 8u + val tlvReader = TlvReader(response.payload) + tlvReader.enterStructure(AnonymousTag) + val TAG_STATUS_CODE: Int = 0 + var statusCode_decoded: UByte? = null - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - tlvWriter.endStructure() + val TAG_ATTRIBUTE_STATUS: Int = 1 + var attributeStatus_decoded: List? = null - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timedInvokeTimeout, - ) + val TAG_TIMEOUT: Int = 2 + var timeout_decoded: UShort? = null - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") - } + while (!tlvReader.isEndOfContainer()) { + val tag = tlvReader.peekElement().tag - suspend fun commitPresetsSchedulesRequest(timedInvokeTimeout: Duration? = null) { - val commandId: UInt = 9u + if (tag == ContextSpecificTag(TAG_STATUS_CODE)) { + statusCode_decoded = tlvReader.getUByte(tag) + } - val tlvWriter = TlvWriter() - tlvWriter.startStructure(AnonymousTag) - tlvWriter.endStructure() + if (tag == ContextSpecificTag(TAG_ATTRIBUTE_STATUS)) { + attributeStatus_decoded = + buildList { + tlvReader.enterArray(tag) + while (!tlvReader.isEndOfContainer()) { + add(ThermostatClusterAtomicAttributeStatusStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + } - val request: InvokeRequest = - InvokeRequest( - CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), - tlvPayload = tlvWriter.getEncoded(), - timedRequest = timedInvokeTimeout, - ) + if (tag == ContextSpecificTag(TAG_TIMEOUT)) { + timeout_decoded = + if (tlvReader.isNull()) { + tlvReader.getNull(tag) + null + } else { + if (tlvReader.isNextTag(tag)) { + tlvReader.getUShort(tag) + } else { + null + } + } + } else { + tlvReader.skipElement() + } + } - val response: InvokeResponse = controller.invoke(request) - logger.log(Level.FINE, "Invoke command succeeded: ${response}") + if (statusCode_decoded == null) { + throw IllegalStateException("statusCode not found in TLV") + } + + if (attributeStatus_decoded == null) { + throw IllegalStateException("attributeStatus not found in TLV") + } + + tlvReader.exitContainer() + + return AtomicResponse(statusCode_decoded, attributeStatus_decoded, timeout_decoded) } suspend fun readLocalTemperatureAttribute(): LocalTemperatureAttribute { @@ -6205,7 +6244,7 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun readACCapacityformatAttribute(): UByte? { + suspend fun readACCapacityFormatAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 71u val attributePath = @@ -6241,7 +6280,7 @@ class ThermostatCluster(private val controller: MatterController, private val en return decodedValue } - suspend fun writeACCapacityformatAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + suspend fun writeACCapacityFormatAttribute(value: UByte, timedWriteTimeout: Duration? = null) { val ATTRIBUTE_ID: UInt = 71u val tlvWriter = TlvWriter() @@ -6281,7 +6320,7 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun subscribeACCapacityformatAttribute( + suspend fun subscribeACCapacityFormatAttribute( minInterval: Int, maxInterval: Int, ): Flow { @@ -7437,101 +7476,8 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun readPresetsSchedulesEditableAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 82u - - 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) { "Presetsscheduleseditable attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null - } - - return decodedValue - } - - suspend fun subscribePresetsSchedulesEditableAttribute( - minInterval: Int, - maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 82u - 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( - BooleanSubscriptionState.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) { - "Presetsscheduleseditable attribute not found in Node State update" - } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null - } - - decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } - } - SubscriptionState.SubscriptionEstablished -> { - emit(BooleanSubscriptionState.SubscriptionEstablished) - } - } - } - } - suspend fun readSetpointHoldExpiryTimestampAttribute(): SetpointHoldExpiryTimestampAttribute { - val ATTRIBUTE_ID: UInt = 83u + val ATTRIBUTE_ID: UInt = 82u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -7575,7 +7521,7 @@ class ThermostatCluster(private val controller: MatterController, private val en minInterval: Int, maxInterval: Int, ): Flow { - val ATTRIBUTE_ID: UInt = 83u + val ATTRIBUTE_ID: UInt = 82u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) 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 856e286c2a2e7d..082aa01c392f8f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -123,6 +123,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterPresetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterPresetTypeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt new file mode 100644 index 00000000000000..2a67c0cccb8688 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ThermostatClusterAtomicAttributeStatusStruct(val attributeID: UInt, val statusCode: UByte) { + override fun toString(): String = buildString { + append("ThermostatClusterAtomicAttributeStatusStruct {\n") + append("\tattributeID : $attributeID\n") + append("\tstatusCode : $statusCode\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + put(ContextSpecificTag(TAG_STATUS_CODE), statusCode) + endStructure() + } + } + + companion object { + private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_STATUS_CODE = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ThermostatClusterAtomicAttributeStatusStruct { + tlvReader.enterStructure(tlvTag) + val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val statusCode = tlvReader.getUByte(ContextSpecificTag(TAG_STATUS_CODE)) + + tlvReader.exitContainer() + + return ThermostatClusterAtomicAttributeStatusStruct(attributeID, statusCode) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleStruct.kt index 720dfaf37afadd..90ca5ab50b6514 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterScheduleStruct.kt @@ -30,7 +30,7 @@ class ThermostatClusterScheduleStruct( val name: Optional, val presetHandle: Optional, val transitions: List, - val builtIn: Optional?, + val builtIn: Boolean?, ) { override fun toString(): String = buildString { append("ThermostatClusterScheduleStruct {\n") @@ -66,10 +66,7 @@ class ThermostatClusterScheduleStruct( } endArray() if (builtIn != null) { - if (builtIn.isPresent) { - val optbuiltIn = builtIn.get() - put(ContextSpecificTag(TAG_BUILT_IN), optbuiltIn) - } + put(ContextSpecificTag(TAG_BUILT_IN), builtIn) } else { putNull(ContextSpecificTag(TAG_BUILT_IN)) } @@ -117,11 +114,7 @@ class ThermostatClusterScheduleStruct( } val builtIn = if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_BUILT_IN))) { - Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_BUILT_IN))) - } else { - Optional.empty() - } + tlvReader.getBoolean(ContextSpecificTag(TAG_BUILT_IN)) } else { tlvReader.getNull(ContextSpecificTag(TAG_BUILT_IN)) null diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 0709c402c08071..3f294e84344688 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -29588,7 +29588,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jobject value; std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); + jint jnivalue = static_cast(cppValue.Raw()); chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); return value; @@ -29700,7 +29700,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jobject value; std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; - jint jnivalue = static_cast(cppValue); + jint jnivalue = static_cast(cppValue.Raw()); chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, value); return value; @@ -30376,8 +30376,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::ACCapacityformat::Id: { - using TypeInfo = Attributes::ACCapacityformat::TypeInfo; + case Attributes::ACCapacityFormat::Id: { + using TypeInfo = Attributes::ACCapacityFormat::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -30958,28 +30958,18 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR chip::JniReferences::GetInstance().AddToList(newElement_0_transitions, newElement_2); } jobject newElement_0_builtIn; - if (!entry_0.builtIn.HasValue()) + if (entry_0.builtIn.IsNull()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_builtIn); + newElement_0_builtIn = nullptr; } else { - jobject newElement_0_builtInInsideOptional; - if (entry_0.builtIn.Value().IsNull()) - { - newElement_0_builtInInsideOptional = nullptr; - } - else - { - std::string newElement_0_builtInInsideOptionalClassName = "java/lang/Boolean"; - std::string newElement_0_builtInInsideOptionalCtorSignature = "(Z)V"; - jboolean jninewElement_0_builtInInsideOptional = static_cast(entry_0.builtIn.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_0_builtInInsideOptionalClassName.c_str(), - newElement_0_builtInInsideOptionalCtorSignature.c_str(), jninewElement_0_builtInInsideOptional, - newElement_0_builtInInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(newElement_0_builtInInsideOptional, newElement_0_builtIn); + std::string newElement_0_builtInClassName = "java/lang/Boolean"; + std::string newElement_0_builtInCtorSignature = "(Z)V"; + jboolean jninewElement_0_builtIn = static_cast(entry_0.builtIn.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_builtInClassName.c_str(), + newElement_0_builtInCtorSignature.c_str(), + jninewElement_0_builtIn, newElement_0_builtIn); } jclass scheduleStructStructClass_1; @@ -30994,7 +30984,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jmethodID scheduleStructStructCtor_1; err = chip::JniReferences::GetInstance().FindMethod( env, scheduleStructStructClass_1, "", - "([BLjava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/util/Optional;)V", + "([BLjava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/ArrayList;Ljava/lang/Boolean;)V", &scheduleStructStructCtor_1); if (err != CHIP_NO_ERROR || scheduleStructStructCtor_1 == nullptr) { @@ -31009,22 +30999,6 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::PresetsSchedulesEditable::Id: { - using TypeInfo = Attributes::PresetsSchedulesEditable::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = app::DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) - { - return nullptr; - } - jobject value; - std::string valueClassName = "java/lang/Boolean"; - std::string valueCtorSignature = "(Z)V"; - jboolean jnivalue = static_cast(cppValue); - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - jnivalue, value); - return value; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { using TypeInfo = Attributes::SetpointHoldExpiryTimestamp::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index fcf0683be36ac0..688a8fb1d7cf38 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -8821,23 +8821,13 @@ class ChipClusters: "presetHandle": "bytes", }, }, - 0x00000007: { - "commandId": 0x00000007, - "commandName": "StartPresetsSchedulesEditRequest", - "args": { - "timeoutSeconds": "int", - }, - }, - 0x00000008: { - "commandId": 0x00000008, - "commandName": "CancelPresetsSchedulesEditRequest", - "args": { - }, - }, - 0x00000009: { - "commandId": 0x00000009, - "commandName": "CommitPresetsSchedulesRequest", + 0x000000FE: { + "commandId": 0x000000FE, + "commandName": "AtomicRequest", "args": { + "requestType": "int", + "attributeRequests": "int", + "timeout": "int", }, }, }, @@ -9157,7 +9147,7 @@ class ChipClusters: "reportable": True, }, 0x00000047: { - "attributeName": "ACCapacityformat", + "attributeName": "ACCapacityFormat", "attributeId": 0x00000047, "type": "int", "reportable": True, @@ -9226,14 +9216,8 @@ class ChipClusters: "writable": True, }, 0x00000052: { - "attributeName": "PresetsSchedulesEditable", - "attributeId": 0x00000052, - "type": "bool", - "reportable": True, - }, - 0x00000053: { "attributeName": "SetpointHoldExpiryTimestamp", - "attributeId": 0x00000053, + "attributeId": 0x00000052, "type": "int", "reportable": True, }, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 480ab3e7d0226c..4375645030f044 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -32033,7 +32033,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="ACErrorCode", Tag=0x00000044, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="ACLouverPosition", Tag=0x00000045, Type=typing.Optional[Thermostat.Enums.ACLouverPositionEnum]), ClusterObjectFieldDescriptor(Label="ACCoilTemperature", Tag=0x00000046, Type=typing.Union[None, Nullable, int]), - ClusterObjectFieldDescriptor(Label="ACCapacityformat", Tag=0x00000047, Type=typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]), + ClusterObjectFieldDescriptor(Label="ACCapacityFormat", Tag=0x00000047, Type=typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]), ClusterObjectFieldDescriptor(Label="presetTypes", Tag=0x00000048, Type=typing.Optional[typing.List[Thermostat.Structs.PresetTypeStruct]]), ClusterObjectFieldDescriptor(Label="scheduleTypes", Tag=0x00000049, Type=typing.Optional[typing.List[Thermostat.Structs.ScheduleTypeStruct]]), ClusterObjectFieldDescriptor(Label="numberOfPresets", Tag=0x0000004A, Type=typing.Optional[uint]), @@ -32044,8 +32044,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="activeScheduleHandle", Tag=0x0000004F, Type=typing.Union[None, Nullable, bytes]), ClusterObjectFieldDescriptor(Label="presets", Tag=0x00000050, Type=typing.Optional[typing.List[Thermostat.Structs.PresetStruct]]), ClusterObjectFieldDescriptor(Label="schedules", Tag=0x00000051, Type=typing.Optional[typing.List[Thermostat.Structs.ScheduleStruct]]), - ClusterObjectFieldDescriptor(Label="presetsSchedulesEditable", Tag=0x00000052, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="setpointHoldExpiryTimestamp", Tag=0x00000053, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="setpointHoldExpiryTimestamp", Tag=0x00000052, Type=typing.Union[None, Nullable, uint]), 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]), @@ -32102,7 +32101,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ACErrorCode: 'typing.Optional[uint]' = None ACLouverPosition: 'typing.Optional[Thermostat.Enums.ACLouverPositionEnum]' = None ACCoilTemperature: 'typing.Union[None, Nullable, int]' = None - ACCapacityformat: 'typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]' = None + ACCapacityFormat: 'typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]' = None presetTypes: 'typing.Optional[typing.List[Thermostat.Structs.PresetTypeStruct]]' = None scheduleTypes: 'typing.Optional[typing.List[Thermostat.Structs.ScheduleTypeStruct]]' = None numberOfPresets: 'typing.Optional[uint]' = None @@ -32113,7 +32112,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: activeScheduleHandle: 'typing.Union[None, Nullable, bytes]' = None presets: 'typing.Optional[typing.List[Thermostat.Structs.PresetStruct]]' = None schedules: 'typing.Optional[typing.List[Thermostat.Structs.ScheduleStruct]]' = None - presetsSchedulesEditable: 'typing.Optional[bool]' = None setpointHoldExpiryTimestamp: 'typing.Union[None, Nullable, uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None @@ -32177,6 +32175,16 @@ class ACTypeEnum(MatterIntEnum): # enum value. This specific should never be transmitted. kUnknownEnumValue = 5, + class AtomicRequestTypeEnum(MatterIntEnum): + kBeginWrite = 0x00 + kCommitWrite = 0x01 + kRollbackWrite = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, + class ControlSequenceOfOperationEnum(MatterIntEnum): kCoolingOnly = 0x00 kCoolingWithReheat = 0x01 @@ -32191,7 +32199,6 @@ class ControlSequenceOfOperationEnum(MatterIntEnum): kUnknownEnumValue = 6, class PresetScenarioEnum(MatterIntEnum): - kUnspecified = 0x00 kOccupied = 0x01 kUnoccupied = 0x02 kSleep = 0x03 @@ -32203,7 +32210,7 @@ class PresetScenarioEnum(MatterIntEnum): # to kUnknownEnumValue. This is a helper enum value that should only # be used by code to process how it handles receiving and unknown # enum value. This specific should never be transmitted. - kUnknownEnumValue = 7, + kUnknownEnumValue = 0, class SetpointChangeSourceEnum(MatterIntEnum): kManual = 0x00 @@ -32292,7 +32299,6 @@ class Feature(IntFlag): kLocalTemperatureNotExposed = 0x40 kMatterScheduleConfiguration = 0x80 kPresets = 0x100 - kSetpoints = 0x200 class HVACSystemTypeBitmap(IntFlag): kCoolingStage = 0x3 @@ -32300,6 +32306,9 @@ class HVACSystemTypeBitmap(IntFlag): kHeatingIsHeatPump = 0x10 kHeatingUsesFuel = 0x20 + class OccupancyBitmap(IntFlag): + kOccupied = 0x1 + class PresetTypeFeaturesBitmap(IntFlag): kAutomatic = 0x1 kSupportsNames = 0x2 @@ -32376,7 +32385,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="name", Tag=2, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="presetHandle", Tag=3, Type=typing.Optional[bytes]), ClusterObjectFieldDescriptor(Label="transitions", Tag=4, Type=typing.List[Thermostat.Structs.ScheduleTransitionStruct]), - ClusterObjectFieldDescriptor(Label="builtIn", Tag=5, Type=typing.Union[None, Nullable, bool]), + ClusterObjectFieldDescriptor(Label="builtIn", Tag=5, Type=typing.Union[Nullable, bool]), ]) scheduleHandle: 'typing.Union[Nullable, bytes]' = NullValue @@ -32384,7 +32393,20 @@ def descriptor(cls) -> ClusterObjectDescriptor: name: 'typing.Optional[str]' = None presetHandle: 'typing.Optional[bytes]' = None transitions: 'typing.List[Thermostat.Structs.ScheduleTransitionStruct]' = field(default_factory=lambda: []) - builtIn: 'typing.Union[None, Nullable, bool]' = None + builtIn: 'typing.Union[Nullable, bool]' = NullValue + + @dataclass + class AtomicAttributeStatusStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="statusCode", Tag=1, Type=uint), + ]) + + attributeID: 'uint' = 0 + statusCode: 'uint' = 0 @dataclass class PresetStruct(ClusterObject): @@ -32579,46 +32601,44 @@ def descriptor(cls) -> ClusterObjectDescriptor: presetHandle: 'bytes' = b"" @dataclass - class StartPresetsSchedulesEditRequest(ClusterCommand): + class AtomicResponse(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000201 - command_id: typing.ClassVar[int] = 0x00000007 - is_client: typing.ClassVar[bool] = True + command_id: typing.ClassVar[int] = 0x000000FD + is_client: typing.ClassVar[bool] = False response_type: typing.ClassVar[str] = None @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="timeoutSeconds", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="statusCode", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="attributeStatus", Tag=1, Type=typing.List[Thermostat.Structs.AtomicAttributeStatusStruct]), + ClusterObjectFieldDescriptor(Label="timeout", Tag=2, Type=typing.Optional[uint]), ]) - timeoutSeconds: 'uint' = 0 + statusCode: 'uint' = 0 + attributeStatus: 'typing.List[Thermostat.Structs.AtomicAttributeStatusStruct]' = field(default_factory=lambda: []) + timeout: 'typing.Optional[uint]' = None @dataclass - class CancelPresetsSchedulesEditRequest(ClusterCommand): + class AtomicRequest(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x00000201 - command_id: typing.ClassVar[int] = 0x00000008 + command_id: typing.ClassVar[int] = 0x000000FE is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[str] = None + response_type: typing.ClassVar[str] = 'AtomicResponse' @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ + ClusterObjectFieldDescriptor(Label="requestType", Tag=0, Type=Thermostat.Enums.AtomicRequestTypeEnum), + ClusterObjectFieldDescriptor(Label="attributeRequests", Tag=1, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="timeout", Tag=2, Type=typing.Optional[uint]), ]) - @dataclass - class CommitPresetsSchedulesRequest(ClusterCommand): - cluster_id: typing.ClassVar[int] = 0x00000201 - command_id: typing.ClassVar[int] = 0x00000009 - is_client: typing.ClassVar[bool] = True - response_type: typing.ClassVar[str] = None - - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ]) + requestType: 'Thermostat.Enums.AtomicRequestTypeEnum' = 0 + attributeRequests: 'typing.List[uint]' = field(default_factory=lambda: []) + timeout: 'typing.Optional[uint]' = None class Attributes: @dataclass @@ -33390,7 +33410,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[None, Nullable, int]' = None @dataclass - class ACCapacityformat(ClusterAttributeDescriptor): + class ACCapacityFormat(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000201 @@ -33565,22 +33585,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[typing.List[Thermostat.Structs.ScheduleStruct]]' = None - @dataclass - class PresetsSchedulesEditable(ClusterAttributeDescriptor): - @ChipUtility.classproperty - def cluster_id(cls) -> int: - return 0x00000201 - - @ChipUtility.classproperty - def attribute_id(cls) -> int: - return 0x00000052 - - @ChipUtility.classproperty - def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) - - value: 'typing.Optional[bool]' = None - @dataclass class SetpointHoldExpiryTimestamp(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -33589,7 +33593,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000053 + return 0x00000052 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 1f8b78979c8798..c5c8fec5c1f1b3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -4125,7 +4125,7 @@ static BOOL AttributeIsSpecifiedInThermostatCluster(AttributeId aAttributeId) case Attributes::ACCoilTemperature::Id: { return YES; } - case Attributes::ACCapacityformat::Id: { + case Attributes::ACCapacityFormat::Id: { return YES; } case Attributes::PresetTypes::Id: { @@ -4158,9 +4158,6 @@ static BOOL AttributeIsSpecifiedInThermostatCluster(AttributeId aAttributeId) case Attributes::Schedules::Id: { return YES; } - case Attributes::PresetsSchedulesEditable::Id: { - return YES; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 70d282af25401f..bfb6730d56dd48 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -11623,7 +11623,7 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::AbsMinHeatSetpointLimit::Id: { @@ -11700,7 +11700,7 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib return nil; } NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } case Attributes::LocalTemperatureCalibration::Id: { @@ -12157,8 +12157,8 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib } return value; } - case Attributes::ACCapacityformat::Id: { - using TypeInfo = Attributes::ACCapacityformat::TypeInfo; + case Attributes::ACCapacityFormat::Id: { + using TypeInfo = Attributes::ACCapacityFormat::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { @@ -12439,14 +12439,10 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib } newElement_0.transitions = array_2; } - if (entry_0.builtIn.HasValue()) { - if (entry_0.builtIn.Value().IsNull()) { - newElement_0.builtIn = nil; - } else { - newElement_0.builtIn = [NSNumber numberWithBool:entry_0.builtIn.Value().Value()]; - } - } else { + if (entry_0.builtIn.IsNull()) { newElement_0.builtIn = nil; + } else { + newElement_0.builtIn = [NSNumber numberWithBool:entry_0.builtIn.Value()]; } [array_0 addObject:newElement_0]; } @@ -12459,17 +12455,6 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib } return value; } - case Attributes::PresetsSchedulesEditable::Id: { - using TypeInfo = Attributes::PresetsSchedulesEditable::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } case Attributes::SetpointHoldExpiryTimestamp::Id: { using TypeInfo = Attributes::SetpointHoldExpiryTimestamp::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 bcdee4fc6798b6..f6aa72f72db1c5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -9955,25 +9955,25 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Command SetpointRaiseLower * - * Command description for SetpointRaiseLower + * Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ - (void)setpointRaiseLowerWithParams:(MTRThermostatClusterSetpointRaiseLowerParams *)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); /** * Command SetWeeklySchedule * - * Command description for SetWeeklySchedule + * Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ - (void)setWeeklyScheduleWithParams:(MTRThermostatClusterSetWeeklyScheduleParams *)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); /** * Command GetWeeklySchedule * - * Command description for GetWeeklySchedule + * Upon receipt, the unit SHOULD send in return the Get */ - (void)getWeeklyScheduleWithParams:(MTRThermostatClusterGetWeeklyScheduleParams *)params completion:(void (^)(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); /** * Command ClearWeeklySchedule * - * This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. + * This command is used to clear the weekly schedule. */ - (void)clearWeeklyScheduleWithParams:(MTRThermostatClusterClearWeeklyScheduleParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)clearWeeklyScheduleWithCompletion:(MTRStatusCompletion)completion @@ -9981,37 +9981,21 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Command SetActiveScheduleRequest * - * This command is used to set the active schedule. + * Upon receipt, if the */ - (void)setActiveScheduleRequestWithParams:(MTRThermostatClusterSetActiveScheduleRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; /** * Command SetActivePresetRequest * - * This command is used to set the active preset. + * ID */ - (void)setActivePresetRequestWithParams:(MTRThermostatClusterSetActivePresetRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; /** - * Command StartPresetsSchedulesEditRequest + * Command AtomicRequest * - * This command is used to start editing the presets and schedules. + * Begins, Commits or Cancels an atomic write */ -- (void)startPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterStartPresetsSchedulesEditRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -/** - * Command CancelPresetsSchedulesEditRequest - * - * This command is used to cancel editing presets and schedules. - */ -- (void)cancelPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterCancelPresetsSchedulesEditRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)cancelPresetsSchedulesEditRequestWithCompletion:(MTRStatusCompletion)completion - MTR_PROVISIONALLY_AVAILABLE; -/** - * Command CommitPresetsSchedulesRequest - * - * This command is used to notify the server that all edits are done and should be committed. - */ -- (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)commitPresetsSchedulesRequestWithCompletion:(MTRStatusCompletion)completion - MTR_PROVISIONALLY_AVAILABLE; +- (void)atomicRequestWithParams:(MTRThermostatClusterAtomicRequestParams *)params completion:(void (^)(MTRThermostatClusterAtomicResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributeLocalTemperatureWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeLocalTemperatureWithParams:(MTRSubscribeParams *)params @@ -10353,13 +10337,13 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeACCoilTemperatureWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -- (void)readAttributeACCapacityformatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -- (void)subscribeAttributeACCapacityformatWithParams:(MTRSubscribeParams *)params +- (void)readAttributeACCapacityFormatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeACCapacityFormatWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -+ (void)readAttributeACCapacityformatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeACCapacityFormatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)readAttributePresetTypesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributePresetTypesWithParams:(MTRSubscribeParams *)params @@ -10425,12 +10409,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; + (void)readAttributeSchedulesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)readAttributePresetsSchedulesEditableWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributePresetsSchedulesEditableWithParams:(MTRSubscribeParams *)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributePresetsSchedulesEditableWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - - (void)readAttributeSetpointHoldExpiryTimestampWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributeSetpointHoldExpiryTimestampWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished @@ -19717,6 +19695,12 @@ typedef NS_ENUM(uint8_t, MTRThermostatACType) { MTRThermostatACTypeHeatPumpInverter MTR_PROVISIONALLY_AVAILABLE = 0x04, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint8_t, MTRThermostatAtomicRequestType) { + MTRThermostatAtomicRequestTypeBeginWrite MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRThermostatAtomicRequestTypeCommitWrite MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRThermostatAtomicRequestTypeRollbackWrite MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRThermostatControlSequenceOfOperation) { MTRThermostatControlSequenceOfOperationCoolingOnly MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) = 0x00, MTRThermostatControlSequenceOfOperationCoolingWithReheat MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) = 0x01, @@ -19736,7 +19720,6 @@ typedef NS_ENUM(uint8_t, MTRThermostatControlSequence) { } MTR_DEPRECATED("Please use MTRThermostatControlSequenceOfOperation", ios(16.1, 17.4), macos(13.0, 14.4), watchos(9.1, 10.4), tvos(16.1, 17.4)); typedef NS_ENUM(uint8_t, MTRThermostatPresetScenario) { - MTRThermostatPresetScenarioUnspecified MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRThermostatPresetScenarioOccupied MTR_PROVISIONALLY_AVAILABLE = 0x01, MTRThermostatPresetScenarioUnoccupied MTR_PROVISIONALLY_AVAILABLE = 0x02, MTRThermostatPresetScenarioSleep MTR_PROVISIONALLY_AVAILABLE = 0x03, @@ -19821,7 +19804,6 @@ typedef NS_OPTIONS(uint32_t, MTRThermostatFeature) { MTRThermostatFeatureLocalTemperatureNotExposed MTR_AVAILABLE(ios(17.0), macos(14.0), watchos(10.0), tvos(17.0)) = 0x40, MTRThermostatFeatureMatterScheduleConfiguration MTR_PROVISIONALLY_AVAILABLE = 0x80, MTRThermostatFeaturePresets MTR_PROVISIONALLY_AVAILABLE = 0x100, - MTRThermostatFeatureSetpoints MTR_PROVISIONALLY_AVAILABLE = 0x200, } MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); typedef NS_OPTIONS(uint8_t, MTRThermostatHVACSystemTypeBitmap) { @@ -19831,6 +19813,10 @@ typedef NS_OPTIONS(uint8_t, MTRThermostatHVACSystemTypeBitmap) { MTRThermostatHVACSystemTypeBitmapHeatingUsesFuel MTR_PROVISIONALLY_AVAILABLE = 0x20, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_OPTIONS(uint8_t, MTRThermostatOccupancyBitmap) { + MTRThermostatOccupancyBitmapOccupied MTR_PROVISIONALLY_AVAILABLE = 0x1, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_OPTIONS(uint16_t, MTRThermostatPresetTypeFeaturesBitmap) { MTRThermostatPresetTypeFeaturesBitmapAutomatic MTR_PROVISIONALLY_AVAILABLE = 0x1, MTRThermostatPresetTypeFeaturesBitmapSupportsNames MTR_PROVISIONALLY_AVAILABLE = 0x2, @@ -25882,15 +25868,6 @@ typedef NS_OPTIONS(uint8_t, MTRTestClusterSimpleBitmap) { reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_DEPRECATED("Please use subscribeAttributeACCoilTemperatureWithParams:subscriptionEstablished:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); + (void)readAttributeACCoilTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeACCoilTemperatureWithAttributeCache:endpoint:queue:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); -- (void)readAttributeACCapacityformatWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeACCapacityformatWithCompletion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completionHandler:(MTRStatusCompletion)completionHandler MTR_DEPRECATED("Please use writeAttributeACCapacityformatWithValue:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler MTR_DEPRECATED("Please use writeAttributeACCapacityformatWithValue:params:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); -- (void)subscribeAttributeACCapacityformatWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_DEPRECATED("Please use subscribeAttributeACCapacityformatWithParams:subscriptionEstablished:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); -+ (void)readAttributeACCapacityformatWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeACCapacityformatWithAttributeCache:endpoint:queue:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); - - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeGeneratedCommandListWithCompletion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(MTRSubscribeParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 10a6bf8fe0eab8..a7d2433c901d78 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -67868,83 +67868,27 @@ - (void)setActivePresetRequestWithParams:(MTRThermostatClusterSetActivePresetReq queue:self.callbackQueue completion:responseHandler]; } -- (void)startPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterStartPresetsSchedulesEditRequestParams *)params completion:(MTRStatusCompletion)completion +- (void)atomicRequestWithParams:(MTRThermostatClusterAtomicRequestParams *)params completion:(void (^)(MTRThermostatClusterAtomicResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRThermostatClusterStartPresetsSchedulesEditRequestParams + params = [[MTRThermostatClusterAtomicRequestParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::StartPresetsSchedulesEditRequest::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)cancelPresetsSchedulesEditRequestWithCompletion:(MTRStatusCompletion)completion -{ - [self cancelPresetsSchedulesEditRequestWithParams:nil completion:completion]; -} -- (void)cancelPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterCancelPresetsSchedulesEditRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterCancelPresetsSchedulesEditRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::CancelPresetsSchedulesEditRequest::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} -- (void)commitPresetsSchedulesRequestWithCompletion:(MTRStatusCompletion)completion -{ - [self commitPresetsSchedulesRequestWithParams:nil completion:completion]; -} -- (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterCommitPresetsSchedulesRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); + completion(response, error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = Thermostat::Commands::CommitPresetsSchedulesRequest::Type; + using RequestType = Thermostat::Commands::AtomicRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) commandPayload:params timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + responseClass:MTRThermostatClusterAtomicResponseParams.class queue:self.callbackQueue completion:responseHandler]; } @@ -68305,7 +68249,7 @@ - (void)writeAttributeHVACSystemTypeConfigurationWithValue:(NSNumber * _Nonnull) ListFreer listFreer; using TypeInfo = Thermostat::Attributes::HVACSystemTypeConfiguration::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = static_cast>(value.unsignedCharValue); chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); @@ -70420,9 +70364,9 @@ + (void)readAttributeACCoilTemperatureWithClusterStateCache:(MTRClusterStateCach completion:completion]; } -- (void)readAttributeACCapacityformatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeACCapacityFormatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -70431,11 +70375,11 @@ - (void)readAttributeACCapacityformatWithCompletion:(void (^)(NSNumber * _Nullab completion:completion]; } -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - [self writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; + [self writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; } -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -70450,7 +70394,7 @@ - (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value param } ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; TypeInfo::Type cppValue; cppValue = static_cast>(value.unsignedCharValue); @@ -70459,11 +70403,11 @@ - (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value param std::move(*bridge).DispatchAction(self.device); } -- (void)subscribeAttributeACCapacityformatWithParams:(MTRSubscribeParams * _Nonnull)params +- (void)subscribeAttributeACCapacityFormatWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -70473,9 +70417,9 @@ - (void)subscribeAttributeACCapacityformatWithParams:(MTRSubscribeParams * _Nonn subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeACCapacityformatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeACCapacityFormatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -70987,15 +70931,12 @@ - (void)writeAttributeSchedulesWithValue:(NSArray * _Nonnull)value params:(MTRWr listHolder_0->mList[i_0].transitions = ListType_2(); } } - if (element_0.builtIn != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].builtIn.Emplace(); - if (element_0.builtIn == nil) { - definedValue_2.SetNull(); - } else { - auto & nonNullValue_3 = definedValue_2.SetNonNull(); - nonNullValue_3 = element_0.builtIn.boolValue; + if (element_0.builtIn == nil) { + listHolder_0->mList[i_0].builtIn.SetNull(); + } else { + auto & nonNullValue_2 = listHolder_0->mList[i_0].builtIn.SetNonNull(); + nonNullValue_2 = element_0.builtIn.boolValue; } - } } cppValue = ListType_0(listHolder_0->mList, value.count); } else { @@ -71033,42 +70974,6 @@ + (void)readAttributeSchedulesWithClusterStateCache:(MTRClusterStateCacheContain completion:completion]; } -- (void)readAttributePresetsSchedulesEditableWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::PresetsSchedulesEditable::TypeInfo; - [self.device _readKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:nil - queue:self.callbackQueue - completion:completion]; -} - -- (void)subscribeAttributePresetsSchedulesEditableWithParams:(MTRSubscribeParams * _Nonnull)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - using TypeInfo = Thermostat::Attributes::PresetsSchedulesEditable::TypeInfo; - [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID - clusterID:@(TypeInfo::GetClusterId()) - attributeID:@(TypeInfo::GetAttributeId()) - params:params - queue:self.callbackQueue - reportHandler:reportHandler - subscriptionEstablished:subscriptionEstablished]; -} - -+ (void)readAttributePresetsSchedulesEditableWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion -{ - using TypeInfo = Thermostat::Attributes::PresetsSchedulesEditable::TypeInfo; - [clusterStateCacheContainer - _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) - clusterID:TypeInfo::GetClusterId() - attributeID:TypeInfo::GetAttributeId() - queue:queue - completion:completion]; -} - - (void)readAttributeSetpointHoldExpiryTimestampWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = Thermostat::Attributes::SetpointHoldExpiryTimestamp::TypeInfo; @@ -73241,49 +73146,6 @@ + (void)readAttributeACCoilTemperatureWithAttributeCache:(MTRAttributeCacheConta }]; } -- (void)readAttributeACCapacityformatWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeACCapacityformatWithCompletion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completionHandler:(MTRStatusCompletion)completionHandler -{ - [self writeAttributeACCapacityformatWithValue:value params:nil completion:completionHandler]; -} -- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler -{ - [self writeAttributeACCapacityformatWithValue:value params:params completion:completionHandler]; -} -- (void)subscribeAttributeACCapacityformatWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval - params:(MTRSubscribeParams * _Nullable)params - subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler -{ - MTRSubscribeParams * _Nullable subscribeParams = [params copy]; - if (subscribeParams == nil) { - subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; - } else { - subscribeParams.minInterval = minInterval; - subscribeParams.maxInterval = maxInterval; - } - [self subscribeAttributeACCapacityformatWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - reportHandler(static_cast(value), error); - }]; -} -+ (void)readAttributeACCapacityformatWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler -{ - [self readAttributeACCapacityformatWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: - ^(NSNumber * _Nullable value, NSError * _Nullable error) { - // Cast is safe because subclass does not add any selectors. - completionHandler(static_cast(value), error); - }]; -} - - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler { [self readAttributeGeneratedCommandListWithCompletion: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 7cc4515e6553f2..ed78b777c82b8e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -3406,9 +3406,6 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRClusterThermostatAttributeACCoilTemperatureID MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterThermostatAttributeACCoilTemperatureID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000046, - MTRClusterThermostatAttributeACCapacityformatID - MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) - = 0x00000047, MTRClusterThermostatAttributeGeneratedCommandListID MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = MTRClusterGlobalAttributeGeneratedCommandListID, @@ -3474,7 +3471,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterThermostatAttributeACErrorCodeID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000044, MTRAttributeIDTypeClusterThermostatAttributeACLouverPositionID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000045, MTRAttributeIDTypeClusterThermostatAttributeACCoilTemperatureID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000046, - MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000047, + MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID MTR_PROVISIONALLY_AVAILABLE = 0x00000047, MTRAttributeIDTypeClusterThermostatAttributePresetTypesID MTR_PROVISIONALLY_AVAILABLE = 0x00000048, MTRAttributeIDTypeClusterThermostatAttributeScheduleTypesID MTR_PROVISIONALLY_AVAILABLE = 0x00000049, MTRAttributeIDTypeClusterThermostatAttributeNumberOfPresetsID MTR_PROVISIONALLY_AVAILABLE = 0x0000004A, @@ -3485,8 +3482,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterThermostatAttributeActiveScheduleHandleID MTR_PROVISIONALLY_AVAILABLE = 0x0000004F, MTRAttributeIDTypeClusterThermostatAttributePresetsID MTR_PROVISIONALLY_AVAILABLE = 0x00000050, MTRAttributeIDTypeClusterThermostatAttributeSchedulesID MTR_PROVISIONALLY_AVAILABLE = 0x00000051, - MTRAttributeIDTypeClusterThermostatAttributePresetsSchedulesEditableID MTR_PROVISIONALLY_AVAILABLE = 0x00000052, - MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000053, + MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID MTR_PROVISIONALLY_AVAILABLE = 0x00000052, MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterThermostatAttributeAcceptedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterThermostatAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -6588,9 +6584,8 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterThermostatCommandClearWeeklyScheduleID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000003, MTRCommandIDTypeClusterThermostatCommandSetActiveScheduleRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, MTRCommandIDTypeClusterThermostatCommandSetActivePresetRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, - MTRCommandIDTypeClusterThermostatCommandStartPresetsSchedulesEditRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, - MTRCommandIDTypeClusterThermostatCommandCancelPresetsSchedulesEditRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, - MTRCommandIDTypeClusterThermostatCommandCommitPresetsSchedulesRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, + MTRCommandIDTypeClusterThermostatCommandAtomicResponseID MTR_PROVISIONALLY_AVAILABLE = 0x000000FD, + MTRCommandIDTypeClusterThermostatCommandAtomicRequestID MTR_PROVISIONALLY_AVAILABLE = 0x000000FE, // Cluster FanControl deprecated command id names diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index a3531034733201..97806a694fbc3b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -5718,8 +5718,8 @@ result = @"ACCoilTemperature"; break; - case MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID: - result = @"ACCapacityformat"; + case MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID: + result = @"ACCapacityFormat"; break; case MTRAttributeIDTypeClusterThermostatAttributePresetTypesID: @@ -5762,10 +5762,6 @@ result = @"Schedules"; break; - case MTRAttributeIDTypeClusterThermostatAttributePresetsSchedulesEditableID: - result = @"PresetsSchedulesEditable"; - break; - case MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID: result = @"SetpointHoldExpiryTimestamp"; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 27b2a92f132369..89233d8f4a0db9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -4642,13 +4642,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)setActiveScheduleRequestWithParams:(MTRThermostatClusterSetActiveScheduleRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; - (void)setActivePresetRequestWithParams:(MTRThermostatClusterSetActivePresetRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)startPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterStartPresetsSchedulesEditRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)cancelPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterCancelPresetsSchedulesEditRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)cancelPresetsSchedulesEditRequestWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion - MTR_PROVISIONALLY_AVAILABLE; -- (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)commitPresetsSchedulesRequestWithExpectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion - MTR_PROVISIONALLY_AVAILABLE; +- (void)atomicRequestWithParams:(MTRThermostatClusterAtomicRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRThermostatClusterAtomicResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeLocalTemperatureWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); @@ -4798,9 +4792,9 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (NSDictionary * _Nullable)readAttributeACCoilTemperatureWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); -- (NSDictionary * _Nullable)readAttributeACCapacityformatWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); -- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); -- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +- (NSDictionary * _Nullable)readAttributeACCapacityFormatWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributePresetTypesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; @@ -4826,8 +4820,6 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (void)writeAttributeSchedulesWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; - (void)writeAttributeSchedulesWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (NSDictionary * _Nullable)readAttributePresetsSchedulesEditableWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - - (NSDictionary * _Nullable)readAttributeSetpointHoldExpiryTimestampWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 322daa4e9a0524..3bb172bc860c7b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -13211,82 +13211,20 @@ - (void)setActivePresetRequestWithParams:(MTRThermostatClusterSetActivePresetReq completion:responseHandler]; } -- (void)startPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterStartPresetsSchedulesEditRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion +- (void)atomicRequestWithParams:(MTRThermostatClusterAtomicRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRThermostatClusterAtomicResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { - params = [[MTRThermostatClusterStartPresetsSchedulesEditRequestParams + params = [[MTRThermostatClusterAtomicRequestParams alloc] init]; } auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::StartPresetsSchedulesEditRequest::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - -- (void)cancelPresetsSchedulesEditRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - [self cancelPresetsSchedulesEditRequestWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; -} -- (void)cancelPresetsSchedulesEditRequestWithParams:(MTRThermostatClusterCancelPresetsSchedulesEditRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterCancelPresetsSchedulesEditRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); - }; - - auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - - using RequestType = Thermostat::Commands::CancelPresetsSchedulesEditRequest::Type; - [self.device _invokeKnownCommandWithEndpointID:self.endpointID - clusterID:@(RequestType::GetClusterId()) - commandID:@(RequestType::GetCommandId()) - commandPayload:params - expectedValues:expectedValues - expectedValueInterval:expectedValueIntervalMs - timedInvokeTimeout:timedInvokeTimeoutMs - serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil - queue:self.callbackQueue - completion:responseHandler]; -} - -- (void)commitPresetsSchedulesRequestWithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - [self commitPresetsSchedulesRequestWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; -} -- (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPresetsSchedulesRequestParams * _Nullable)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion -{ - if (params == nil) { - params = [[MTRThermostatClusterCommitPresetsSchedulesRequestParams - alloc] init]; - } - - auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { - completion(error); + completion(response, error); }; auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; - using RequestType = Thermostat::Commands::CommitPresetsSchedulesRequest::Type; + using RequestType = Thermostat::Commands::AtomicRequest::Type; [self.device _invokeKnownCommandWithEndpointID:self.endpointID clusterID:@(RequestType::GetClusterId()) commandID:@(RequestType::GetCommandId()) @@ -13295,7 +13233,7 @@ - (void)commitPresetsSchedulesRequestWithParams:(MTRThermostatClusterCommitPrese expectedValueInterval:expectedValueIntervalMs timedInvokeTimeout:timedInvokeTimeoutMs serverSideProcessingTimeout:params.serverSideProcessingTimeout - responseClass:nil + responseClass:MTRThermostatClusterAtomicResponseParams.class queue:self.callbackQueue completion:responseHandler]; } @@ -13826,20 +13764,20 @@ - (void)writeAttributeACLouverPositionWithValue:(NSDictionary *) return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCoilTemperatureID) params:params]; } -- (NSDictionary * _Nullable)readAttributeACCapacityformatWithParams:(MTRReadParams * _Nullable)params +- (NSDictionary * _Nullable)readAttributeACCapacityFormatWithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID) params:params]; + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID) params:params]; } -- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs { - [self writeAttributeACCapacityformatWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; + [self writeAttributeACCapacityFormatWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; } -- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params { NSNumber * timedWriteTimeout = params.timedWriteTimeout; - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } - (NSDictionary * _Nullable)readAttributePresetTypesWithParams:(MTRReadParams * _Nullable)params @@ -13914,11 +13852,6 @@ - (void)writeAttributeSchedulesWithValue:(NSDictionary *)dataVal [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSchedulesID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } -- (NSDictionary * _Nullable)readAttributePresetsSchedulesEditableWithParams:(MTRReadParams * _Nullable)params -{ - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributePresetsSchedulesEditableID) params:params]; -} - - (NSDictionary * _Nullable)readAttributeSetpointHoldExpiryTimestampWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSetpointHoldExpiryTimestampID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 7cf6b74ee856e2..ecf7e859d2daef 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -7835,65 +7835,36 @@ MTR_PROVISIONALLY_AVAILABLE @end MTR_PROVISIONALLY_AVAILABLE -@interface MTRThermostatClusterStartPresetsSchedulesEditRequestParams : NSObject +@interface MTRThermostatClusterAtomicResponseParams : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull timeoutSeconds MTR_PROVISIONALLY_AVAILABLE; -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; +@property (nonatomic, copy) NSNumber * _Nonnull statusCode MTR_PROVISIONALLY_AVAILABLE; -/** - * Controls how much time, in seconds, we will allow for the server to process the command. - * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. - * - * If nil, the framework will try to select an appropriate timeout value itself. - */ -@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; -@end +@property (nonatomic, copy) NSArray * _Nonnull attributeStatus MTR_PROVISIONALLY_AVAILABLE; -MTR_PROVISIONALLY_AVAILABLE -@interface MTRThermostatClusterCancelPresetsSchedulesEditRequestParams : NSObject -/** - * Controls whether the command is a timed command (using Timed Invoke). - * - * If nil (the default value), a regular invoke is done for commands that do - * not require a timed invoke and a timed invoke with some default timed request - * timeout is done for commands that require a timed invoke. - * - * If not nil, a timed invoke is done, with the provided value used as the timed - * request timeout. The value should be chosen small enough to provide the - * desired security properties but large enough that it will allow a round-trip - * from the sever to the client (for the status response and actual invoke - * request) within the timeout window. - * - */ -@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; +@property (nonatomic, copy) NSNumber * _Nullable timeout MTR_PROVISIONALLY_AVAILABLE; /** - * Controls how much time, in seconds, we will allow for the server to process the command. + * Initialize an MTRThermostatClusterAtomicResponseParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. * - * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. * - * If nil, the framework will try to select an appropriate timeout value itself. + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. */ -@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; @end MTR_PROVISIONALLY_AVAILABLE -@interface MTRThermostatClusterCommitPresetsSchedulesRequestParams : NSObject +@interface MTRThermostatClusterAtomicRequestParams : NSObject + +@property (nonatomic, copy) NSNumber * _Nonnull requestType MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSArray * _Nonnull attributeRequests MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nullable timeout 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 bdeea4de027e6e..42b2061492aa4d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -22352,162 +22352,127 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end -@implementation MTRThermostatClusterStartPresetsSchedulesEditRequestParams +@implementation MTRThermostatClusterAtomicResponseParams - (instancetype)init { if (self = [super init]) { - _timeoutSeconds = @(0); - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; + _statusCode = @(0); + + _attributeStatus = [NSArray array]; + + _timeout = nil; } return self; } - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRThermostatClusterStartPresetsSchedulesEditRequestParams alloc] init]; + auto other = [[MTRThermostatClusterAtomicResponseParams alloc] init]; - other.timeoutSeconds = self.timeoutSeconds; - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + other.statusCode = self.statusCode; + other.attributeStatus = self.attributeStatus; + other.timeout = self.timeout; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: timeoutSeconds:%@; >", NSStringFromClass([self class]), _timeoutSeconds]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: statusCode:%@; attributeStatus:%@; timeout:%@; >", NSStringFromClass([self class]), _statusCode, _attributeStatus, _timeout]; return descriptionString; } -@end - -@implementation MTRThermostatClusterStartPresetsSchedulesEditRequestParams (InternalMethods) - -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error { - chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::Type encodableStruct; - ListFreer listFreer; - { - encodableStruct.timeoutSeconds = self.timeoutSeconds.unsignedShortValue; + if (!(self = [super init])) { + return nil; } - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + using DecodableType = chip::app::Clusters::Thermostat::Commands::AtomicResponse::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; - } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; - } return nil; } - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); + + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } } } - return decodedObj; -} -@end -@implementation MTRThermostatClusterCancelPresetsSchedulesEditRequestParams -- (instancetype)init -{ - if (self = [super init]) { - _timedInvokeTimeoutMs = nil; - _serverSideProcessingTimeout = nil; + NSString * errorStr = [NSString stringWithFormat:@"Command payload decoding failed: %s", err.AsString()]; + MTR_LOG_ERROR("%s", errorStr.UTF8String); + if (error != nil) { + NSDictionary * userInfo = @{ NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; + *error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:userInfo]; } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone; -{ - auto other = [[MTRThermostatClusterCancelPresetsSchedulesEditRequestParams alloc] init]; - - other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; - other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; - return descriptionString; + return nil; } @end -@implementation MTRThermostatClusterCancelPresetsSchedulesEditRequestParams (InternalMethods) +@implementation MTRThermostatClusterAtomicResponseParams (InternalMethods) -- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Thermostat::Commands::AtomicResponse::DecodableType &)decodableStruct { - chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::Type encodableStruct; - ListFreer listFreer; - - auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (buffer.IsNull()) { - return CHIP_ERROR_NO_MEMORY; + { + self.statusCode = [NSNumber numberWithUnsignedChar:decodableStruct.statusCode]; } - - chip::System::PacketBufferTLVWriter writer; - // Commands never need chained buffers, since they cannot be chunked. - writer.Init(std::move(buffer), /* useChainedBuffers = */ false); - - ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); - - ReturnErrorOnFailure(writer.Finalize(&buffer)); - - reader.Init(std::move(buffer)); - return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); -} - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error -{ - chip::System::PacketBufferTLVReader reader; - CHIP_ERROR err = [self _encodeToTLVReader:reader]; - if (err != CHIP_NO_ERROR) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:err]; + { + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = decodableStruct.attributeStatus.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRThermostatClusterAtomicAttributeStatusStruct * newElement_0; + newElement_0 = [MTRThermostatClusterAtomicAttributeStatusStruct new]; + newElement_0.attributeID = [NSNumber numberWithUnsignedInt:entry_0.attributeID]; + newElement_0.statusCode = [NSNumber numberWithUnsignedChar:entry_0.statusCode]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + return err; + } + self.attributeStatus = array_0; } - return nil; } - - auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); - if (decodedObj == nil) { - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + { + if (decodableStruct.timeout.HasValue()) { + self.timeout = [NSNumber numberWithUnsignedShort:decodableStruct.timeout.Value()]; + } else { + self.timeout = nil; } } - return decodedObj; + return CHIP_NO_ERROR; } + @end -@implementation MTRThermostatClusterCommitPresetsSchedulesRequestParams +@implementation MTRThermostatClusterAtomicRequestParams - (instancetype)init { if (self = [super init]) { + + _requestType = @(0); + + _attributeRequests = [NSArray array]; + + _timeout = nil; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -22516,8 +22481,11 @@ - (instancetype)init - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTRThermostatClusterCommitPresetsSchedulesRequestParams alloc] init]; + auto other = [[MTRThermostatClusterAtomicRequestParams alloc] init]; + other.requestType = self.requestType; + other.attributeRequests = self.attributeRequests; + other.timeout = self.timeout; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -22526,18 +22494,51 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: >", NSStringFromClass([self class])]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: requestType:%@; attributeRequests:%@; timeout:%@; >", NSStringFromClass([self class]), _requestType, _attributeRequests, _timeout]; return descriptionString; } @end -@implementation MTRThermostatClusterCommitPresetsSchedulesRequestParams (InternalMethods) +@implementation MTRThermostatClusterAtomicRequestParams (InternalMethods) - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader { - chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::Type encodableStruct; + chip::app::Clusters::Thermostat::Commands::AtomicRequest::Type encodableStruct; ListFreer listFreer; + { + encodableStruct.requestType = static_cast>(self.requestType.unsignedCharValue); + } + { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.attributeRequests.count != 0) { + auto * listHolder_0 = new ListHolder(self.attributeRequests.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.attributeRequests.count; ++i_0) { + if (![self.attributeRequests[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. + return CHIP_ERROR_INVALID_ARGUMENT; + } + auto element_0 = (NSNumber *) self.attributeRequests[i_0]; + listHolder_0->mList[i_0] = element_0.unsignedIntValue; + } + encodableStruct.attributeRequests = ListType_0(listHolder_0->mList, self.attributeRequests.count); + } else { + encodableStruct.attributeRequests = ListType_0(); + } + } + } + { + if (self.timeout != nil) { + auto & definedValue_0 = encodableStruct.timeout.Emplace(); + definedValue_0 = self.timeout.unsignedShortValue; + } + } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); if (buffer.IsNull()) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index db7e9dab35cdf5..9fb75ced469d96 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -1468,19 +1468,13 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface MTRThermostatClusterStartPresetsSchedulesEditRequestParams (InternalMethods) +@interface MTRThermostatClusterAtomicResponseParams (InternalMethods) -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; - -@end - -@interface MTRThermostatClusterCancelPresetsSchedulesEditRequestParams (InternalMethods) - -- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Thermostat::Commands::AtomicResponse::DecodableType &)decodableStruct; @end -@interface MTRThermostatClusterCommitPresetsSchedulesRequestParams (InternalMethods) +@interface MTRThermostatClusterAtomicRequestParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index b804aee8b5ace1..dfbd00cd0cb370 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1658,6 +1658,12 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable builtIn MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRThermostatClusterAtomicAttributeStatusStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull attributeID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull statusCode MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRThermostatClusterPresetStruct : NSObject @property (nonatomic, copy) NSData * _Nullable presetHandle MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index d3182118beb89c..42e90761a728c2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6998,6 +6998,36 @@ - (NSString *)description @end +@implementation MTRThermostatClusterAtomicAttributeStatusStruct +- (instancetype)init +{ + if (self = [super init]) { + + _attributeID = @(0); + + _statusCode = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRThermostatClusterAtomicAttributeStatusStruct alloc] init]; + + other.attributeID = self.attributeID; + other.statusCode = self.statusCode; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; statusCode:%@; >", NSStringFromClass([self class]), _attributeID, _statusCode]; + return descriptionString; +} + +@end + @implementation MTRThermostatClusterPresetStruct - (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 98e66215739e93..9469b2f0c33e05 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 @@ -23623,9 +23623,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a namespace Occupancy { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = @@ -23639,9 +23640,10 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * val return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::BitMask value, MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -23652,9 +23654,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BITMAP8_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -23945,9 +23948,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value namespace HVACSystemTypeConfiguration { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value) +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::BitMask * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); Protocols::InteractionModel::Status status = @@ -23961,9 +23965,11 @@ Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * val return status; } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value, + MarkAttributeDirty markDirty) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -23974,9 +23980,10 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BITMAP8_ATTRIBUTE_TYPE, markDirty); } -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value) +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits>; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return Protocols::InteractionModel::Status::ConstraintError; @@ -24063,7 +24070,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24076,7 +24083,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace OccupiedCoolingSetpoint @@ -24109,7 +24116,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24122,7 +24129,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace OccupiedHeatingSetpoint @@ -24155,7 +24162,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24168,7 +24175,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace UnoccupiedCoolingSetpoint @@ -24201,7 +24208,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24214,7 +24221,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace UnoccupiedHeatingSetpoint @@ -24247,7 +24254,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24260,7 +24267,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace MinHeatSetpointLimit @@ -24293,7 +24300,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24306,7 +24313,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace MaxHeatSetpointLimit @@ -24339,7 +24346,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24352,7 +24359,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace MinCoolSetpointLimit @@ -24385,7 +24392,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE, markDirty); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE, markDirty); } Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value) @@ -24398,7 +24405,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_INT16S_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_TEMPERATURE_ATTRIBUTE_TYPE); } } // namespace MaxCoolSetpointLimit @@ -26146,7 +26153,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a } // namespace ACCoilTemperature -namespace ACCapacityformat { +namespace ACCapacityFormat { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum * value) { @@ -26191,7 +26198,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Cl return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); } -} // namespace ACCapacityformat +} // namespace ACCapacityFormat namespace NumberOfPresets { @@ -26593,52 +26600,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a } // namespace ActiveScheduleHandle -namespace PresetsSchedulesEditable { - -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - Protocols::InteractionModel::Status status = - emberAfReadAttribute(endpoint, Clusters::Thermostat::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - *value = Traits::StorageToWorking(temp); - return status; -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE, markDirty); -} - -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) - { - return Protocols::InteractionModel::Status::ConstraintError; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); -} - -} // namespace PresetsSchedulesEditable - namespace SetpointHoldExpiryTimestamp { Protocols::InteractionModel::Status 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 d7048f05fc93e5..76c3498d10216f 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 @@ -3734,9 +3734,12 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a } // namespace OutdoorTemperature namespace Occupancy { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::BitMask * value); // OccupancyBitmap +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value); +Protocols::InteractionModel::Status +Set(chip::EndpointId endpoint, chip::BitMask value, MarkAttributeDirty markDirty); } // namespace Occupancy namespace AbsMinHeatSetpointLimit { @@ -3776,9 +3779,14 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value } // namespace PIHeatingDemand namespace HVACSystemTypeConfiguration { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // bitmap8 -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, + chip::BitMask * value); // HVACSystemTypeBitmap +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + chip::BitMask value, + MarkAttributeDirty markDirty); } // namespace HVACSystemTypeConfiguration namespace LocalTemperatureCalibration { @@ -3788,49 +3796,49 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int8_t value, } // namespace LocalTemperatureCalibration namespace OccupiedCoolingSetpoint { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace OccupiedCoolingSetpoint namespace OccupiedHeatingSetpoint { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace OccupiedHeatingSetpoint namespace UnoccupiedCoolingSetpoint { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace UnoccupiedCoolingSetpoint namespace UnoccupiedHeatingSetpoint { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace UnoccupiedHeatingSetpoint namespace MinHeatSetpointLimit { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace MinHeatSetpointLimit namespace MaxHeatSetpointLimit { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace MaxHeatSetpointLimit namespace MinCoolSetpointLimit { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace MinCoolSetpointLimit namespace MaxCoolSetpointLimit { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // int16s +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, int16_t * value); // temperature Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, int16_t value, MarkAttributeDirty markDirty); } // namespace MaxCoolSetpointLimit @@ -4095,13 +4103,13 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a MarkAttributeDirty markDirty); } // namespace ACCoilTemperature -namespace ACCapacityformat { +namespace ACCapacityFormat { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum * value); // ACCapacityFormatEnum Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum value, MarkAttributeDirty markDirty); -} // namespace ACCapacityformat +} // namespace ACCapacityFormat namespace NumberOfPresets { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // int8u @@ -4156,12 +4164,6 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a MarkAttributeDirty markDirty); } // namespace ActiveScheduleHandle -namespace PresetsSchedulesEditable { -Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value); // boolean -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value); -Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty); -} // namespace PresetsSchedulesEditable - namespace SetpointHoldExpiryTimestamp { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_s Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index e77faa965f192a..2ec4284f1ddc12 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -6300,23 +6300,11 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType & commandData); /** - * @brief Thermostat Cluster StartPresetsSchedulesEditRequest Command callback (from client) + * @brief Thermostat Cluster AtomicRequest Command callback (from client) */ -bool emberAfThermostatClusterStartPresetsSchedulesEditRequestCallback( +bool emberAfThermostatClusterAtomicRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::DecodableType & commandData); -/** - * @brief Thermostat Cluster CancelPresetsSchedulesEditRequest Command callback (from client) - */ -bool emberAfThermostatClusterCancelPresetsSchedulesEditRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::DecodableType & commandData); -/** - * @brief Thermostat Cluster CommitPresetsSchedulesRequest Command callback (from client) - */ -bool emberAfThermostatClusterCommitPresetsSchedulesRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::DecodableType & commandData); + const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData); /** * @brief Fan Control Cluster Step Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index d4a4bdd1909eb4..9368740f7fc463 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -2675,6 +2675,19 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::ACTypeEnum return EnumType::kUnknownEnumValue; } } +static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::AtomicRequestTypeEnum val) +{ + using EnumType = Thermostat::AtomicRequestTypeEnum; + switch (val) + { + case EnumType::kBeginWrite: + case EnumType::kCommitWrite: + case EnumType::kRollbackWrite: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::ControlSequenceOfOperationEnum val) { using EnumType = Thermostat::ControlSequenceOfOperationEnum; @@ -2696,7 +2709,6 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::PresetScena using EnumType = Thermostat::PresetScenarioEnum; switch (val) { - case EnumType::kUnspecified: case EnumType::kOccupied: case EnumType::kUnoccupied: case EnumType::kSleep: diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index d8092bee42e3ea..305ebd2b27d689 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -3910,6 +3910,19 @@ enum class ACTypeEnum : uint8_t kUnknownEnumValue = 5, }; +// Enum for AtomicRequestTypeEnum +enum class AtomicRequestTypeEnum : uint8_t +{ + kBeginWrite = 0x00, + kCommitWrite = 0x01, + kRollbackWrite = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + // Enum for ControlSequenceOfOperationEnum enum class ControlSequenceOfOperationEnum : uint8_t { @@ -3929,7 +3942,6 @@ enum class ControlSequenceOfOperationEnum : uint8_t // Enum for PresetScenarioEnum enum class PresetScenarioEnum : uint8_t { - kUnspecified = 0x00, kOccupied = 0x01, kUnoccupied = 0x02, kSleep = 0x03, @@ -3941,7 +3953,7 @@ enum class PresetScenarioEnum : uint8_t // to kUnknownEnumValue. This is a helper enum value that should only // be used by code to process how it handles receiving and unknown // enum value. This specific should never be transmitted. - kUnknownEnumValue = 7, + kUnknownEnumValue = 0, }; // Enum for SetpointChangeSourceEnum @@ -4053,7 +4065,6 @@ enum class Feature : uint32_t kLocalTemperatureNotExposed = 0x40, kMatterScheduleConfiguration = 0x80, kPresets = 0x100, - kSetpoints = 0x200, }; // Bitmap for HVACSystemTypeBitmap @@ -4065,6 +4076,12 @@ enum class HVACSystemTypeBitmap : uint8_t kHeatingUsesFuel = 0x20, }; +// Bitmap for OccupancyBitmap +enum class OccupancyBitmap : uint8_t +{ + kOccupied = 0x1, +}; + // Bitmap for PresetTypeFeaturesBitmap enum class PresetTypeFeaturesBitmap : uint16_t { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index f06eb2cc350702..95146178ab8c9f 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 @@ -20710,6 +20710,47 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace ScheduleStruct +namespace AtomicAttributeStatusStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kAttributeID), attributeID); + encoder.Encode(to_underlying(Fields::kStatusCode), statusCode); + 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::kAttributeID)) + { + err = DataModel::Decode(reader, attributeID); + } + else if (__context_tag == to_underlying(Fields::kStatusCode)) + { + err = DataModel::Decode(reader, statusCode); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace AtomicAttributeStatusStruct + namespace PresetStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -21175,11 +21216,13 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace SetActivePresetRequest. -namespace StartPresetsSchedulesEditRequest { +namespace AtomicResponse { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kTimeoutSeconds), timeoutSeconds); + encoder.Encode(to_underlying(Fields::kStatusCode), statusCode); + encoder.Encode(to_underlying(Fields::kAttributeStatus), attributeStatus); + encoder.Encode(to_underlying(Fields::kTimeout), timeout); return encoder.Finalize(); } @@ -21197,9 +21240,17 @@ 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::kTimeoutSeconds)) + if (__context_tag == to_underlying(Fields::kStatusCode)) + { + err = DataModel::Decode(reader, statusCode); + } + else if (__context_tag == to_underlying(Fields::kAttributeStatus)) { - err = DataModel::Decode(reader, timeoutSeconds); + err = DataModel::Decode(reader, attributeStatus); + } + else if (__context_tag == to_underlying(Fields::kTimeout)) + { + err = DataModel::Decode(reader, timeout); } else { @@ -21208,11 +21259,14 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(err); } } -} // namespace StartPresetsSchedulesEditRequest. -namespace CancelPresetsSchedulesEditRequest { +} // namespace AtomicResponse. +namespace AtomicRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRequestType), requestType); + encoder.Encode(to_underlying(Fields::kAttributeRequests), attributeRequests); + encoder.Encode(to_underlying(Fields::kTimeout), timeout); return encoder.Finalize(); } @@ -21226,29 +21280,30 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { return std::get(__element); } - } -} -} // namespace CancelPresetsSchedulesEditRequest. -namespace CommitPresetsSchedulesRequest { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - 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)) + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kRequestType)) { - return std::get(__element); + err = DataModel::Decode(reader, requestType); } + else if (__context_tag == to_underlying(Fields::kAttributeRequests)) + { + err = DataModel::Decode(reader, attributeRequests); + } + else if (__context_tag == to_underlying(Fields::kTimeout)) + { + err = DataModel::Decode(reader, timeout); + } + else + { + } + + ReturnErrorOnFailure(err); } } -} // namespace CommitPresetsSchedulesRequest. +} // namespace AtomicRequest. } // namespace Commands namespace Attributes { @@ -21352,8 +21407,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, ACLouverPosition); case Attributes::ACCoilTemperature::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, ACCoilTemperature); - case Attributes::ACCapacityformat::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, ACCapacityformat); + case Attributes::ACCapacityFormat::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, ACCapacityFormat); case Attributes::PresetTypes::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, presetTypes); case Attributes::ScheduleTypes::TypeInfo::GetAttributeId(): @@ -21374,8 +21429,6 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, presets); case Attributes::Schedules::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, schedules); - case Attributes::PresetsSchedulesEditable::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, presetsSchedulesEditable); case Attributes::SetpointHoldExpiryTimestamp::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, setpointHoldExpiryTimestamp); case Attributes::GeneratedCommandList::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 cbd58c57f444d7..fdf9956572a5ad 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 @@ -29068,7 +29068,7 @@ struct Type Optional name; Optional presetHandle; DataModel::List transitions; - Optional> builtIn; + DataModel::Nullable builtIn; static constexpr bool kIsFabricScoped = false; @@ -29083,7 +29083,7 @@ struct DecodableType Optional name; Optional presetHandle; DataModel::DecodableList transitions; - Optional> builtIn; + DataModel::Nullable builtIn; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -29091,6 +29091,29 @@ struct DecodableType }; } // namespace ScheduleStruct +namespace AtomicAttributeStatusStruct { +enum class Fields : uint8_t +{ + kAttributeID = 0, + kStatusCode = 1, +}; + +struct Type +{ +public: + chip::AttributeId attributeID = static_cast(0); + uint8_t statusCode = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace AtomicAttributeStatusStruct namespace PresetStruct { enum class Fields : uint8_t { @@ -29237,20 +29260,15 @@ struct Type; struct DecodableType; } // namespace SetActivePresetRequest -namespace StartPresetsSchedulesEditRequest { -struct Type; -struct DecodableType; -} // namespace StartPresetsSchedulesEditRequest - -namespace CancelPresetsSchedulesEditRequest { +namespace AtomicResponse { struct Type; struct DecodableType; -} // namespace CancelPresetsSchedulesEditRequest +} // namespace AtomicResponse -namespace CommitPresetsSchedulesRequest { +namespace AtomicRequest { struct Type; struct DecodableType; -} // namespace CommitPresetsSchedulesRequest +} // namespace AtomicRequest } // namespace Commands @@ -29499,20 +29517,24 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SetActivePresetRequest -namespace StartPresetsSchedulesEditRequest { +namespace AtomicResponse { enum class Fields : uint8_t { - kTimeoutSeconds = 0, + kStatusCode = 0, + kAttributeStatus = 1, + kTimeout = 2, }; struct Type { public: // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::StartPresetsSchedulesEditRequest::Id; } + static constexpr CommandId GetCommandId() { return Commands::AtomicResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - uint16_t timeoutSeconds = static_cast(0); + uint8_t statusCode = static_cast(0); + DataModel::List attributeStatus; + Optional timeout; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -29524,56 +29546,37 @@ struct Type struct DecodableType { public: - static constexpr CommandId GetCommandId() { return Commands::StartPresetsSchedulesEditRequest::Id; } + static constexpr CommandId GetCommandId() { return Commands::AtomicResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - uint16_t timeoutSeconds = static_cast(0); + uint8_t statusCode = static_cast(0); + DataModel::DecodableList attributeStatus; + Optional timeout; CHIP_ERROR Decode(TLV::TLVReader & reader); }; -}; // namespace StartPresetsSchedulesEditRequest -namespace CancelPresetsSchedulesEditRequest { +}; // namespace AtomicResponse +namespace AtomicRequest { enum class Fields : uint8_t { + kRequestType = 0, + kAttributeRequests = 1, + kTimeout = 2, }; struct Type { public: // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::CancelPresetsSchedulesEditRequest::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; - - using ResponseType = DataModel::NullObjectType; - - static constexpr bool MustUseTimedInvoke() { return false; } -}; - -struct DecodableType -{ -public: - static constexpr CommandId GetCommandId() { return Commands::CancelPresetsSchedulesEditRequest::Id; } + static constexpr CommandId GetCommandId() { return Commands::AtomicRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - CHIP_ERROR Decode(TLV::TLVReader & reader); -}; -}; // namespace CancelPresetsSchedulesEditRequest -namespace CommitPresetsSchedulesRequest { -enum class Fields : uint8_t -{ -}; - -struct Type -{ -public: - // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::CommitPresetsSchedulesRequest::Id; } - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } + AtomicRequestTypeEnum requestType = static_cast(0); + DataModel::List attributeRequests; + Optional timeout; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; - using ResponseType = DataModel::NullObjectType; + using ResponseType = Clusters::Thermostat::Commands::AtomicResponse::DecodableType; static constexpr bool MustUseTimedInvoke() { return false; } }; @@ -29581,12 +29584,15 @@ struct Type struct DecodableType { public: - static constexpr CommandId GetCommandId() { return Commands::CommitPresetsSchedulesRequest::Id; } + static constexpr CommandId GetCommandId() { return Commands::AtomicRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } + AtomicRequestTypeEnum requestType = static_cast(0); + DataModel::DecodableList attributeRequests; + Optional timeout; CHIP_ERROR Decode(TLV::TLVReader & reader); }; -}; // namespace CommitPresetsSchedulesRequest +}; // namespace AtomicRequest } // namespace Commands namespace Attributes { @@ -29618,9 +29624,9 @@ struct TypeInfo namespace Occupancy { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::Occupancy::Id; } @@ -29702,9 +29708,9 @@ struct TypeInfo namespace HVACSystemTypeConfiguration { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::BitMask; + using DecodableType = chip::BitMask; + using DecodableArgType = chip::BitMask; static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::HVACSystemTypeConfiguration::Id; } @@ -30167,7 +30173,7 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace ACCoilTemperature -namespace ACCapacityformat { +namespace ACCapacityFormat { struct TypeInfo { using Type = chip::app::Clusters::Thermostat::ACCapacityFormatEnum; @@ -30175,10 +30181,10 @@ struct TypeInfo using DecodableArgType = chip::app::Clusters::Thermostat::ACCapacityFormatEnum; static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::ACCapacityformat::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ACCapacityFormat::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace ACCapacityformat +} // namespace ACCapacityFormat namespace PresetTypes { struct TypeInfo { @@ -30309,18 +30315,6 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace Schedules -namespace PresetsSchedulesEditable { -struct TypeInfo -{ - using Type = bool; - using DecodableType = bool; - using DecodableArgType = bool; - - static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::PresetsSchedulesEditable::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace PresetsSchedulesEditable namespace SetpointHoldExpiryTimestamp { struct TypeInfo { @@ -30380,14 +30374,16 @@ struct TypeInfo Attributes::LocalTemperature::TypeInfo::DecodableType localTemperature; Attributes::OutdoorTemperature::TypeInfo::DecodableType outdoorTemperature; - Attributes::Occupancy::TypeInfo::DecodableType occupancy = static_cast(0); - Attributes::AbsMinHeatSetpointLimit::TypeInfo::DecodableType absMinHeatSetpointLimit = static_cast(0); - Attributes::AbsMaxHeatSetpointLimit::TypeInfo::DecodableType absMaxHeatSetpointLimit = static_cast(0); - Attributes::AbsMinCoolSetpointLimit::TypeInfo::DecodableType absMinCoolSetpointLimit = static_cast(0); - Attributes::AbsMaxCoolSetpointLimit::TypeInfo::DecodableType absMaxCoolSetpointLimit = static_cast(0); - Attributes::PICoolingDemand::TypeInfo::DecodableType PICoolingDemand = static_cast(0); - Attributes::PIHeatingDemand::TypeInfo::DecodableType PIHeatingDemand = static_cast(0); - Attributes::HVACSystemTypeConfiguration::TypeInfo::DecodableType HVACSystemTypeConfiguration = static_cast(0); + Attributes::Occupancy::TypeInfo::DecodableType occupancy = + static_cast>(0); + Attributes::AbsMinHeatSetpointLimit::TypeInfo::DecodableType absMinHeatSetpointLimit = static_cast(0); + Attributes::AbsMaxHeatSetpointLimit::TypeInfo::DecodableType absMaxHeatSetpointLimit = static_cast(0); + Attributes::AbsMinCoolSetpointLimit::TypeInfo::DecodableType absMinCoolSetpointLimit = static_cast(0); + Attributes::AbsMaxCoolSetpointLimit::TypeInfo::DecodableType absMaxCoolSetpointLimit = static_cast(0); + Attributes::PICoolingDemand::TypeInfo::DecodableType PICoolingDemand = static_cast(0); + Attributes::PIHeatingDemand::TypeInfo::DecodableType PIHeatingDemand = static_cast(0); + Attributes::HVACSystemTypeConfiguration::TypeInfo::DecodableType HVACSystemTypeConfiguration = + static_cast>(0); Attributes::LocalTemperatureCalibration::TypeInfo::DecodableType localTemperatureCalibration = static_cast(0); Attributes::OccupiedCoolingSetpoint::TypeInfo::DecodableType occupiedCoolingSetpoint = static_cast(0); Attributes::OccupiedHeatingSetpoint::TypeInfo::DecodableType occupiedHeatingSetpoint = static_cast(0); @@ -30439,7 +30435,7 @@ struct TypeInfo Attributes::ACLouverPosition::TypeInfo::DecodableType ACLouverPosition = static_cast(0); Attributes::ACCoilTemperature::TypeInfo::DecodableType ACCoilTemperature; - Attributes::ACCapacityformat::TypeInfo::DecodableType ACCapacityformat = + Attributes::ACCapacityFormat::TypeInfo::DecodableType ACCapacityFormat = static_cast(0); Attributes::PresetTypes::TypeInfo::DecodableType presetTypes; Attributes::ScheduleTypes::TypeInfo::DecodableType scheduleTypes; @@ -30451,7 +30447,6 @@ struct TypeInfo Attributes::ActiveScheduleHandle::TypeInfo::DecodableType activeScheduleHandle; Attributes::Presets::TypeInfo::DecodableType presets; Attributes::Schedules::TypeInfo::DecodableType schedules; - Attributes::PresetsSchedulesEditable::TypeInfo::DecodableType presetsSchedulesEditable = static_cast(0); Attributes::SetpointHoldExpiryTimestamp::TypeInfo::DecodableType setpointHoldExpiryTimestamp; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; 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 4bca1b13d93867..b021accb0a82d2 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 @@ -5138,9 +5138,9 @@ namespace ACCoilTemperature { static constexpr AttributeId Id = 0x00000046; } // namespace ACCoilTemperature -namespace ACCapacityformat { +namespace ACCapacityFormat { static constexpr AttributeId Id = 0x00000047; -} // namespace ACCapacityformat +} // namespace ACCapacityFormat namespace PresetTypes { static constexpr AttributeId Id = 0x00000048; @@ -5182,12 +5182,8 @@ namespace Schedules { static constexpr AttributeId Id = 0x00000051; } // namespace Schedules -namespace PresetsSchedulesEditable { -static constexpr AttributeId Id = 0x00000052; -} // namespace PresetsSchedulesEditable - namespace SetpointHoldExpiryTimestamp { -static constexpr AttributeId Id = 0x00000053; +static constexpr AttributeId Id = 0x00000052; } // namespace SetpointHoldExpiryTimestamp namespace GeneratedCommandList { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 015e613cdd6f29..9eca7cfa5f4153 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -1316,17 +1316,13 @@ namespace SetActivePresetRequest { static constexpr CommandId Id = 0x00000006; } // namespace SetActivePresetRequest -namespace StartPresetsSchedulesEditRequest { -static constexpr CommandId Id = 0x00000007; -} // namespace StartPresetsSchedulesEditRequest - -namespace CancelPresetsSchedulesEditRequest { -static constexpr CommandId Id = 0x00000008; -} // namespace CancelPresetsSchedulesEditRequest +namespace AtomicResponse { +static constexpr CommandId Id = 0x000000FD; +} // namespace AtomicResponse -namespace CommitPresetsSchedulesRequest { -static constexpr CommandId Id = 0x00000009; -} // namespace CommitPresetsSchedulesRequest +namespace AtomicRequest { +static constexpr CommandId Id = 0x000000FE; +} // namespace AtomicRequest } // namespace Commands } // namespace Thermostat diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 8bc86e168d8c66..07fc15c629b45f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -9392,9 +9392,7 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * ClearWeeklySchedule | 0x03 | | * SetActiveScheduleRequest | 0x05 | | * SetActivePresetRequest | 0x06 | -| * StartPresetsSchedulesEditRequest | 0x07 | -| * CancelPresetsSchedulesEditRequest | 0x08 | -| * CommitPresetsSchedulesRequest | 0x09 | +| * AtomicRequest | 0xFE | |------------------------------------------------------------------------------| | Attributes: | | | * LocalTemperature | 0x0000 | @@ -9445,7 +9443,7 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * ACErrorCode | 0x0044 | | * ACLouverPosition | 0x0045 | | * ACCoilTemperature | 0x0046 | -| * ACCapacityformat | 0x0047 | +| * ACCapacityFormat | 0x0047 | | * PresetTypes | 0x0048 | | * ScheduleTypes | 0x0049 | | * NumberOfPresets | 0x004A | @@ -9456,8 +9454,7 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * ActiveScheduleHandle | 0x004F | | * Presets | 0x0050 | | * Schedules | 0x0051 | -| * PresetsSchedulesEditable | 0x0052 | -| * SetpointHoldExpiryTimestamp | 0x0053 | +| * SetpointHoldExpiryTimestamp | 0x0052 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -9704,96 +9701,24 @@ class ThermostatSetActivePresetRequest : public ClusterCommand }; /* - * Command StartPresetsSchedulesEditRequest + * Command AtomicRequest */ -class ThermostatStartPresetsSchedulesEditRequest : public ClusterCommand +class ThermostatAtomicRequest : public ClusterCommand { public: - ThermostatStartPresetsSchedulesEditRequest(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("start-presets-schedules-edit-request", credsIssuerConfig) - { - AddArgument("TimeoutSeconds", 0, UINT16_MAX, &mRequest.timeoutSeconds); - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, - commandId, endpointIds.at(0)); - return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); - } - - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, - groupId); - - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); - } - -private: - chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::Type mRequest; -}; - -/* - * Command CancelPresetsSchedulesEditRequest - */ -class ThermostatCancelPresetsSchedulesEditRequest : public ClusterCommand -{ -public: - ThermostatCancelPresetsSchedulesEditRequest(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("cancel-presets-schedules-edit-request", credsIssuerConfig) - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, - commandId, endpointIds.at(0)); - return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); - } - - CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, - groupId); - - return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); - } - -private: - chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::Type mRequest; -}; - -/* - * Command CommitPresetsSchedulesRequest - */ -class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand -{ -public: - ThermostatCommitPresetsSchedulesRequest(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("commit-presets-schedules-request", credsIssuerConfig) + ThermostatAtomicRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("atomic-request", credsIssuerConfig), mComplex_AttributeRequests(&mRequest.attributeRequests) { + AddArgument("RequestType", 0, UINT8_MAX, &mRequest.requestType); + AddArgument("AttributeRequests", &mComplex_AttributeRequests); + AddArgument("Timeout", 0, UINT16_MAX, &mRequest.timeout); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::AtomicRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointIds.at(0)); @@ -9803,7 +9728,7 @@ class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::AtomicRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, groupId); @@ -9812,7 +9737,8 @@ class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand } private: - chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::Type mRequest; + chip::app::Clusters::Thermostat::Commands::AtomicRequest::Type mRequest; + TypedComplexArgument> mComplex_AttributeRequests; }; /*----------------------------------------------------------------------------*\ @@ -22879,16 +22805,14 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c // // Commands // - make_unique(Id, credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // - make_unique(credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // @@ -22955,7 +22879,7 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "acerror-code", Attributes::ACErrorCode::Id, credsIssuerConfig), // make_unique(Id, "aclouver-position", Attributes::ACLouverPosition::Id, credsIssuerConfig), // make_unique(Id, "accoil-temperature", Attributes::ACCoilTemperature::Id, credsIssuerConfig), // - make_unique(Id, "accapacityformat", Attributes::ACCapacityformat::Id, credsIssuerConfig), // + make_unique(Id, "accapacity-format", Attributes::ACCapacityFormat::Id, credsIssuerConfig), // make_unique(Id, "preset-types", Attributes::PresetTypes::Id, credsIssuerConfig), // make_unique(Id, "schedule-types", Attributes::ScheduleTypes::Id, credsIssuerConfig), // make_unique(Id, "number-of-presets", Attributes::NumberOfPresets::Id, credsIssuerConfig), // @@ -22968,8 +22892,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "active-schedule-handle", Attributes::ActiveScheduleHandle::Id, credsIssuerConfig), // make_unique(Id, "presets", Attributes::Presets::Id, credsIssuerConfig), // make_unique(Id, "schedules", Attributes::Schedules::Id, credsIssuerConfig), // - make_unique(Id, "presets-schedules-editable", Attributes::PresetsSchedulesEditable::Id, - credsIssuerConfig), // make_unique(Id, "setpoint-hold-expiry-timestamp", Attributes::SetpointHoldExpiryTimestamp::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // @@ -22985,8 +22907,8 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique>>(Id, "outdoor-temperature", INT16_MIN, INT16_MAX, Attributes::OutdoorTemperature::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "occupancy", 0, UINT8_MAX, Attributes::Occupancy::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "occupancy", 0, UINT8_MAX, Attributes::Occupancy::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "abs-min-heat-setpoint-limit", INT16_MIN, INT16_MAX, Attributes::AbsMinHeatSetpointLimit::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -23003,9 +22925,9 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "piheating-demand", 0, UINT8_MAX, Attributes::PIHeatingDemand::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "hvacsystem-type-configuration", 0, UINT8_MAX, - Attributes::HVACSystemTypeConfiguration::Id, WriteCommandType::kWrite, - credsIssuerConfig), // + make_unique>>( + Id, "hvacsystem-type-configuration", 0, UINT8_MAX, Attributes::HVACSystemTypeConfiguration::Id, + WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "local-temperature-calibration", INT8_MIN, INT8_MAX, Attributes::LocalTemperatureCalibration::Id, WriteCommandType::kWrite, credsIssuerConfig), // @@ -23108,7 +23030,8 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c Attributes::ACCoilTemperature::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>( - Id, "accapacityformat", 0, UINT8_MAX, Attributes::ACCapacityformat::Id, WriteCommandType::kWrite, credsIssuerConfig), // + Id, "accapacity-format", 0, UINT8_MAX, Attributes::ACCapacityFormat::Id, WriteCommandType::kWrite, + credsIssuerConfig), // make_unique>>( Id, "preset-types", Attributes::PresetTypes::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -23136,8 +23059,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique>>( Id, "schedules", Attributes::Schedules::Id, WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>(Id, "presets-schedules-editable", 0, 1, Attributes::PresetsSchedulesEditable::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>(Id, "setpoint-hold-expiry-timestamp", 0, UINT32_MAX, Attributes::SetpointHoldExpiryTimestamp::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -23221,7 +23142,7 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "acerror-code", Attributes::ACErrorCode::Id, credsIssuerConfig), // make_unique(Id, "aclouver-position", Attributes::ACLouverPosition::Id, credsIssuerConfig), // make_unique(Id, "accoil-temperature", Attributes::ACCoilTemperature::Id, credsIssuerConfig), // - make_unique(Id, "accapacityformat", Attributes::ACCapacityformat::Id, credsIssuerConfig), // + make_unique(Id, "accapacity-format", Attributes::ACCapacityFormat::Id, credsIssuerConfig), // make_unique(Id, "preset-types", Attributes::PresetTypes::Id, credsIssuerConfig), // make_unique(Id, "schedule-types", Attributes::ScheduleTypes::Id, credsIssuerConfig), // make_unique(Id, "number-of-presets", Attributes::NumberOfPresets::Id, credsIssuerConfig), // @@ -23234,8 +23155,6 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "active-schedule-handle", Attributes::ActiveScheduleHandle::Id, credsIssuerConfig), // make_unique(Id, "presets", Attributes::Presets::Id, credsIssuerConfig), // make_unique(Id, "schedules", Attributes::Schedules::Id, credsIssuerConfig), // - make_unique(Id, "presets-schedules-editable", Attributes::PresetsSchedulesEditable::Id, - credsIssuerConfig), // make_unique(Id, "setpoint-hold-expiry-timestamp", Attributes::SetpointHoldExpiryTimestamp::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index c6d7864443fafe..5f967fc503c67d 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -4027,6 +4027,7 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ComplexArgumentParser::EnsureMemberExist("ScheduleStruct.systemMode", "systemMode", value.isMember("systemMode"))); ReturnErrorOnFailure( ComplexArgumentParser::EnsureMemberExist("ScheduleStruct.transitions", "transitions", value.isMember("transitions"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("ScheduleStruct.builtIn", "builtIn", value.isMember("builtIn"))); char labelWithMember[kMaxLabelLength]; snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "scheduleHandle"); @@ -4055,11 +4056,8 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.transitions, value["transitions"])); valueCopy.removeMember("transitions"); - if (value.isMember("builtIn")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "builtIn"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.builtIn, value["builtIn"])); - } + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "builtIn"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.builtIn, value["builtIn"])); valueCopy.removeMember("builtIn"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); @@ -4075,6 +4073,38 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::S ComplexArgumentParser::Finalize(request.builtIn); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AtomicAttributeStatusStruct.attributeID", "attributeID", + value.isMember("attributeID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AtomicAttributeStatusStruct.statusCode", "statusCode", + value.isMember("statusCode"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeID, value["attributeID"])); + valueCopy.removeMember("attributeID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "statusCode"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.statusCode, value["statusCode"])); + valueCopy.removeMember("statusCode"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.attributeID); + ComplexArgumentParser::Finalize(request.statusCode); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Thermostat::Structs::PresetStruct::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 c258467efab2a6..5a82e7c35f8148 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -461,6 +461,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Str static void Finalize(chip::app::Clusters::Thermostat::Structs::ScheduleStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Structs::PresetStruct::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 e88c7d0b0d7737..f7a589c085097d 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3609,6 +3609,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::Thermostat::Structs::AtomicAttributeStatusStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("AttributeID", indent + 1, value.attributeID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AttributeID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("StatusCode", indent + 1, value.statusCode); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StatusCode'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::PresetStruct::DecodableType & value) { @@ -8116,6 +8142,16 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const Thermostat::Commands::AtomicResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("statusCode", indent + 1, value.statusCode)); + ReturnErrorOnFailure(DataModelLogger::LogValue("attributeStatus", indent + 1, value.attributeStatus)); + ReturnErrorOnFailure(DataModelLogger::LogValue("timeout", indent + 1, value.timeout)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const WiFiNetworkManagement::Commands::NetworkPassphraseResponse::DecodableType & value) { @@ -14526,7 +14562,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("OutdoorTemperature", 1, value); } case Thermostat::Attributes::Occupancy::Id: { - uint8_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("Occupancy", 1, value); } @@ -14561,7 +14597,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("PIHeatingDemand", 1, value); } case Thermostat::Attributes::HVACSystemTypeConfiguration::Id: { - uint8_t value; + chip::BitMask value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("HVACSystemTypeConfiguration", 1, value); } @@ -14755,10 +14791,10 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ACCoilTemperature", 1, value); } - case Thermostat::Attributes::ACCapacityformat::Id: { + case Thermostat::Attributes::ACCapacityFormat::Id: { chip::app::Clusters::Thermostat::ACCapacityFormatEnum value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("ACCapacityformat", 1, value); + return DataModelLogger::LogValue("ACCapacityFormat", 1, value); } case Thermostat::Attributes::PresetTypes::Id: { chip::app::DataModel::DecodableList value; @@ -14810,11 +14846,6 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("Schedules", 1, value); } - case Thermostat::Attributes::PresetsSchedulesEditable::Id: { - bool value; - ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("PresetsSchedulesEditable", 1, value); - } case Thermostat::Attributes::SetpointHoldExpiryTimestamp::Id: { chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -19297,6 +19328,11 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("GetWeeklyScheduleResponse", 1, value); } + case Thermostat::Commands::AtomicResponse::Id: { + Thermostat::Commands::AtomicResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AtomicResponse", 1, value); + } } break; } 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 8a74b57e503b30..62e8cae7cc7839 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -288,6 +288,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::Thermostat::Structs::ScheduleStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::PresetStruct::DecodableType & value); @@ -766,6 +769,8 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ServiceArea::Commands::SkipCurrentLocationResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::Thermostat::Commands::AtomicResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseResponse::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 543bfe1e3e8f4f..416597a3bdd38d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -106820,9 +106820,7 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * ClearWeeklySchedule | 0x03 | | * SetActiveScheduleRequest | 0x05 | | * SetActivePresetRequest | 0x06 | -| * StartPresetsSchedulesEditRequest | 0x07 | -| * CancelPresetsSchedulesEditRequest | 0x08 | -| * CommitPresetsSchedulesRequest | 0x09 | +| * AtomicRequest | 0xFE | |------------------------------------------------------------------------------| | Attributes: | | | * LocalTemperature | 0x0000 | @@ -106873,7 +106871,7 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * ACErrorCode | 0x0044 | | * ACLouverPosition | 0x0045 | | * ACCoilTemperature | 0x0046 | -| * ACCapacityformat | 0x0047 | +| * ACCapacityFormat | 0x0047 | | * PresetTypes | 0x0048 | | * ScheduleTypes | 0x0049 | | * NumberOfPresets | 0x004A | @@ -106884,8 +106882,7 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * ActiveScheduleHandle | 0x004F | | * Presets | 0x0050 | | * Schedules | 0x0051 | -| * PresetsSchedulesEditable | 0x0052 | -| * SetpointHoldExpiryTimestamp | 0x0053 | +| * SetpointHoldExpiryTimestamp | 0x0052 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -107226,15 +107223,22 @@ class ThermostatSetActivePresetRequest : public ClusterCommand { #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* - * Command StartPresetsSchedulesEditRequest + * Command AtomicRequest */ -class ThermostatStartPresetsSchedulesEditRequest : public ClusterCommand { +class ThermostatAtomicRequest : public ClusterCommand { public: - ThermostatStartPresetsSchedulesEditRequest() - : ClusterCommand("start-presets-schedules-edit-request") + ThermostatAtomicRequest() + : ClusterCommand("atomic-request") + , mComplex_AttributeRequests(&mRequest.attributeRequests) { #if MTR_ENABLE_PROVISIONAL - AddArgument("TimeoutSeconds", 0, UINT16_MAX, &mRequest.timeoutSeconds); + AddArgument("RequestType", 0, UINT8_MAX, &mRequest.requestType); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("AttributeRequests", &mComplex_AttributeRequests); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Timeout", 0, UINT16_MAX, &mRequest.timeout); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -107242,130 +107246,63 @@ class ThermostatStartPresetsSchedulesEditRequest : public ClusterCommand { CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::AtomicRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterStartPresetsSchedulesEditRequestParams alloc] init]; + __auto_type * params = [[MTRThermostatClusterAtomicRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL - params.timeoutSeconds = [NSNumber numberWithUnsignedShort:mRequest.timeoutSeconds]; + params.requestType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.requestType)]; #endif // MTR_ENABLE_PROVISIONAL - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster startPresetsSchedulesEditRequestWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; +#if MTR_ENABLE_PROVISIONAL + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + for (auto & entry_0 : mRequest.attributeRequests) { + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + params.attributeRequests = array_0; } - return CHIP_NO_ERROR; - } - -private: - chip::app::Clusters::Thermostat::Commands::StartPresetsSchedulesEditRequest::Type mRequest; -}; - #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Command CancelPresetsSchedulesEditRequest - */ -class ThermostatCancelPresetsSchedulesEditRequest : public ClusterCommand { -public: - ThermostatCancelPresetsSchedulesEditRequest() - : ClusterCommand("cancel-presets-schedules-edit-request") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CancelPresetsSchedulesEditRequest::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterCancelPresetsSchedulesEditRequestParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; - uint16_t repeatCount = mRepeatCount.ValueOr(1); - uint16_t __block responsesNeeded = repeatCount; - while (repeatCount--) { - [cluster cancelPresetsSchedulesEditRequestWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; + if (mRequest.timeout.HasValue()) { + params.timeout = [NSNumber numberWithUnsignedShort:mRequest.timeout.Value()]; + } else { + params.timeout = nil; } - return CHIP_NO_ERROR; - } - -private: -}; - #endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL -/* - * Command CommitPresetsSchedulesRequest - */ -class ThermostatCommitPresetsSchedulesRequest : public ClusterCommand { -public: - ThermostatCommitPresetsSchedulesRequest() - : ClusterCommand("commit-presets-schedules-request") - { - ClusterCommand::AddArguments(); - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::CommitPresetsSchedulesRequest::Id; - - ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); - - dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTRThermostatClusterCommitPresetsSchedulesRequestParams alloc] init]; - params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { - [cluster commitPresetsSchedulesRequestWithParams:params completion: - ^(NSError * _Nullable error) { - responsesNeeded--; - if (error != nil) { - mError = error; - LogNSError("Error", error); - RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); - } - if (responsesNeeded == 0) { - SetCommandExitStatus(mError); - } - }]; + [cluster atomicRequestWithParams:params completion: + ^(MTRThermostatClusterAtomicResponseParams * _Nullable values, NSError * _Nullable error) { + NSLog(@"Values: %@", values); + if (error == nil) { + constexpr chip::CommandId responseId = chip::app::Clusters::Thermostat::Commands::AtomicResponse::Id; + RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); + } + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + constexpr chip::CommandId responseId = chip::app::Clusters::Thermostat::Commands::AtomicResponse::Id; + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; } return CHIP_NO_ERROR; } private: + chip::app::Clusters::Thermostat::Commands::AtomicRequest::Type mRequest; + TypedComplexArgument> mComplex_AttributeRequests; }; #endif // MTR_ENABLE_PROVISIONAL @@ -112381,35 +112318,37 @@ class SubscribeAttributeThermostatACCoilTemperature : public SubscribeAttribute } }; +#if MTR_ENABLE_PROVISIONAL + /* - * Attribute ACCapacityformat + * Attribute ACCapacityFormat */ -class ReadThermostatACCapacityformat : public ReadAttribute { +class ReadThermostatACCapacityFormat : public ReadAttribute { public: - ReadThermostatACCapacityformat() - : ReadAttribute("accapacityformat") + ReadThermostatACCapacityFormat() + : ReadAttribute("accapacity-format") { } - ~ReadThermostatACCapacityformat() + ~ReadThermostatACCapacityFormat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityFormat::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 = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeACCapacityformatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); + [cluster readAttributeACCapacityFormatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"Thermostat.ACCapacityFormat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("Thermostat ACCapacityformat read Error", error); + LogNSError("Thermostat ACCapacityFormat read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -112418,24 +112357,24 @@ class ReadThermostatACCapacityformat : public ReadAttribute { } }; -class WriteThermostatACCapacityformat : public WriteAttribute { +class WriteThermostatACCapacityFormat : public WriteAttribute { public: - WriteThermostatACCapacityformat() - : WriteAttribute("accapacityformat") + WriteThermostatACCapacityFormat() + : WriteAttribute("accapacity-format") { - AddArgument("attr-name", "accapacityformat"); + AddArgument("attr-name", "accapacity-format"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } - ~WriteThermostatACCapacityformat() + ~WriteThermostatACCapacityFormat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityFormat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); @@ -112445,9 +112384,9 @@ class WriteThermostatACCapacityformat : public WriteAttribute { params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - [cluster writeAttributeACCapacityformatWithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster writeAttributeACCapacityFormatWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("Thermostat ACCapacityformat write Error", error); + LogNSError("Thermostat ACCapacityFormat write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -112459,21 +112398,21 @@ class WriteThermostatACCapacityformat : public WriteAttribute { uint8_t mValue; }; -class SubscribeAttributeThermostatACCapacityformat : public SubscribeAttribute { +class SubscribeAttributeThermostatACCapacityFormat : public SubscribeAttribute { public: - SubscribeAttributeThermostatACCapacityformat() - : SubscribeAttribute("accapacityformat") + SubscribeAttributeThermostatACCapacityFormat() + : SubscribeAttribute("accapacity-format") { } - ~SubscribeAttributeThermostatACCapacityformat() + ~SubscribeAttributeThermostatACCapacityFormat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityFormat::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); @@ -112488,10 +112427,10 @@ class SubscribeAttributeThermostatACCapacityformat : public SubscribeAttribute { if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeACCapacityformatWithParams:params + [cluster subscribeAttributeACCapacityFormatWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); + NSLog(@"Thermostat.ACCapacityFormat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -112504,6 +112443,7 @@ class SubscribeAttributeThermostatACCapacityformat : public SubscribeAttribute { } }; +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* @@ -113469,14 +113409,10 @@ class WriteThermostatSchedules : public WriteAttribute { } newElement_0.transitions = array_2; } - if (entry_0.builtIn.HasValue()) { - if (entry_0.builtIn.Value().IsNull()) { - newElement_0.builtIn = nil; - } else { - newElement_0.builtIn = [NSNumber numberWithBool:entry_0.builtIn.Value().Value()]; - } - } else { + if (entry_0.builtIn.IsNull()) { newElement_0.builtIn = nil; + } else { + newElement_0.builtIn = [NSNumber numberWithBool:entry_0.builtIn.Value()]; } [array_0 addObject:newElement_0]; } @@ -113546,91 +113482,6 @@ class SubscribeAttributeThermostatSchedules : public SubscribeAttribute { #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL -/* - * Attribute PresetsSchedulesEditable - */ -class ReadThermostatPresetsSchedulesEditable : public ReadAttribute { -public: - ReadThermostatPresetsSchedulesEditable() - : ReadAttribute("presets-schedules-editable") - { - } - - ~ReadThermostatPresetsSchedulesEditable() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::PresetsSchedulesEditable::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 = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributePresetsSchedulesEditableWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.PresetsSchedulesEditable response %@", [value description]); - if (error == nil) { - RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); - } else { - LogNSError("Thermostat PresetsSchedulesEditable read Error", error); - RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); - } - SetCommandExitStatus(error); - }]; - return CHIP_NO_ERROR; - } -}; - -class SubscribeAttributeThermostatPresetsSchedulesEditable : public SubscribeAttribute { -public: - SubscribeAttributeThermostatPresetsSchedulesEditable() - : SubscribeAttribute("presets-schedules-editable") - { - } - - ~SubscribeAttributeThermostatPresetsSchedulesEditable() - { - } - - CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override - { - constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::PresetsSchedulesEditable::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 = [[MTRBaseClusterThermostat 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 subscribeAttributePresetsSchedulesEditableWithParams:params - subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.PresetsSchedulesEditable 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 SetpointHoldExpiryTimestamp */ @@ -193932,13 +193783,7 @@ void registerClusterThermostat(Commands & commands) make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL -#if MTR_ENABLE_PROVISIONAL - make_unique(), // + make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // @@ -194065,9 +193910,11 @@ void registerClusterThermostat(Commands & commands) make_unique(), // make_unique(), // make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // @@ -194110,10 +193957,6 @@ void registerClusterThermostat(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(), // From 85114691b42a19eccbeef014f5604a2acf0f1700 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Mon, 29 Jul 2024 14:22:38 -0400 Subject: [PATCH 17/63] Pull in ACCapacityFormat typo un-fix --- .../air-purifier-app.matter | 2 +- .../all-clusters-app.matter | 2 +- .../all-clusters-minimal-app.matter | 2 +- ...umiditysensor_thermostat_56de3d5f45.matter | 2 +- ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 2 +- ...tnode_roomairconditioner_9cf3607804.matter | 2 +- .../rootnode_thermostat_bm3fb8dhYi.matter | 2 +- .../placeholder/linux/apps/app1/config.matter | 6 +- .../placeholder/linux/apps/app2/config.matter | 6 +- .../nxp/zap/thermostat_matter_thread.matter | 2 +- .../nxp/zap/thermostat_matter_wifi.matter | 2 +- .../qpg/zap/thermostaticRadiatorValve.matter | 2 +- .../thermostat-common/thermostat.matter | 2 +- .../data-model/chip/thermostat-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../chip/devicecontroller/ChipClusters.java | 22 +++---- .../devicecontroller/ClusterIDMapping.java | 2 +- .../devicecontroller/ClusterReadMapping.java | 10 +-- .../devicecontroller/ClusterWriteMapping.java | 16 ++--- .../cluster/clusters/ThermostatCluster.kt | 6 +- .../CHIPAttributeTLVValueDecoder.cpp | 4 +- .../python/chip/clusters/CHIPClusters.py | 2 +- .../python/chip/clusters/Objects.py | 11 ++-- .../MTRAttributeSpecifiedCheck.mm | 2 +- .../MTRAttributeTLVValueDecoder.mm | 4 +- .../CHIP/zap-generated/MTRBaseClusters.h | 21 +++++-- .../CHIP/zap-generated/MTRBaseClusters.mm | 63 ++++++++++++++++--- .../CHIP/zap-generated/MTRClusterConstants.h | 5 +- .../CHIP/zap-generated/MTRClusterNames.mm | 4 +- .../CHIP/zap-generated/MTRClusters.h | 6 +- .../CHIP/zap-generated/MTRClusters.mm | 12 ++-- .../zap-generated/attributes/Accessors.cpp | 4 +- .../zap-generated/attributes/Accessors.h | 4 +- .../zap-generated/cluster-objects.cpp | 4 +- .../zap-generated/cluster-objects.h | 8 +-- .../app-common/zap-generated/ids/Attributes.h | 4 +- .../zap-generated/cluster/Commands.h | 9 ++- .../cluster/logging/DataModelLogger.cpp | 4 +- .../zap-generated/cluster/Commands.h | 61 +++++++++--------- 39 files changed, 188 insertions(+), 138 deletions(-) diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index 96489e2d4be248..17d9d12e427b4d 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1527,7 +1527,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; 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 e740ae92ca419f..ac0d4f92a505c0 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 @@ -5306,7 +5306,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 76bc004b89685c..9634a76c751215 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -3801,7 +3801,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index 58ee28823dec60..a28e037a6fe362 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1450,7 +1450,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 7aaaa26b7fe5e2..7da121ab44b484 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -1807,7 +1807,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 72e416cf1b32bc..0f53c121fda8cd 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1390,7 +1390,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index 17c4fd280a7715..9eab62e9ab4851 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1610,7 +1610,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 0f5dc62975f400..28fef10eab4a5e 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -5058,7 +5058,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -5424,7 +5424,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -8830,7 +8830,7 @@ endpoint 0 { callback attribute ACCompressorType default = 0x00; callback attribute ACLouverPosition default = 0x00; callback attribute ACCoilTemperature; - callback attribute ACCapacityFormat default = 0x00; + callback attribute ACCapacityformat default = 0x00; ram attribute featureMap default = 0x000b; ram attribute clusterRevision default = 6; } diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index dbc5ed9d5879e0..7d6ec10bbd4b2d 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -5015,7 +5015,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -5381,7 +5381,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; @@ -8794,7 +8794,7 @@ endpoint 0 { callback attribute ACCompressorType default = 0x00; callback attribute ACLouverPosition default = 0x00; callback attribute ACCoilTemperature; - callback attribute ACCapacityFormat default = 0x00; + callback attribute ACCapacityformat default = 0x00; ram attribute featureMap default = 0x000b; ram attribute clusterRevision default = 6; } diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 8aee119a4e54aa..7d556c2230c707 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -2201,7 +2201,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 35a801a85e8b88..f4a7333035a85b 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -2112,7 +2112,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index b9f49ba90f212f..7e9ff0d4bc690c 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -1809,7 +1809,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index a0b8121bf5bb8e..7c711787abf026 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -1989,7 +1989,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index 58b44a99d88fcd..e8b8aa8c98755c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -429,7 +429,7 @@ limitations under the License. ACCoilTemperature - ACCapacityFormat + ACCapacityformat PresetTypes diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index cbb2f1de860c06..b65a7372d20e00 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6850,7 +6850,7 @@ cluster Thermostat = 513 { attribute access(write: manage) optional ACErrorCodeBitmap ACErrorCode = 68; attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69; readonly attribute optional nullable temperature ACCoilTemperature = 70; - attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityFormat = 71; + attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71; readonly attribute optional PresetTypeStruct presetTypes[] = 72; readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73; readonly attribute optional int8u numberOfPresets = 74; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index fa90d3b7526abb..552651bd4c5b3f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -40213,7 +40213,7 @@ public static class ThermostatCluster extends BaseChipCluster { private static final long A_C_ERROR_CODE_ATTRIBUTE_ID = 68L; private static final long A_C_LOUVER_POSITION_ATTRIBUTE_ID = 69L; private static final long A_C_COIL_TEMPERATURE_ATTRIBUTE_ID = 70L; - private static final long A_C_CAPACITY_FORMAT_ATTRIBUTE_ID = 71L; + private static final long A_C_CAPACITYFORMAT_ATTRIBUTE_ID = 71L; private static final long PRESET_TYPES_ATTRIBUTE_ID = 72L; private static final long SCHEDULE_TYPES_ATTRIBUTE_ID = 73L; private static final long NUMBER_OF_PRESETS_ATTRIBUTE_ID = 74L; @@ -42043,9 +42043,9 @@ public void onSuccess(byte[] tlv) { }, A_C_COIL_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } - public void readACCapacityFormatAttribute( + public void readACCapacityformatAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITYFORMAT_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42053,21 +42053,21 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID, true); + }, A_C_CAPACITYFORMAT_ATTRIBUTE_ID, true); } - public void writeACCapacityFormatAttribute(DefaultClusterCallback callback, Integer value) { - writeACCapacityFormatAttribute(callback, value, 0); + public void writeACCapacityformatAttribute(DefaultClusterCallback callback, Integer value) { + writeACCapacityformatAttribute(callback, value, 0); } - public void writeACCapacityFormatAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + public void writeACCapacityformatAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_CAPACITY_FORMAT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_CAPACITYFORMAT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } - public void subscribeACCapacityFormatAttribute( + public void subscribeACCapacityformatAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITYFORMAT_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42075,7 +42075,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITY_FORMAT_ATTRIBUTE_ID, minInterval, maxInterval); + }, A_C_CAPACITYFORMAT_ATTRIBUTE_ID, minInterval, maxInterval); } public void readPresetTypesAttribute( diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 7dc00092e9585f..5435ed6bad2e36 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -11885,7 +11885,7 @@ public enum Attribute { ACErrorCode(68L), ACLouverPosition(69L), ACCoilTemperature(70L), - ACCapacityFormat(71L), + ACCapacityformat(71L), PresetTypes(72L), ScheduleTypes(73L), NumberOfPresets(74L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index d846b1244f7b3d..c851578b3ab69d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -12773,17 +12773,17 @@ private static Map readThermostatInteractionInfo() { readThermostatACCoilTemperatureCommandParams ); result.put("readACCoilTemperatureAttribute", readThermostatACCoilTemperatureAttributeInteractionInfo); - Map readThermostatACCapacityFormatCommandParams = new LinkedHashMap(); - InteractionInfo readThermostatACCapacityFormatAttributeInteractionInfo = new InteractionInfo( + Map readThermostatACCapacityformatCommandParams = new LinkedHashMap(); + InteractionInfo readThermostatACCapacityformatAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster).readACCapacityFormatAttribute( + ((ChipClusters.ThermostatCluster) cluster).readACCapacityformatAttribute( (ChipClusters.IntegerAttributeCallback) callback ); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readThermostatACCapacityFormatCommandParams + readThermostatACCapacityformatCommandParams ); - result.put("readACCapacityFormatAttribute", readThermostatACCapacityFormatAttributeInteractionInfo); + result.put("readACCapacityformatAttribute", readThermostatACCapacityformatAttributeInteractionInfo); Map readThermostatPresetTypesCommandParams = new LinkedHashMap(); InteractionInfo readThermostatPresetTypesAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 0dbfc44dda67d0..32759bb97af64c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -2721,28 +2721,28 @@ public Map> getWriteAttributeMap() { writeThermostatACLouverPositionCommandParams ); writeThermostatInteractionInfo.put("writeACLouverPositionAttribute", writeThermostatACLouverPositionAttributeInteractionInfo); - Map writeThermostatACCapacityFormatCommandParams = new LinkedHashMap(); - CommandParameterInfo thermostatACCapacityFormatCommandParameterInfo = + Map writeThermostatACCapacityformatCommandParams = new LinkedHashMap(); + CommandParameterInfo thermostatACCapacityformatCommandParameterInfo = new CommandParameterInfo( "value", Integer.class, Integer.class ); - writeThermostatACCapacityFormatCommandParams.put( + writeThermostatACCapacityformatCommandParams.put( "value", - thermostatACCapacityFormatCommandParameterInfo + thermostatACCapacityformatCommandParameterInfo ); - InteractionInfo writeThermostatACCapacityFormatAttributeInteractionInfo = new InteractionInfo( + InteractionInfo writeThermostatACCapacityformatAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { - ((ChipClusters.ThermostatCluster) cluster).writeACCapacityFormatAttribute( + ((ChipClusters.ThermostatCluster) cluster).writeACCapacityformatAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value") ); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), - writeThermostatACCapacityFormatCommandParams + writeThermostatACCapacityformatCommandParams ); - writeThermostatInteractionInfo.put("writeACCapacityFormatAttribute", writeThermostatACCapacityFormatAttributeInteractionInfo); + writeThermostatInteractionInfo.put("writeACCapacityformatAttribute", writeThermostatACCapacityformatAttributeInteractionInfo); writeAttributeMap.put("thermostat", writeThermostatInteractionInfo); Map writeFanControlInteractionInfo = new LinkedHashMap<>(); Map writeFanControlFanModeCommandParams = new LinkedHashMap(); diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt index bd7dddda1c7cc9..b9166c12e937a1 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThermostatCluster.kt @@ -6244,7 +6244,7 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun readACCapacityFormatAttribute(): UByte? { + suspend fun readACCapacityformatAttribute(): UByte? { val ATTRIBUTE_ID: UInt = 71u val attributePath = @@ -6280,7 +6280,7 @@ class ThermostatCluster(private val controller: MatterController, private val en return decodedValue } - suspend fun writeACCapacityFormatAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + suspend fun writeACCapacityformatAttribute(value: UByte, timedWriteTimeout: Duration? = null) { val ATTRIBUTE_ID: UInt = 71u val tlvWriter = TlvWriter() @@ -6320,7 +6320,7 @@ class ThermostatCluster(private val controller: MatterController, private val en } } - suspend fun subscribeACCapacityFormatAttribute( + suspend fun subscribeACCapacityformatAttribute( minInterval: Int, maxInterval: Int, ): Flow { diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index fec486c070f4a6..e4ddb358eb4411 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -30376,8 +30376,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::ACCapacityFormat::Id: { - using TypeInfo = Attributes::ACCapacityFormat::TypeInfo; + case Attributes::ACCapacityformat::Id: { + using TypeInfo = Attributes::ACCapacityformat::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 86eb43895430c3..4e787228619688 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -9153,7 +9153,7 @@ class ChipClusters: "reportable": True, }, 0x00000047: { - "attributeName": "ACCapacityFormat", + "attributeName": "ACCapacityformat", "attributeId": 0x00000047, "type": "int", "reportable": True, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index e60734abbc3556..f14b7c8d04c139 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -32104,7 +32104,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="ACErrorCode", Tag=0x00000044, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="ACLouverPosition", Tag=0x00000045, Type=typing.Optional[Thermostat.Enums.ACLouverPositionEnum]), ClusterObjectFieldDescriptor(Label="ACCoilTemperature", Tag=0x00000046, Type=typing.Union[None, Nullable, int]), - ClusterObjectFieldDescriptor(Label="ACCapacityFormat", Tag=0x00000047, Type=typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]), + ClusterObjectFieldDescriptor(Label="ACCapacityformat", Tag=0x00000047, Type=typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]), ClusterObjectFieldDescriptor(Label="presetTypes", Tag=0x00000048, Type=typing.Optional[typing.List[Thermostat.Structs.PresetTypeStruct]]), ClusterObjectFieldDescriptor(Label="scheduleTypes", Tag=0x00000049, Type=typing.Optional[typing.List[Thermostat.Structs.ScheduleTypeStruct]]), ClusterObjectFieldDescriptor(Label="numberOfPresets", Tag=0x0000004A, Type=typing.Optional[uint]), @@ -32172,7 +32172,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ACErrorCode: 'typing.Optional[uint]' = None ACLouverPosition: 'typing.Optional[Thermostat.Enums.ACLouverPositionEnum]' = None ACCoilTemperature: 'typing.Union[None, Nullable, int]' = None - ACCapacityFormat: 'typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]' = None + ACCapacityformat: 'typing.Optional[Thermostat.Enums.ACCapacityFormatEnum]' = None presetTypes: 'typing.Optional[typing.List[Thermostat.Structs.PresetTypeStruct]]' = None scheduleTypes: 'typing.Optional[typing.List[Thermostat.Structs.ScheduleTypeStruct]]' = None numberOfPresets: 'typing.Optional[uint]' = None @@ -32252,8 +32252,8 @@ class AtomicRequestTypeEnum(MatterIntEnum): kRollbackWrite = 0x02 # All received enum values that are not listed above will be mapped # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving and unknown - # enum value. This specific should never be transmitted. + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. kUnknownEnumValue = 3, class ControlSequenceOfOperationEnum(MatterIntEnum): @@ -33481,7 +33481,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[None, Nullable, int]' = None @dataclass - class ACCapacityFormat(ClusterAttributeDescriptor): + class ACCapacityformat(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x00000201 @@ -52757,3 +52757,4 @@ def descriptor(cls) -> ClusterObjectDescriptor: count: 'uint' = 0 fabricIndex: 'uint' = 0 + diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 61a05300a054a5..dd7f39efec2844 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -4125,7 +4125,7 @@ static BOOL AttributeIsSpecifiedInThermostatCluster(AttributeId aAttributeId) case Attributes::ACCoilTemperature::Id: { return YES; } - case Attributes::ACCapacityFormat::Id: { + case Attributes::ACCapacityformat::Id: { return YES; } case Attributes::PresetTypes::Id: { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 517896208d03df..1a69014502ff6f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -12157,8 +12157,8 @@ static id _Nullable DecodeAttributeValueForThermostatCluster(AttributeId aAttrib } return value; } - case Attributes::ACCapacityFormat::Id: { - using TypeInfo = Attributes::ACCapacityFormat::TypeInfo; + case Attributes::ACCapacityformat::Id: { + using TypeInfo = Attributes::ACCapacityformat::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 88bd9d985685bc..bb9139ddf4ef78 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -10346,13 +10346,13 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeACCoilTemperatureWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); -- (void)readAttributeACCapacityFormatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; -- (void)subscribeAttributeACCapacityFormatWithParams:(MTRSubscribeParams *)params +- (void)readAttributeACCapacityformatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)subscribeAttributeACCapacityformatWithParams:(MTRSubscribeParams *)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; -+ (void)readAttributeACCapacityFormatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); ++ (void)readAttributeACCapacityformatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)readAttributePresetTypesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)subscribeAttributePresetTypesWithParams:(MTRSubscribeParams *)params @@ -26064,6 +26064,15 @@ typedef NS_OPTIONS(uint8_t, MTRTestClusterSimpleBitmap) { reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_DEPRECATED("Please use subscribeAttributeACCoilTemperatureWithParams:subscriptionEstablished:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); + (void)readAttributeACCoilTemperatureWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeACCoilTemperatureWithAttributeCache:endpoint:queue:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); +- (void)readAttributeACCapacityformatWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeACCapacityformatWithCompletion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completionHandler:(MTRStatusCompletion)completionHandler MTR_DEPRECATED("Please use writeAttributeACCapacityformatWithValue:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler MTR_DEPRECATED("Please use writeAttributeACCapacityformatWithValue:params:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); +- (void)subscribeAttributeACCapacityformatWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_DEPRECATED("Please use subscribeAttributeACCapacityformatWithParams:subscriptionEstablished:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); ++ (void)readAttributeACCapacityformatWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeACCapacityformatWithAttributeCache:endpoint:queue:completion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); + - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler MTR_DEPRECATED("Please use readAttributeGeneratedCommandListWithCompletion:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); - (void)subscribeAttributeGeneratedCommandListWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(MTRSubscribeParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 52333fd4fad3ef..ca2b47d0c5562b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -70393,9 +70393,9 @@ + (void)readAttributeACCoilTemperatureWithClusterStateCache:(MTRClusterStateCach completion:completion]; } -- (void)readAttributeACCapacityFormatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +- (void)readAttributeACCapacityformatWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; [self.device _readKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -70404,11 +70404,11 @@ - (void)readAttributeACCapacityFormatWithCompletion:(void (^)(NSNumber * _Nullab completion:completion]; } -- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion { - [self writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; + [self writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; } -- (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion { // Make a copy of params before we go async. params = [params copy]; @@ -70423,7 +70423,7 @@ - (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value param } ListFreer listFreer; - using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; TypeInfo::Type cppValue; cppValue = static_cast>(value.unsignedCharValue); @@ -70432,11 +70432,11 @@ - (void)writeAttributeACCapacityFormatWithValue:(NSNumber * _Nonnull)value param std::move(*bridge).DispatchAction(self.device); } -- (void)subscribeAttributeACCapacityFormatWithParams:(MTRSubscribeParams * _Nonnull)params +- (void)subscribeAttributeACCapacityformatWithParams:(MTRSubscribeParams * _Nonnull)params subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID clusterID:@(TypeInfo::GetClusterId()) attributeID:@(TypeInfo::GetAttributeId()) @@ -70446,9 +70446,9 @@ - (void)subscribeAttributeACCapacityFormatWithParams:(MTRSubscribeParams * _Nonn subscriptionEstablished:subscriptionEstablished]; } -+ (void)readAttributeACCapacityFormatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion ++ (void)readAttributeACCapacityformatWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { - using TypeInfo = Thermostat::Attributes::ACCapacityFormat::TypeInfo; + using TypeInfo = Thermostat::Attributes::ACCapacityformat::TypeInfo; [clusterStateCacheContainer _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) clusterID:TypeInfo::GetClusterId() @@ -73175,6 +73175,49 @@ + (void)readAttributeACCoilTemperatureWithAttributeCache:(MTRAttributeCacheConta }]; } +- (void)readAttributeACCapacityformatWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeACCapacityformatWithCompletion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value completionHandler:(MTRStatusCompletion)completionHandler +{ + [self writeAttributeACCapacityformatWithValue:value params:nil completion:completionHandler]; +} +- (void)writeAttributeACCapacityformatWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler +{ + [self writeAttributeACCapacityformatWithValue:value params:params completion:completionHandler]; +} +- (void)subscribeAttributeACCapacityformatWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval + params:(MTRSubscribeParams * _Nullable)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + MTRSubscribeParams * _Nullable subscribeParams = [params copy]; + if (subscribeParams == nil) { + subscribeParams = [[MTRSubscribeParams alloc] initWithMinInterval:minInterval maxInterval:maxInterval]; + } else { + subscribeParams.minInterval = minInterval; + subscribeParams.maxInterval = maxInterval; + } + [self subscribeAttributeACCapacityformatWithParams:subscribeParams subscriptionEstablished:subscriptionEstablishedHandler reportHandler: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + reportHandler(static_cast(value), error); + }]; +} ++ (void)readAttributeACCapacityformatWithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + [self readAttributeACCapacityformatWithClusterStateCache:attributeCacheContainer.realContainer endpoint:endpoint queue:queue completion: + ^(NSNumber * _Nullable value, NSError * _Nullable error) { + // Cast is safe because subclass does not add any selectors. + completionHandler(static_cast(value), error); + }]; +} + - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler { [self readAttributeGeneratedCommandListWithCompletion: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index b0f7fdf25cad65..16d74df3e0756f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -3407,6 +3407,9 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRClusterThermostatAttributeACCoilTemperatureID MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterThermostatAttributeACCoilTemperatureID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000046, + MTRClusterThermostatAttributeACCapacityformatID + MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) + = 0x00000047, MTRClusterThermostatAttributeGeneratedCommandListID MTR_DEPRECATED("Please use MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = MTRClusterGlobalAttributeGeneratedCommandListID, @@ -3472,7 +3475,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterThermostatAttributeACErrorCodeID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000044, MTRAttributeIDTypeClusterThermostatAttributeACLouverPositionID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000045, MTRAttributeIDTypeClusterThermostatAttributeACCoilTemperatureID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000046, - MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID MTR_PROVISIONALLY_AVAILABLE = 0x00000047, + MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000047, MTRAttributeIDTypeClusterThermostatAttributePresetTypesID MTR_PROVISIONALLY_AVAILABLE = 0x00000048, MTRAttributeIDTypeClusterThermostatAttributeScheduleTypesID MTR_PROVISIONALLY_AVAILABLE = 0x00000049, MTRAttributeIDTypeClusterThermostatAttributeNumberOfPresetsID MTR_PROVISIONALLY_AVAILABLE = 0x0000004A, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 464548edc35b7a..3dc8d24df64cfd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -5721,8 +5721,8 @@ result = @"ACCoilTemperature"; break; - case MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID: - result = @"ACCapacityFormat"; + case MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID: + result = @"ACCapacityformat"; break; case MTRAttributeIDTypeClusterThermostatAttributePresetTypesID: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 1b4ca5539c5cd1..cc61d5762fb4f4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -4796,9 +4796,9 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (NSDictionary * _Nullable)readAttributeACCoilTemperatureWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); -- (NSDictionary * _Nullable)readAttributeACCapacityFormatWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; -- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeACCapacityformatWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); - (NSDictionary * _Nullable)readAttributePresetTypesWithParams:(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 29d50f73d04b7c..ba3ddfc6da8f38 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -13795,20 +13795,20 @@ - (void)writeAttributeACLouverPositionWithValue:(NSDictionary *) return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCoilTemperatureID) params:params]; } -- (NSDictionary * _Nullable)readAttributeACCapacityFormatWithParams:(MTRReadParams * _Nullable)params +- (NSDictionary * _Nullable)readAttributeACCapacityformatWithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID) params:params]; + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID) params:params]; } -- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs { - [self writeAttributeACCapacityFormatWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; + [self writeAttributeACCapacityformatWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; } -- (void)writeAttributeACCapacityFormatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +- (void)writeAttributeACCapacityformatWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params { NSNumber * timedWriteTimeout = params.timedWriteTimeout; - [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityFormatID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeThermostatID) attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } - (NSDictionary * _Nullable)readAttributePresetTypesWithParams:(MTRReadParams * _Nullable)params 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 a0b3629d16b0e3..7a81f296f9d926 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 @@ -25722,7 +25722,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a } // namespace ACCoilTemperature -namespace ACCapacityFormat { +namespace ACCapacityformat { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum * value) { @@ -25767,7 +25767,7 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Cl return emberAfWriteAttribute(endpoint, Clusters::Thermostat::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); } -} // namespace ACCapacityFormat +} // namespace ACCapacityformat namespace NumberOfPresets { 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 57a98d6f0bbe7e..d52d593369f80a 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 @@ -4034,13 +4034,13 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, const chip::a MarkAttributeDirty markDirty); } // namespace ACCoilTemperature -namespace ACCapacityFormat { +namespace ACCapacityformat { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum * value); // ACCapacityFormatEnum Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Thermostat::ACCapacityFormatEnum value, MarkAttributeDirty markDirty); -} // namespace ACCapacityFormat +} // namespace ACCapacityformat namespace NumberOfPresets { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint8_t * value); // int8u 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 69545df3ca5e4a..d28337a26c582b 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 @@ -21516,8 +21516,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, ACLouverPosition); case Attributes::ACCoilTemperature::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, ACCoilTemperature); - case Attributes::ACCapacityFormat::TypeInfo::GetAttributeId(): - return DataModel::Decode(reader, ACCapacityFormat); + case Attributes::ACCapacityformat::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, ACCapacityformat); case Attributes::PresetTypes::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, presetTypes); case Attributes::ScheduleTypes::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 a419025fa8bc23..05abe388afa297 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 @@ -30281,7 +30281,7 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace ACCoilTemperature -namespace ACCapacityFormat { +namespace ACCapacityformat { struct TypeInfo { using Type = chip::app::Clusters::Thermostat::ACCapacityFormatEnum; @@ -30289,10 +30289,10 @@ struct TypeInfo using DecodableArgType = chip::app::Clusters::Thermostat::ACCapacityFormatEnum; static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::ACCapacityFormat::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ACCapacityformat::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace ACCapacityFormat +} // namespace ACCapacityformat namespace PresetTypes { struct TypeInfo { @@ -30543,7 +30543,7 @@ struct TypeInfo Attributes::ACLouverPosition::TypeInfo::DecodableType ACLouverPosition = static_cast(0); Attributes::ACCoilTemperature::TypeInfo::DecodableType ACCoilTemperature; - Attributes::ACCapacityFormat::TypeInfo::DecodableType ACCapacityFormat = + Attributes::ACCapacityformat::TypeInfo::DecodableType ACCapacityformat = static_cast(0); Attributes::PresetTypes::TypeInfo::DecodableType presetTypes; Attributes::ScheduleTypes::TypeInfo::DecodableType scheduleTypes; 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 87b5f6a145a35f..30702c3e8c731b 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 @@ -5138,9 +5138,9 @@ namespace ACCoilTemperature { static constexpr AttributeId Id = 0x00000046; } // namespace ACCoilTemperature -namespace ACCapacityFormat { +namespace ACCapacityformat { static constexpr AttributeId Id = 0x00000047; -} // namespace ACCapacityFormat +} // namespace ACCapacityformat namespace PresetTypes { static constexpr AttributeId Id = 0x00000048; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index e794640c326731..4406fd4ea6f5bc 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -9483,7 +9483,7 @@ class ServiceAreaSkipCurrentLocation : public ClusterCommand | * ACErrorCode | 0x0044 | | * ACLouverPosition | 0x0045 | | * ACCoilTemperature | 0x0046 | -| * ACCapacityFormat | 0x0047 | +| * ACCapacityformat | 0x0047 | | * PresetTypes | 0x0048 | | * ScheduleTypes | 0x0049 | | * NumberOfPresets | 0x004A | @@ -22941,7 +22941,7 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "acerror-code", Attributes::ACErrorCode::Id, credsIssuerConfig), // make_unique(Id, "aclouver-position", Attributes::ACLouverPosition::Id, credsIssuerConfig), // make_unique(Id, "accoil-temperature", Attributes::ACCoilTemperature::Id, credsIssuerConfig), // - make_unique(Id, "accapacity-format", Attributes::ACCapacityFormat::Id, credsIssuerConfig), // + make_unique(Id, "accapacityformat", Attributes::ACCapacityformat::Id, credsIssuerConfig), // make_unique(Id, "preset-types", Attributes::PresetTypes::Id, credsIssuerConfig), // make_unique(Id, "schedule-types", Attributes::ScheduleTypes::Id, credsIssuerConfig), // make_unique(Id, "number-of-presets", Attributes::NumberOfPresets::Id, credsIssuerConfig), // @@ -23092,8 +23092,7 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c Attributes::ACCoilTemperature::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>( - Id, "accapacity-format", 0, UINT8_MAX, Attributes::ACCapacityFormat::Id, WriteCommandType::kWrite, - credsIssuerConfig), // + Id, "accapacityformat", 0, UINT8_MAX, Attributes::ACCapacityformat::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( Id, "preset-types", Attributes::PresetTypes::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -23204,7 +23203,7 @@ void registerClusterThermostat(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "acerror-code", Attributes::ACErrorCode::Id, credsIssuerConfig), // make_unique(Id, "aclouver-position", Attributes::ACLouverPosition::Id, credsIssuerConfig), // make_unique(Id, "accoil-temperature", Attributes::ACCoilTemperature::Id, credsIssuerConfig), // - make_unique(Id, "accapacity-format", Attributes::ACCapacityFormat::Id, credsIssuerConfig), // + make_unique(Id, "accapacityformat", Attributes::ACCapacityformat::Id, credsIssuerConfig), // make_unique(Id, "preset-types", Attributes::PresetTypes::Id, credsIssuerConfig), // make_unique(Id, "schedule-types", Attributes::ScheduleTypes::Id, credsIssuerConfig), // make_unique(Id, "number-of-presets", Attributes::NumberOfPresets::Id, credsIssuerConfig), // 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 570e9b7b9b81a3..8ea51c97fa2289 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -14956,10 +14956,10 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ACCoilTemperature", 1, value); } - case Thermostat::Attributes::ACCapacityFormat::Id: { + case Thermostat::Attributes::ACCapacityformat::Id: { chip::app::Clusters::Thermostat::ACCapacityFormatEnum value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("ACCapacityFormat", 1, value); + return DataModelLogger::LogValue("ACCapacityformat", 1, value); } case Thermostat::Attributes::PresetTypes::Id: { chip::app::DataModel::DecodableList 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 aad2d4008452b1..1814916095d85d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -106921,7 +106921,7 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Subs | * ACErrorCode | 0x0044 | | * ACLouverPosition | 0x0045 | | * ACCoilTemperature | 0x0046 | -| * ACCapacityFormat | 0x0047 | +| * ACCapacityformat | 0x0047 | | * PresetTypes | 0x0048 | | * ScheduleTypes | 0x0049 | | * NumberOfPresets | 0x004A | @@ -112368,37 +112368,35 @@ class SubscribeAttributeThermostatACCoilTemperature : public SubscribeAttribute } }; -#if MTR_ENABLE_PROVISIONAL - /* - * Attribute ACCapacityFormat + * Attribute ACCapacityformat */ -class ReadThermostatACCapacityFormat : public ReadAttribute { +class ReadThermostatACCapacityformat : public ReadAttribute { public: - ReadThermostatACCapacityFormat() - : ReadAttribute("accapacity-format") + ReadThermostatACCapacityformat() + : ReadAttribute("accapacityformat") { } - ~ReadThermostatACCapacityFormat() + ~ReadThermostatACCapacityformat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityFormat::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::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 = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; - [cluster readAttributeACCapacityFormatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacityFormat response %@", [value description]); + [cluster readAttributeACCapacityformatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { - LogNSError("Thermostat ACCapacityFormat read Error", error); + LogNSError("Thermostat ACCapacityformat read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -112407,24 +112405,24 @@ class ReadThermostatACCapacityFormat : public ReadAttribute { } }; -class WriteThermostatACCapacityFormat : public WriteAttribute { +class WriteThermostatACCapacityformat : public WriteAttribute { public: - WriteThermostatACCapacityFormat() - : WriteAttribute("accapacity-format") + WriteThermostatACCapacityformat() + : WriteAttribute("accapacityformat") { - AddArgument("attr-name", "accapacity-format"); + AddArgument("attr-name", "accapacityformat"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } - ~WriteThermostatACCapacityFormat() + ~WriteThermostatACCapacityformat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityFormat::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); @@ -112434,9 +112432,9 @@ class WriteThermostatACCapacityFormat : public WriteAttribute { params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; - [cluster writeAttributeACCapacityFormatWithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster writeAttributeACCapacityformatWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("Thermostat ACCapacityFormat write Error", error); + LogNSError("Thermostat ACCapacityformat write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -112448,21 +112446,21 @@ class WriteThermostatACCapacityFormat : public WriteAttribute { uint8_t mValue; }; -class SubscribeAttributeThermostatACCapacityFormat : public SubscribeAttribute { +class SubscribeAttributeThermostatACCapacityformat : public SubscribeAttribute { public: - SubscribeAttributeThermostatACCapacityFormat() - : SubscribeAttribute("accapacity-format") + SubscribeAttributeThermostatACCapacityformat() + : SubscribeAttribute("accapacityformat") { } - ~SubscribeAttributeThermostatACCapacityFormat() + ~SubscribeAttributeThermostatACCapacityformat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityFormat::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::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); @@ -112477,10 +112475,10 @@ class SubscribeAttributeThermostatACCapacityFormat : public SubscribeAttribute { if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeACCapacityFormatWithParams:params + [cluster subscribeAttributeACCapacityformatWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"Thermostat.ACCapacityFormat response %@", [value description]); + NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -112493,7 +112491,6 @@ class SubscribeAttributeThermostatACCapacityFormat : public SubscribeAttribute { } }; -#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* @@ -194757,11 +194754,9 @@ void registerClusterThermostat(Commands & commands) make_unique(), // make_unique(), // make_unique(), // -#if MTR_ENABLE_PROVISIONAL - make_unique(), // - make_unique(), // - make_unique(), // -#endif // MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // From dabf994bae0b710c8a588d855fc1948928d59aaa Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 29 Jul 2024 13:53:58 -0400 Subject: [PATCH 18/63] Update Test_TC_TSTAT_1_1 to know about AtomicResponse command. --- src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml index b2bf2a111ebffd..17a84f799beeb9 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml @@ -600,7 +600,7 @@ tests: command: "readAttribute" attribute: "GeneratedCommandList" response: - value: [] + value: [0xFD] # AtomicResponse constraints: type: list From 90a20c126c01089ada2cf3c16018d1cdf13aae48 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Mon, 29 Jul 2024 14:27:05 -0400 Subject: [PATCH 19/63] Restyled patch --- src/app/clusters/thermostat-server/thermostat-server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 5e1cfb650e711c..cc696eb29d26a9 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1688,13 +1688,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { From aef165ef51b35be4f876d897b48b53639f33c3d1 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Mon, 29 Jul 2024 15:57:40 -0400 Subject: [PATCH 20/63] Fix weird merge with upstream --- examples/thermostat/linux/include/thermostat-delegate-impl.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h index 046f870d0520a3..99a710140ec619 100644 --- a/examples/thermostat/linux/include/thermostat-delegate-impl.h +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -52,10 +52,6 @@ class ThermostatDelegate : public Delegate void BeginPendingPresetList() override; - int GetPendingPresetCount() override; - - CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; - CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) override; CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) override; From 4c457a9ba89a06aeafa99757d1714b3221616840 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Mon, 29 Jul 2024 17:59:17 -0400 Subject: [PATCH 21/63] Fix emberAfIsTypeSigned not understanding temperature type --- .../thermostat-server/thermostat-server.cpp | 19 ++++++++++++++++--- src/app/util/attribute-table.cpp | 3 ++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index cc696eb29d26a9..bc5b8ebbf20182 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -732,9 +732,6 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A Delegate * delegate = GetDelegate(aPath.mEndpointId); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); - if (InAtomicWrite(aPath.mEndpointId)) - { - } return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { for (uint8_t i = 0; true; i++) { @@ -761,6 +758,22 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A Delegate * delegate = GetDelegate(aPath.mEndpointId); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); + if (InAtomicWrite(aPath.mEndpointId)) + { + return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { + for (uint8_t i = 0; true; i++) + { + PresetStructWithOwnedMembers preset; + auto err = delegate->GetPendingPresetAtIndex(i, preset); + if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) + { + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + ReturnErrorOnFailure(encoder.Encode(preset)); + } + }); + } return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { for (uint8_t i = 0; true; i++) { diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index 57b5f43d35071f..f016d22d78a85c 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -44,7 +44,8 @@ namespace { // Zigbee spec says types between signed 8 bit and signed 64 bit bool emberAfIsTypeSigned(EmberAfAttributeType dataType) { - return (dataType >= ZCL_INT8S_ATTRIBUTE_TYPE && dataType <= ZCL_INT64S_ATTRIBUTE_TYPE); + return (dataType >= ZCL_INT8S_ATTRIBUTE_TYPE && dataType <= ZCL_INT64S_ATTRIBUTE_TYPE) || + dataType == ZCL_TEMPERATURE_ATTRIBUTE_TYPE; } /** From c34a9cbbd7e62a4d308c391c30f4dfe469e25cbe Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Mon, 29 Jul 2024 20:36:27 -0400 Subject: [PATCH 22/63] Merge fixes from atomic write branch --- .../all-clusters-app.matter | 2 + .../all-clusters-common/all-clusters-app.zap | 78 ++++++------------- .../thermostat-common/thermostat.matter | 3 + .../thermostat-common/thermostat.zap | 36 ++++----- .../data-model/chip/thermostat-cluster.xml | 10 +-- 5 files changed, 51 insertions(+), 78 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 8af5ac6fd428f5..4e9d7c221e11f7 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 @@ -8695,6 +8695,8 @@ endpoint 1 { ram attribute clusterRevision default = 6; handle command SetpointRaiseLower; + handle command AtomicResponse; + handle command AtomicRequest; } server cluster FanControl { 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 9e0452b0c423fc..cc48d168f0f3dd 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 @@ -16172,6 +16172,22 @@ "source": "client", "isIncoming": 1, "isEnabled": 1 + }, + { + "name": "AtomicResponse", + "code": 253, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AtomicRequest", + "code": 254, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 } ], "attributes": [ @@ -16276,7 +16292,7 @@ "code": 17, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16292,7 +16308,7 @@ "code": 18, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16308,7 +16324,7 @@ "code": 21, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16324,7 +16340,7 @@ "code": 22, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16340,7 +16356,7 @@ "code": 23, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16356,7 +16372,7 @@ "code": 24, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16559,41 +16575,9 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "PresetsSchedulesEditable", - "code": 82, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "TemperatureSetpointHoldPolicy", - "code": 83, - "mfgCode": null, - "side": "server", - "type": "TemperatureSetpointHoldPolicyBitmap", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "SetpointHoldExpiryTimestamp", - "code": 84, + "code": 82, "mfgCode": null, "side": "server", "type": "epoch_s", @@ -16607,22 +16591,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "QueuedPreset", - "code": 85, - "mfgCode": null, - "side": "server", - "type": "QueuedPresetStruct", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "GeneratedCommandList", "code": 65528, diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 7c711787abf026..523de02e9985c2 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -2522,7 +2522,10 @@ endpoint 1 { ram attribute clusterRevision default = 6; handle command SetpointRaiseLower; + handle command SetActiveScheduleRequest; handle command SetActivePresetRequest; + handle command AtomicResponse; + handle command AtomicRequest; } server cluster ThermostatUserInterfaceConfiguration { diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 483b79d7d434f5..11e60b9e24d363 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -4661,32 +4661,32 @@ "isEnabled": 1 }, { - "name": "SetActivePresetRequest", - "code": 6, + "name": "SetActiveScheduleRequest", + "code": 5, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "StartPresetsSchedulesEditRequest", - "code": 7, + "name": "SetActivePresetRequest", + "code": 6, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "CancelPresetsSchedulesEditRequest", - "code": 8, + "name": "AtomicResponse", + "code": 253, "mfgCode": null, - "source": "client", - "isIncoming": 1, + "source": "server", + "isIncoming": 0, "isEnabled": 1 }, { - "name": "CommitPresetsSchedulesRequest", - "code": 9, + "name": "AtomicRequest", + "code": 254, "mfgCode": null, "source": "client", "isIncoming": 1, @@ -4779,7 +4779,7 @@ "code": 17, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "NVM", "singleton": 0, @@ -4795,7 +4795,7 @@ "code": 18, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "NVM", "singleton": 0, @@ -4811,7 +4811,7 @@ "code": 21, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -4827,7 +4827,7 @@ "code": 22, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -4843,7 +4843,7 @@ "code": 23, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -4859,7 +4859,7 @@ "code": 24, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -4983,11 +4983,11 @@ "reportableChange": 0 }, { - "name": "PresetsSchedulesEditable", + "name": "SetpointHoldExpiryTimestamp", "code": 82, "mfgCode": null, "side": "server", - "type": "boolean", + "type": "epoch_s", "included": 1, "storageOption": "RAM", "singleton": 0, diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index e8b8aa8c98755c..bb1b02838284a3 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -35,11 +35,6 @@ limitations under the License. - - - - - @@ -91,6 +86,11 @@ limitations under the License. + + + + + From 704c5447f57a6eca6a924d80ffd8b011dcafe19e Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 08:15:54 -0400 Subject: [PATCH 23/63] Relocate thermostat-manager sample code to all-clusters-common --- .../include/thermostat-delegate-impl.h | 0 .../include/thermostat-manager.h | 0 .../src}/thermostat-delegate-impl.cpp | 3 +-- .../src}/thermostat-manager.cpp | 8 +++++--- examples/all-clusters-app/linux/BUILD.gn | 2 ++ examples/all-clusters-app/tizen/BUILD.gn | 2 ++ examples/thermostat/linux/BUILD.gn | 5 ----- examples/thermostat/linux/main.cpp | 14 +------------- 8 files changed, 11 insertions(+), 23 deletions(-) rename examples/{thermostat/linux => all-clusters-app/all-clusters-common}/include/thermostat-delegate-impl.h (100%) rename examples/{thermostat/linux => all-clusters-app/all-clusters-common}/include/thermostat-manager.h (100%) rename examples/{thermostat/linux => all-clusters-app/all-clusters-common/src}/thermostat-delegate-impl.cpp (99%) rename examples/{thermostat/linux => all-clusters-app/all-clusters-common/src}/thermostat-manager.cpp (99%) diff --git a/examples/thermostat/linux/include/thermostat-delegate-impl.h b/examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h similarity index 100% rename from examples/thermostat/linux/include/thermostat-delegate-impl.h rename to examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h diff --git a/examples/thermostat/linux/include/thermostat-manager.h b/examples/all-clusters-app/all-clusters-common/include/thermostat-manager.h similarity index 100% rename from examples/thermostat/linux/include/thermostat-manager.h rename to examples/all-clusters-app/all-clusters-common/include/thermostat-manager.h diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp similarity index 99% rename from examples/thermostat/linux/thermostat-delegate-impl.cpp rename to examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp index 211ebb2bdf1e01..863af064152daf 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp @@ -16,9 +16,8 @@ * limitations under the License. */ -#include "include/thermostat-delegate-impl.h" +#include -#include "thermostat-delegate-impl.h" #include #include #include diff --git a/examples/thermostat/linux/thermostat-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp similarity index 99% rename from examples/thermostat/linux/thermostat-manager.cpp rename to examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp index 00266161007d59..fd507ef972fc54 100644 --- a/examples/thermostat/linux/thermostat-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp @@ -20,8 +20,8 @@ * Includes *********************************************************/ -#include "include/thermostat-manager.h" -#include "include/thermostat-delegate-impl.h" +#include +#include #include #include @@ -506,9 +506,11 @@ void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePa void emberAfThermostatClusterInitCallback(EndpointId endpoint) { + ChipLogProgress(Zcl, "Starting Thermostat Manager"); + ThermostatManager().Init(); + // Register the delegate for the Thermostat auto & delegate = ThermostatDelegate::GetInstance(); - // Set the default delegate for endpoint kThermostatEndpoint. VerifyOrDie(endpoint == kThermostatEndpoint); SetDefaultDelegate(endpoint, &delegate); diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 0bf2e1445028b6..c6b620964b13a3 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -61,6 +61,8 @@ 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/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/water-heater-mode.cpp", "${chip_root}/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 855416c0446923..8334ee9abea5ec 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -38,6 +38,8 @@ source_set("chip-all-clusters-common") { "${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/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.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", diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index 71c0eccfcfae50..ca300430d8626f 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -20,18 +20,13 @@ executable("thermostat-app") { "include/low-power/LowPowerManager.cpp", "include/low-power/LowPowerManager.h", "main.cpp", - "thermostat-delegate-impl.cpp", - "thermostat-manager.cpp", ] deps = [ "${chip_root}/examples/platform/linux:app-main", - "${chip_root}/examples/thermostat/thermostat-common", "${chip_root}/src/lib", ] - include_dirs = [ "include" ] - cflags = [ "-Wconversion" ] output_dir = root_out_dir diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp index 2279f02bef3963..1322d7ebe5b33e 100644 --- a/examples/thermostat/linux/main.cpp +++ b/examples/thermostat/linux/main.cpp @@ -76,19 +76,7 @@ void ApplicationShutdown() {} int main(int argc, char * argv[]) { - if (ChipLinuxAppInit(argc, argv) != 0) - { - return -1; - } - ChipLogProgress(Zcl, "Starting Thermostat Manager"); - CHIP_ERROR err = ThermostatManager().Init(); - - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "Failed to initialize thermostat manager: %" CHIP_ERROR_FORMAT, err.Format()); - chip::DeviceLayer::PlatformMgr().Shutdown(); - return -1; - } + VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); ChipLinuxAppMainLoop(); return 0; } From d67f988de412f1243a26089b0204be08d8ff8b05 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 08:33:09 -0400 Subject: [PATCH 24/63] Fix g++ build error on linux --- .../all-clusters-common/src/thermostat-delegate-impl.cpp | 4 ++-- .../all-clusters-common/src/thermostat-manager.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp index 863af064152daf..fe4b72b9e40931 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp @@ -96,10 +96,10 @@ void ThermostatDelegate::InitializePresets() const uint8_t handle[] = { static_cast(presetScenario) }; mPresets[index].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); mPresets[index].SetName(NullOptional); - int16_t coolingSetpointValue = 2500 + index * 100; + int16_t coolingSetpointValue = 2500 + (int16_t) index * 100; mPresets[index].SetCoolingSetpoint(MakeOptional(coolingSetpointValue)); - int16_t heatingSetpointValue = 2100 - index * 100; + int16_t heatingSetpointValue = 2100 - (int16_t) index * 100; mPresets[index].SetHeatingSetpoint(MakeOptional(heatingSetpointValue)); mPresets[index].SetBuiltIn(DataModel::MakeNullable(true)); index++; diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp index fd507ef972fc54..f7aa1c2e4f3e80 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp @@ -398,8 +398,8 @@ void ThermostatManager::EvalThermostatState() void ThermostatManager::UpdateRunningModeForHeating() { - const int16_t heatingOnThreshold = mOccupiedHeatingSetpoint - mOccupiedSetback * 10; - const int16_t heatingOffThreshold = mOccupiedHeatingSetpoint + mOccupiedSetback * 10; + const int16_t heatingOnThreshold = mOccupiedHeatingSetpoint - (int16_t) mOccupiedSetback * 10; + const int16_t heatingOffThreshold = mOccupiedHeatingSetpoint + (int16_t) mOccupiedSetback * 10; if (mRunningMode == ThermostatRunningModeEnum::kHeat) { @@ -429,8 +429,8 @@ void ThermostatManager::UpdateRunningModeForHeating() void ThermostatManager::UpdateRunningModeForCooling() { - const int16_t coolingOffThreshold = mOccupiedCoolingSetpoint - mOccupiedSetback * 10; - const int16_t coolingOnThreshold = mOccupiedCoolingSetpoint + mOccupiedSetback * 10; + const int16_t coolingOffThreshold = mOccupiedCoolingSetpoint - (int16_t) mOccupiedSetback * 10; + const int16_t coolingOnThreshold = mOccupiedCoolingSetpoint + (int16_t) mOccupiedSetback * 10; if (mRunningMode == ThermostatRunningModeEnum::kCool) { From 4c8e0a0b05dc7045502020897734da33fea747d7 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 09:15:49 -0400 Subject: [PATCH 25/63] Fix C formatter for long int, cast whole expression --- .../all-clusters-common/src/thermostat-delegate-impl.cpp | 4 ++-- .../all-clusters-common/src/thermostat-manager.cpp | 6 +++--- examples/thermostat/linux/main.cpp | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp index fe4b72b9e40931..67dfccfc614304 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp @@ -96,10 +96,10 @@ void ThermostatDelegate::InitializePresets() const uint8_t handle[] = { static_cast(presetScenario) }; mPresets[index].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); mPresets[index].SetName(NullOptional); - int16_t coolingSetpointValue = 2500 + (int16_t) index * 100; + int16_t coolingSetpointValue = (int16_t) (2500 + (index * 100)); mPresets[index].SetCoolingSetpoint(MakeOptional(coolingSetpointValue)); - int16_t heatingSetpointValue = 2100 - (int16_t) index * 100; + int16_t heatingSetpointValue = (int16_t) (2100 - (index * 100)); mPresets[index].SetHeatingSetpoint(MakeOptional(heatingSetpointValue)); mPresets[index].SetBuiltIn(DataModel::MakeNullable(true)); index++; diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp index f7aa1c2e4f3e80..a4dd9f2cce06d5 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp @@ -274,7 +274,7 @@ void ThermostatManager::ThermostatClusterAttributeChangeHandler(AttributeId attr break; default: { - ChipLogError(AppServer, "Unhandled thermostat attribute %x", attributeId); + ChipLogError(AppServer, "Unhandled thermostat attribute %lx", attributeId); return; } break; @@ -398,8 +398,8 @@ void ThermostatManager::EvalThermostatState() void ThermostatManager::UpdateRunningModeForHeating() { - const int16_t heatingOnThreshold = mOccupiedHeatingSetpoint - (int16_t) mOccupiedSetback * 10; - const int16_t heatingOffThreshold = mOccupiedHeatingSetpoint + (int16_t) mOccupiedSetback * 10; + const int16_t heatingOnThreshold = (int16_t) (mOccupiedHeatingSetpoint - mOccupiedSetback * 10); + const int16_t heatingOffThreshold = (int16_t) (mOccupiedHeatingSetpoint + mOccupiedSetback * 10); if (mRunningMode == ThermostatRunningModeEnum::kHeat) { diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp index 1322d7ebe5b33e..b9f82696e8ce79 100644 --- a/examples/thermostat/linux/main.cpp +++ b/examples/thermostat/linux/main.cpp @@ -22,8 +22,6 @@ #include #include -#include "thermostat-manager.h" - using namespace chip; using namespace chip::app; // using namespace chip::app::Clusters; From cf780e30d98408409df39812bf5bbf0c41270b55 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 09:56:41 -0400 Subject: [PATCH 26/63] Sync cast fix with master --- .../all-clusters-common/src/thermostat-delegate-impl.cpp | 4 ++-- .../all-clusters-common/src/thermostat-manager.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp index 67dfccfc614304..d9adea37fcc5e0 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp @@ -96,10 +96,10 @@ void ThermostatDelegate::InitializePresets() const uint8_t handle[] = { static_cast(presetScenario) }; mPresets[index].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); mPresets[index].SetName(NullOptional); - int16_t coolingSetpointValue = (int16_t) (2500 + (index * 100)); + int16_t coolingSetpointValue = static_cast(2500 + (index * 100)); mPresets[index].SetCoolingSetpoint(MakeOptional(coolingSetpointValue)); - int16_t heatingSetpointValue = (int16_t) (2100 - (index * 100)); + int16_t heatingSetpointValue = static_cast(2100 - (index * 100)); mPresets[index].SetHeatingSetpoint(MakeOptional(heatingSetpointValue)); mPresets[index].SetBuiltIn(DataModel::MakeNullable(true)); index++; diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp index a4dd9f2cce06d5..4651efdd7bb9b4 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp @@ -274,7 +274,7 @@ void ThermostatManager::ThermostatClusterAttributeChangeHandler(AttributeId attr break; default: { - ChipLogError(AppServer, "Unhandled thermostat attribute %lx", attributeId); + ChipLogError(AppServer, "Unhandled thermostat attribute %u", static_cast(attributeId)); return; } break; @@ -398,8 +398,8 @@ void ThermostatManager::EvalThermostatState() void ThermostatManager::UpdateRunningModeForHeating() { - const int16_t heatingOnThreshold = (int16_t) (mOccupiedHeatingSetpoint - mOccupiedSetback * 10); - const int16_t heatingOffThreshold = (int16_t) (mOccupiedHeatingSetpoint + mOccupiedSetback * 10); + const int16_t heatingOnThreshold = mOccupiedHeatingSetpoint - static_cast(mOccupiedSetback * 10); + const int16_t heatingOffThreshold = mOccupiedHeatingSetpoint + static_cast(mOccupiedSetback * 10); if (mRunningMode == ThermostatRunningModeEnum::kHeat) { From b4f50f6ada0d44421633dea59740f06c295da112 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 11:16:27 -0400 Subject: [PATCH 27/63] Add thermostat-common dependency to thermostat app under linux --- examples/thermostat/linux/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index ca300430d8626f..89d24bff8a0835 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -24,6 +24,7 @@ executable("thermostat-app") { deps = [ "${chip_root}/examples/platform/linux:app-main", + "${chip_root}/examples/thermostat/thermostat-common", "${chip_root}/src/lib", ] From 637db40bbafe9475e7926169314339b4125fe12b Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 12:14:35 -0400 Subject: [PATCH 28/63] Remove MatterPostAttributeChangeCallback from thermostat-manager, as it conflicts with other implementations --- .../include/thermostat-delegate-impl.h | 3 ++ .../src/thermostat-delegate-impl.cpp | 13 +++++++ .../src/thermostat-manager.cpp | 14 ------- .../thermostat-server/thermostat-delegate.h | 13 +++++++ .../thermostat-server/thermostat-server.cpp | 37 +++++++++++-------- 5 files changed, 50 insertions(+), 30 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h b/examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h index 99a710140ec619..f4b8ac8565cf2c 100644 --- a/examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h +++ b/examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h @@ -64,6 +64,9 @@ class ThermostatDelegate : public Delegate void ClearPendingPresetList() override; + void AttributeChanged(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint16_t size) override; + private: static ThermostatDelegate sInstance; diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp index d9adea37fcc5e0..c9c963a32fe998 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp @@ -17,6 +17,7 @@ */ #include +#include #include #include @@ -252,3 +253,15 @@ void ThermostatDelegate::ClearPendingPresetList() { mNextFreeIndexInPendingPresetsList = 0; } + +void ThermostatDelegate::AttributeChanged(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint16_t size) +{ + ChipLogProgress(AppServer, "ThermostatDelegate AttributeChanged callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + + ChipLogProgress(AppServer, + "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: " ChipLogFormatMEI " Value: %u, length %u", + ChipLogValueMEI(attributeId), endpointId, ChipLogValueMEI(clusterId), *value, size); + + ThermostatManager().AttributeChangeHandler(endpointId, clusterId, attributeId, value, size); +} diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp index b63244358c306a..90d4588a131ca6 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp @@ -490,20 +490,6 @@ static const char * RunningModeString(ThermostatRunningModeEnum runningMode) } } -void MatterPostAttributeChangeCallback(const ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) -{ - ClusterId clusterId = attributePath.mClusterId; - AttributeId attributeId = attributePath.mAttributeId; - ChipLogProgress(AppServer, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - - ChipLogProgress(AppServer, - "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: " ChipLogFormatMEI - " Type: %u Value: %u, length %u", - ChipLogValueMEI(attributeId), attributePath.mEndpointId, ChipLogValueMEI(clusterId), type, *value, size); - - ThermostatMgr().AttributeChangeHandler(attributePath.mEndpointId, clusterId, attributeId, value, size); -} - void emberAfThermostatClusterInitCallback(EndpointId endpoint) { ChipLogProgress(Zcl, "Starting Thermostat Manager"); diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h index 2f70ec615f178a..d649a7f31ec3aa 100644 --- a/src/app/clusters/thermostat-server/thermostat-delegate.h +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -127,6 +127,19 @@ class Delegate * */ virtual void ClearPendingPresetList() = 0; + + /** + * @brief Informs of a change in a non-atomic thermostat attribute + * + * @param[in] endpointId The endpoint for the thermostat cluster. + * @param[in] clusterId The ID of the cluster. + * @param[in] attributeId The ID of the attribute being updated. + * @param[in] value The new value of the attribute. + * @param[in] size The size of the new value of the attribute. + * + */ + virtual void AttributeChanged(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, + uint16_t size) = 0; }; } // namespace Thermostat diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index bc5b8ebbf20182..2a6c8d804eebed 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1079,7 +1079,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > OccupiedCoolingSetpoint - DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case OccupiedCoolingSetpoint::Id: { @@ -1094,7 +1094,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < OccupiedHeatingSetpoint + DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case UnoccupiedHeatingSetpoint::Id: { @@ -1109,7 +1109,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > UnoccupiedCoolingSetpoint - DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case UnoccupiedCoolingSetpoint::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1123,7 +1123,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < UnoccupiedHeatingSetpoint + DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case MinHeatSetpointLimit::Id: { @@ -1137,7 +1137,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > MinCoolSetpointLimit - DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case MaxHeatSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1150,7 +1150,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > MaxCoolSetpointLimit - DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case MinCoolSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1163,7 +1163,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < MinHeatSetpointLimit + DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case MaxCoolSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1176,7 +1176,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < MaxHeatSetpointLimit + DeadBandTemp) return imcode::InvalidValue; } - return imcode::Success; + break; } case MinSetpointDeadBand::Id: { requested = *value; @@ -1184,7 +1184,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr return imcode::UnsupportedAttribute; if (requested < 0 || requested > 25) return imcode::InvalidValue; - return imcode::Success; + break; } case ControlSequenceOfOperation::Id: { @@ -1192,7 +1192,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr requestedCSO = *value; if (requestedCSO > to_underlying(ControlSequenceOfOperationEnum::kCoolingAndHeatingWithReheat)) return imcode::InvalidValue; - return imcode::Success; + break; } case SystemMode::Id: { @@ -1215,22 +1215,27 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr case ControlSequenceOfOperationEnum::kCoolingWithReheat: if (RequestedSystemMode == SystemModeEnum::kHeat || RequestedSystemMode == SystemModeEnum::kEmergencyHeat) return imcode::InvalidValue; - else - return imcode::Success; + break; case ControlSequenceOfOperationEnum::kHeatingOnly: case ControlSequenceOfOperationEnum::kHeatingWithReheat: if (RequestedSystemMode == SystemModeEnum::kCool || RequestedSystemMode == SystemModeEnum::kPrecooling) return imcode::InvalidValue; - else - return imcode::Success; + break; default: - return imcode::Success; + break; } + break; } default: - return imcode::Success; + break; + } + Delegate * delegate = GetDelegate(endpoint); + if (delegate != nullptr) + { + delegate->AttributeChanged(attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId, value, size); } + return imcode::Success; } bool emberAfThermostatClusterClearWeeklyScheduleCallback(app::CommandHandler * commandObj, From 0c1b853acc59563e9c356350cdea2547ad17529e Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 13:23:38 -0400 Subject: [PATCH 29/63] Convert Atomic enums and structs to global --- .vscode/settings.json | 4 +- .../air-purifier-app.matter | 22 ++-- .../air-quality-sensor-app.matter | 11 ++ .../all-clusters-app.matter | 22 ++-- .../all-clusters-minimal-app.matter | 22 ++-- .../bridge-common/bridge-app.matter | 11 ++ ...p_rootnode_dimmablelight_bCwGYSDpoe.matter | 11 ++ .../rootnode_airpurifier_73a6fe2651.matter | 11 ++ ...umiditysensor_thermostat_56de3d5f45.matter | 22 ++-- ...ootnode_airqualitysensor_e63187f6c9.matter | 11 ++ ...ootnode_basicvideoplayer_0ff86e943b.matter | 11 ++ ...de_colortemperaturelight_hbUnzYVeyn.matter | 11 ++ .../rootnode_contactsensor_27f76aeaf5.matter | 11 ++ .../rootnode_contactsensor_lFAGG1bfRO.matter | 11 ++ .../rootnode_dimmablelight_bCwGYSDpoe.matter | 11 ++ ...tnode_dimmablepluginunit_f8a9a0b9d4.matter | 11 ++ .../rootnode_dishwasher_cc105034fe.matter | 11 ++ .../rootnode_doorlock_aNKYAreMXE.matter | 11 ++ ...tnode_extendedcolorlight_8lcaaYJVAa.matter | 11 ++ .../devices/rootnode_fan_7N2TobIlOX.matter | 11 ++ .../rootnode_flowsensor_1zVxHedlaV.matter | 11 ++ .../rootnode_genericswitch_2dfff6e516.matter | 11 ++ .../rootnode_genericswitch_9866e35d0b.matter | 11 ++ ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 22 ++-- .../rootnode_humiditysensor_Xyj4gda6Hb.matter | 11 ++ .../rootnode_laundrywasher_fb10d238c8.matter | 11 ++ .../rootnode_lightsensor_lZQycTFcJK.matter | 11 ++ ...rootnode_occupancysensor_iHyVgifZuo.matter | 11 ++ .../rootnode_onofflight_bbs1b7IaOV.matter | 11 ++ .../rootnode_onofflight_samplemei.matter | 11 ++ ...ootnode_onofflightswitch_FsPlMr090Q.matter | 11 ++ ...rootnode_onoffpluginunit_Wtf8ss5EBY.matter | 11 ++ .../rootnode_pressuresensor_s0qC9wLH4k.matter | 11 ++ .../devices/rootnode_pump_5f904818cc.matter | 11 ++ .../devices/rootnode_pump_a811bb33a0.matter | 11 ++ ...eraturecontrolledcabinet_ffdb696680.matter | 11 ++ ...ode_roboticvacuumcleaner_1807ff0c49.matter | 11 ++ ...tnode_roomairconditioner_9cf3607804.matter | 22 ++-- .../rootnode_smokecoalarm_686fe0dcb8.matter | 11 ++ .../rootnode_speaker_RpzeXdimqA.matter | 11 ++ ...otnode_temperaturesensor_Qy1zkNW7c3.matter | 11 ++ .../rootnode_thermostat_bm3fb8dhYi.matter | 22 ++-- .../rootnode_windowcovering_RLCxaGi9Yx.matter | 11 ++ .../contact-sensor-app.matter | 11 ++ .../nxp/zap-lit/contact-sensor-app.matter | 11 ++ .../nxp/zap-sit/contact-sensor-app.matter | 11 ++ .../dishwasher-common/dishwasher-app.matter | 11 ++ .../energy-management-app.matter | 11 ++ .../fabric-bridge-app.matter | 11 ++ .../nxp/zap/laundry-washer-app.matter | 11 ++ .../light-switch-app.matter | 11 ++ .../light-switch-app/qpg/zap/switch.matter | 11 ++ .../data_model/lighting-app-ethernet.matter | 11 ++ .../data_model/lighting-app-thread.matter | 11 ++ .../data_model/lighting-app-wifi.matter | 11 ++ .../lighting-common/lighting-app.matter | 11 ++ .../nxp/zap/lighting-on-off.matter | 11 ++ examples/lighting-app/qpg/zap/light.matter | 11 ++ .../data_model/lighting-thread-app.matter | 11 ++ .../data_model/lighting-wifi-app.matter | 11 ++ .../lit-icd-common/lit-icd-server-app.matter | 11 ++ examples/lock-app/lock-common/lock-app.matter | 11 ++ examples/lock-app/nxp/zap/lock-app.matter | 11 ++ examples/lock-app/qpg/zap/lock.matter | 11 ++ .../log-source-common/log-source-app.matter | 11 ++ .../microwave-oven-app.matter | 11 ++ .../network-manager-app.matter | 11 ++ .../ota-provider-app.matter | 11 ++ .../ota-requestor-app.matter | 11 ++ .../placeholder/linux/apps/app1/config.matter | 33 ++--- .../placeholder/linux/apps/app2/config.matter | 33 ++--- examples/pump-app/pump-common/pump-app.matter | 11 ++ .../silabs/data_model/pump-thread-app.matter | 11 ++ .../silabs/data_model/pump-wifi-app.matter | 11 ++ .../pump-controller-app.matter | 11 ++ .../refrigerator-app.matter | 11 ++ examples/rvc-app/rvc-common/rvc-app.matter | 11 ++ .../smoke-co-alarm-app.matter | 11 ++ .../temperature-measurement.matter | 11 ++ .../nxp/zap/thermostat_matter_thread.matter | 22 ++-- .../nxp/zap/thermostat_matter_wifi.matter | 22 ++-- .../qpg/zap/thermostaticRadiatorValve.matter | 22 ++-- .../thermostat-common/thermostat.matter | 22 ++-- examples/tv-app/tv-common/tv-app.matter | 11 ++ .../tv-casting-common/tv-casting-app.matter | 11 ++ .../virtual-device-app.matter | 11 ++ examples/window-app/common/window-app.matter | 11 ++ .../thermostat-server/thermostat-server.cpp | 16 +-- .../zcl/data-model/chip/global-enums.xml | 1 - .../zcl/data-model/chip/global-structs.xml | 1 - .../data_model/controller-clusters.matter | 22 ++-- .../chip/devicecontroller/ChipStructs.java | 122 +++++++++--------- .../python/chip/clusters/Objects.py | 54 ++++---- .../CHIP/zap-generated/MTRBaseClusters.h | 12 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 4 +- .../CHIP/zap-generated/MTRStructsObjc.h | 12 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 60 ++++----- .../zap-generated/cluster-enums-check.h | 27 ++-- .../app-common/zap-generated/cluster-enums.h | 26 ++-- .../zap-generated/cluster-objects.cpp | 82 ++++++------ .../zap-generated/cluster-objects.h | 55 ++++---- .../cluster/ComplexArgumentParser.cpp | 64 ++++----- .../cluster/ComplexArgumentParser.h | 10 +- .../cluster/logging/DataModelLogger.cpp | 52 ++++---- .../cluster/logging/DataModelLogger.h | 6 +- 105 files changed, 1262 insertions(+), 479 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a8b3dd631afe4f..33bdd5e9f63d6f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -134,7 +134,9 @@ "thread": "cpp", "variant": "cpp", "any": "cpp", - "future": "cpp" + "future": "cpp", + "list": "cpp", + "unordered_set": "cpp" }, // Configure paths or glob patterns to exclude from file watching. "files.watcherExclude": { diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index 54c3f0f8894711..d6cae3019c1718 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1332,12 +1343,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1501,11 +1506,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter index c7395570fccff4..4fa1913d0fbe87 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; 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 509f456068e2c4..2d8d9ca5926dee 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 @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -5169,12 +5180,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -5338,11 +5343,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 3d791c54412a67..b42ffc6ca8bcd9 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -3606,12 +3617,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -3775,11 +3780,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index f35fd082eb9900..f0eaff5f0ef634 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter index ed03c1ca8ca637..73b64e2a94b197 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter index ae8cdd66b8dd1b..7ec650474be65e 100644 --- a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter +++ b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index d58d6b8ab64243..183ad09c4d1a64 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1255,12 +1266,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1424,11 +1429,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter index 7f86f3a66008b6..31810f8dc8c04e 100644 --- a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter +++ b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter index f65d5fc5ad8555..456d933f7100c7 100644 --- a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter +++ b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index 6f7714fcbbf102..aa08895b3c1683 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter index 57718ed32895da..65b3f481b1344d 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter index 93df8c3e2c0b33..437958db33eae4 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter index 9dd5331063e27b..4e971f8397b1b3 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter index 90b81ab8df5b44..94aecfb3e8b85e 100644 --- a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter +++ b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter index 67684011eff2b4..4c2e93e5ccc5d6 100644 --- a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter +++ b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter index ae0d89f00a685f..25e82d27ab3cca 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter index 32244ab3a10758..224d867cb0a02d 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter index 3b0a153455d728..b43d0ac32a3911 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter index 8cb484be472e10..6635edbb60d8d9 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter index 3a720c7c805fbf..907e4b2ade1d9f 100644 --- a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter +++ b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter index 020c9f0a93c8ed..df16f38fbd0415 100644 --- a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter +++ b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index dae24e7e6fd851..b59be40cc9e0e3 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1612,12 +1623,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1781,11 +1786,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter index 6db777fbefbfe5..e63de3005b12a3 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter index 878c3ca1a435c5..027245bb32134c 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter index 8a6aa2ec17f178..09a0a38867db9b 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter index 434f47c71fd7f8..0ab95c9da1c885 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter index d0b5b1a910c11d..bae60c40497d16 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_onofflight_samplemei.matter b/examples/chef/devices/rootnode_onofflight_samplemei.matter index 17140385015901..e6cf2136403e93 100644 --- a/examples/chef/devices/rootnode_onofflight_samplemei.matter +++ b/examples/chef/devices/rootnode_onofflight_samplemei.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter index cb9f7f2eb6a4ae..7986bc2746a132 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter index 627b2c18d523bd..21fcc5e37f4b16 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter index 67dbddaec37748..3361d54f8b54d0 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_pump_5f904818cc.matter b/examples/chef/devices/rootnode_pump_5f904818cc.matter index 9a2c1905f3ec86..26703052b39682 100644 --- a/examples/chef/devices/rootnode_pump_5f904818cc.matter +++ b/examples/chef/devices/rootnode_pump_5f904818cc.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_pump_a811bb33a0.matter b/examples/chef/devices/rootnode_pump_a811bb33a0.matter index ee410b2a06de4c..26d31b4d4dfccb 100644 --- a/examples/chef/devices/rootnode_pump_a811bb33a0.matter +++ b/examples/chef/devices/rootnode_pump_a811bb33a0.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter index 7da74be02935b4..6fa492c0422f4c 100644 --- a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter +++ b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter index 782bfe9c6e8371..d5cdfd9fde07cc 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 2e659c29a8269f..25a1ccc2f47117 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1195,12 +1206,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1364,11 +1369,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter index ed06fdbadaf739..f68c65ac88bf53 100644 --- a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter +++ b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter index e5ba06a15048b2..bda5640e72b39a 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter index 85b38d275b7802..e6860a6f1e0517 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index 87da5bea2cf9d3..b6497da8992d8d 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1415,12 +1426,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1584,11 +1589,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter index f656ebddb7778a..9cd2ac2f9af386 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; 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 e112e8f2e73671..f5c596c51148f5 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 @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter index 32f653289ae444..3ba939d6acafa0 100644 --- a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter index ae2e6ea4b7b0eb..7b4f160a210596 100644 --- a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter index d118b44aed0ac1..e070eae9c38c2e 100644 --- a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter +++ b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 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 99512288265038..7bca60b7df7723 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 @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter index f776b385bcc383..61e74a779e9dfc 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter +++ b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter index ae49f1c25c7bb7..86180578d8cc42 100644 --- a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter +++ b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index f5e838972ad2d5..83b5cb3837ede9 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/light-switch-app/qpg/zap/switch.matter b/examples/light-switch-app/qpg/zap/switch.matter index bb43ffe002999a..7b01a853a0e26f 100644 --- a/examples/light-switch-app/qpg/zap/switch.matter +++ b/examples/light-switch-app/qpg/zap/switch.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter index 5b7b85f5857cff..d9a74dda26270b 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter index 1fbfa43ce0ab2e..4e977264a46a2c 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter index a914ba6caeb62b..a936f9da9d1572 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 6b50065c4c1c44..f8a5f52f4a7b7d 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.matter b/examples/lighting-app/nxp/zap/lighting-on-off.matter index c990ea3bbfbde3..57ca0a83e3a264 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.matter +++ b/examples/lighting-app/nxp/zap/lighting-on-off.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/qpg/zap/light.matter b/examples/lighting-app/qpg/zap/light.matter index 58472a11cb7b1e..dea212ad78c564 100644 --- a/examples/lighting-app/qpg/zap/light.matter +++ b/examples/lighting-app/qpg/zap/light.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index a15d472711c218..b2f08a07f3a468 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter index 1149a126a222d1..a7013ec8dd771f 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter index 3e156b926f6e0c..6a2cd5b7de5247 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 7dca226d8287b5..1db78d825a6623 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lock-app/nxp/zap/lock-app.matter b/examples/lock-app/nxp/zap/lock-app.matter index 2aa70597fd5266..ad503bebacdd0d 100644 --- a/examples/lock-app/nxp/zap/lock-app.matter +++ b/examples/lock-app/nxp/zap/lock-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/lock-app/qpg/zap/lock.matter b/examples/lock-app/qpg/zap/lock.matter index 79aab6924fe618..8f2cf36e4f3fd6 100644 --- a/examples/lock-app/qpg/zap/lock.matter +++ b/examples/lock-app/qpg/zap/lock.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/log-source-app/log-source-common/log-source-app.matter b/examples/log-source-app/log-source-common/log-source-app.matter index c07f3c8a8ffad9..8b40fe4c7c9b5a 100644 --- a/examples/log-source-app/log-source-common/log-source-app.matter +++ b/examples/log-source-app/log-source-common/log-source-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter index dd7225e9fa102f..e42da407d30f0f 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; 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 e7f55ebbec3808..09e94375bf4f0f 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 @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index 9c1bf10d9330c9..9777498bae5425 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index 055c88a71666e8..e06709c6414e08 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index ff695e66e71cb0..f24547127c09ce 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -4867,12 +4878,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -5036,11 +5041,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; @@ -5233,12 +5233,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -5402,11 +5396,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index a1741741b62e56..938949bb181c38 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -4824,12 +4835,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -4993,11 +4998,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; @@ -5190,12 +5190,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -5359,11 +5353,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index e915a40a037fe9..00bd695161bc82 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.matter b/examples/pump-app/silabs/data_model/pump-thread-app.matter index 6b6f7894e5268b..b72e132c485aab 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.matter +++ b/examples/pump-app/silabs/data_model/pump-thread-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.matter b/examples/pump-app/silabs/data_model/pump-wifi-app.matter index 6b6f7894e5268b..b72e132c485aab 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.matter +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index 26ab0343d20e45..6cafff5f949769 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter index 60a01eae22c315..964eff5f83e785 100644 --- a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter +++ b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index fda431160c3622..887d83f5bfbb6e 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter index 346e958ac22fbc..36294912b4f030 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter index ccf965c8dd2339..50ce10cd1d1642 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter +++ b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index afac4151cc8468..f6e2c93c5ade76 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -2006,12 +2017,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -2175,11 +2180,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 5311666184cae6..345c4e1874d731 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1917,12 +1928,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -2086,11 +2091,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index aaab536cb17c94..390af2bcba9a5c 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1614,12 +1625,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1783,11 +1788,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 6e5855776be1a8..be2f077a197821 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -1794,12 +1805,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -1963,11 +1968,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index ffc1c6a8ebaaf6..7b2295df7cd809 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 06fba3e02f952a..c19597c97dc765 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter index 0a5e801e302ad2..857462f19a81df 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index ca06461be78396..0d1225904f904a 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 2a6c8d804eebed..b3ee62005812e2 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1361,7 +1361,7 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI if (inAtomicWrite) { chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; - Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { + Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { { .attributeID = Presets::Id, .statusCode = static_cast(imcode::Busy) }, { .attributeID = Schedules::Id, .statusCode = static_cast(imcode::Busy) } }; @@ -1380,7 +1380,7 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; - Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { + Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { { .attributeID = Presets::Id, .statusCode = static_cast(imcode::Success) }, { .attributeID = Schedules::Id, .statusCode = static_cast(imcode::Success) } }; @@ -1643,13 +1643,13 @@ bool emberAfThermostatClusterAtomicRequestCallback( switch (requestType) { - case AtomicRequestTypeEnum::kBeginWrite: + case Globals::AtomicRequestTypeEnum::kBeginWrite: return handleAtomicBegin(commandObj, sourceNodeId, commandPath, commandData); - case AtomicRequestTypeEnum::kCommitWrite: + case Globals::AtomicRequestTypeEnum::kCommitWrite: return handleAtomicCommit(commandObj, sourceNodeId, commandPath, commandData); - case AtomicRequestTypeEnum::kRollbackWrite: + case Globals::AtomicRequestTypeEnum::kRollbackWrite: return handleAtomicRollback(commandObj, sourceNodeId, commandPath, commandData); - case AtomicRequestTypeEnum::kUnknownEnumValue: + case Globals::AtomicRequestTypeEnum::kUnknownEnumValue: commandObj->AddStatus(commandPath, imcode::InvalidCommand); return true; } @@ -1706,13 +1706,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { diff --git a/src/app/zap-templates/zcl/data-model/chip/global-enums.xml b/src/app/zap-templates/zcl/data-model/chip/global-enums.xml index 26c3fa33a9d7a7..54f38c1b6933e8 100644 --- a/src/app/zap-templates/zcl/data-model/chip/global-enums.xml +++ b/src/app/zap-templates/zcl/data-model/chip/global-enums.xml @@ -25,7 +25,6 @@ TODO: Make these structures global rather than defining them for each cluster. - diff --git a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml index 201befb3d796dd..11eb7bc4313c0c 100644 --- a/src/app/zap-templates/zcl/data-model/chip/global-structs.xml +++ b/src/app/zap-templates/zcl/data-model/chip/global-structs.xml @@ -25,7 +25,6 @@ TODO: Make these structures global rather than defining them for each cluster. - diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9d45ca48d9fe6b..1fe032c55f5ddd 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -1,6 +1,12 @@ // This IDL was generated automatically by ZAP. // It is for view/code review purposes only. +enum AtomicRequestTypeEnum : enum8 { + kBeginWrite = 0; + kCommitWrite = 1; + kRollbackWrite = 2; +} + enum TestGlobalEnum : enum8 { kSomeValue = 0; kSomeOtherValue = 1; @@ -12,6 +18,11 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; @@ -6659,12 +6670,6 @@ cluster Thermostat = 513 { kHeatPumpInverter = 4; } - enum AtomicRequestTypeEnum : enum8 { - kBeginWrite = 0; - kCommitWrite = 1; - kRollbackWrite = 2; - } - enum ControlSequenceOfOperationEnum : enum8 { kCoolingOnly = 0; kCoolingWithReheat = 1; @@ -6828,11 +6833,6 @@ cluster Thermostat = 513 { nullable boolean builtIn = 5; } - struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; - } - struct PresetStruct { nullable octet_string<16> presetHandle = 0; PresetScenarioEnum presetScenario = 1; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 08a615d2e26e0e..893ca02a301044 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -9808,67 +9808,6 @@ public String toString() { return output.toString(); } } -public static class ThermostatClusterAtomicAttributeStatusStruct { - public Long attributeID; - public Integer statusCode; - private static final long ATTRIBUTE_I_D_ID = 0L; - private static final long STATUS_CODE_ID = 1L; - - public ThermostatClusterAtomicAttributeStatusStruct( - Long attributeID, - Integer statusCode - ) { - this.attributeID = attributeID; - this.statusCode = statusCode; - } - - public StructType encodeTlv() { - ArrayList values = new ArrayList<>(); - values.add(new StructElement(ATTRIBUTE_I_D_ID, new UIntType(attributeID))); - values.add(new StructElement(STATUS_CODE_ID, new UIntType(statusCode))); - - return new StructType(values); - } - - public static ThermostatClusterAtomicAttributeStatusStruct decodeTlv(BaseTLVType tlvValue) { - if (tlvValue == null || tlvValue.type() != TLVType.Struct) { - return null; - } - Long attributeID = null; - Integer statusCode = null; - for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ATTRIBUTE_I_D_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - attributeID = castingValue.value(Long.class); - } - } else if (element.contextTagNum() == STATUS_CODE_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - statusCode = castingValue.value(Integer.class); - } - } - } - return new ThermostatClusterAtomicAttributeStatusStruct( - attributeID, - statusCode - ); - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(); - output.append("ThermostatClusterAtomicAttributeStatusStruct {\n"); - output.append("\tattributeID: "); - output.append(attributeID); - output.append("\n"); - output.append("\tstatusCode: "); - output.append(statusCode); - output.append("\n"); - output.append("}\n"); - return output.toString(); - } -} public static class ThermostatClusterPresetStruct { public @Nullable byte[] presetHandle; public Integer presetScenario; @@ -10218,6 +10157,67 @@ public String toString() { return output.toString(); } } +public static class ThermostatClusterAtomicAttributeStatusStruct { + public Long attributeID; + public Integer statusCode; + private static final long ATTRIBUTE_I_D_ID = 0L; + private static final long STATUS_CODE_ID = 1L; + + public ThermostatClusterAtomicAttributeStatusStruct( + Long attributeID, + Integer statusCode + ) { + this.attributeID = attributeID; + this.statusCode = statusCode; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ATTRIBUTE_I_D_ID, new UIntType(attributeID))); + values.add(new StructElement(STATUS_CODE_ID, new UIntType(statusCode))); + + return new StructType(values); + } + + public static ThermostatClusterAtomicAttributeStatusStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long attributeID = null; + Integer statusCode = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ATTRIBUTE_I_D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + attributeID = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == STATUS_CODE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + statusCode = castingValue.value(Integer.class); + } + } + } + return new ThermostatClusterAtomicAttributeStatusStruct( + attributeID, + statusCode + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ThermostatClusterAtomicAttributeStatusStruct {\n"); + output.append("\tattributeID: "); + output.append(attributeID); + output.append("\n"); + output.append("\tstatusCode: "); + output.append(statusCode); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class OccupancySensingClusterHoldTimeLimitsStruct { public Integer holdTimeMin; public Integer holdTimeMax; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 53d0fa0695ffe4..413211baeb0233 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -38,6 +38,16 @@ class Globals: class Enums: + class AtomicRequestTypeEnum(MatterIntEnum): + kBeginWrite = 0x00 + kCommitWrite = 0x01 + kRollbackWrite = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving an unknown + # enum value. This specific value should never be transmitted. + kUnknownEnumValue = 3, + class TestGlobalEnum(MatterIntEnum): kSomeValue = 0x00 kSomeOtherValue = 0x01 @@ -54,6 +64,19 @@ class TestGlobalBitmap(IntFlag): kSecondBit = 0x2 class Structs: + @dataclass + class AtomicAttributeStatusStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="statusCode", Tag=1, Type=uint), + ]) + + attributeID: 'uint' = 0 + statusCode: 'uint' = 0 + @dataclass class TestGlobalStruct(ClusterObject): @ChipUtility.classproperty @@ -32423,16 +32446,6 @@ class ACTypeEnum(MatterIntEnum): # enum value. This specific value should never be transmitted. kUnknownEnumValue = 5, - class AtomicRequestTypeEnum(MatterIntEnum): - kBeginWrite = 0x00 - kCommitWrite = 0x01 - kRollbackWrite = 0x02 - # All received enum values that are not listed above will be mapped - # to kUnknownEnumValue. This is a helper enum value that should only - # be used by code to process how it handles receiving an unknown - # enum value. This specific value should never be transmitted. - kUnknownEnumValue = 3, - class ControlSequenceOfOperationEnum(MatterIntEnum): kCoolingOnly = 0x00 kCoolingWithReheat = 0x01 @@ -32643,19 +32656,6 @@ def descriptor(cls) -> ClusterObjectDescriptor: transitions: 'typing.List[Thermostat.Structs.ScheduleTransitionStruct]' = field(default_factory=lambda: []) builtIn: 'typing.Union[Nullable, bool]' = NullValue - @dataclass - class AtomicAttributeStatusStruct(ClusterObject): - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="statusCode", Tag=1, Type=uint), - ]) - - attributeID: 'uint' = 0 - statusCode: 'uint' = 0 - @dataclass class PresetStruct(ClusterObject): @ChipUtility.classproperty @@ -32860,12 +32860,12 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="statusCode", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="attributeStatus", Tag=1, Type=typing.List[Thermostat.Structs.AtomicAttributeStatusStruct]), + ClusterObjectFieldDescriptor(Label="attributeStatus", Tag=1, Type=typing.List[Globals.Structs.AtomicAttributeStatusStruct]), ClusterObjectFieldDescriptor(Label="timeout", Tag=2, Type=typing.Optional[uint]), ]) statusCode: 'uint' = 0 - attributeStatus: 'typing.List[Thermostat.Structs.AtomicAttributeStatusStruct]' = field(default_factory=lambda: []) + attributeStatus: 'typing.List[Globals.Structs.AtomicAttributeStatusStruct]' = field(default_factory=lambda: []) timeout: 'typing.Optional[uint]' = None @dataclass @@ -32879,12 +32879,12 @@ class AtomicRequest(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="requestType", Tag=0, Type=Thermostat.Enums.AtomicRequestTypeEnum), + ClusterObjectFieldDescriptor(Label="requestType", Tag=0, Type=Globals.Enums.AtomicRequestTypeEnum), ClusterObjectFieldDescriptor(Label="attributeRequests", Tag=1, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="timeout", Tag=2, Type=typing.Optional[uint]), ]) - requestType: 'Thermostat.Enums.AtomicRequestTypeEnum' = 0 + requestType: 'Globals.Enums.AtomicRequestTypeEnum' = 0 attributeRequests: 'typing.List[uint]' = field(default_factory=lambda: []) timeout: 'typing.Optional[uint]' = None diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index bde804a11e166b..69500acdd91a79 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -17113,6 +17113,12 @@ MTR_DEPRECATED("Please use MTRBaseClusterUnitTesting", ios(16.1, 16.4), macos(13 @interface MTRBaseClusterTestCluster : MTRBaseClusterUnitTesting @end +typedef NS_ENUM(uint8_t, MTRDataTypeAtomicRequestTypeEnum) { + MTRDataTypeAtomicRequestTypeEnumBeginWrite MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRDataTypeAtomicRequestTypeEnumCommitWrite MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRDataTypeAtomicRequestTypeEnumRollbackWrite MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRDataTypeTestGlobalEnum) { MTRDataTypeTestGlobalEnumSomeValue MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRDataTypeTestGlobalEnumSomeOtherValue MTR_PROVISIONALLY_AVAILABLE = 0x01, @@ -19828,12 +19834,6 @@ typedef NS_ENUM(uint8_t, MTRThermostatACType) { MTRThermostatACTypeHeatPumpInverter MTR_PROVISIONALLY_AVAILABLE = 0x04, } MTR_PROVISIONALLY_AVAILABLE; -typedef NS_ENUM(uint8_t, MTRThermostatAtomicRequestType) { - MTRThermostatAtomicRequestTypeBeginWrite MTR_PROVISIONALLY_AVAILABLE = 0x00, - MTRThermostatAtomicRequestTypeCommitWrite MTR_PROVISIONALLY_AVAILABLE = 0x01, - MTRThermostatAtomicRequestTypeRollbackWrite MTR_PROVISIONALLY_AVAILABLE = 0x02, -} MTR_PROVISIONALLY_AVAILABLE; - typedef NS_ENUM(uint8_t, MTRThermostatControlSequenceOfOperation) { MTRThermostatControlSequenceOfOperationCoolingOnly MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) = 0x00, MTRThermostatControlSequenceOfOperationCoolingWithReheat MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 26cfcf4ee31429..98bc65f9ae74b8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -22702,8 +22702,8 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::Thermost auto iter_0 = decodableStruct.attributeStatus.begin(); while (iter_0.Next()) { auto & entry_0 = iter_0.GetValue(); - MTRThermostatClusterAtomicAttributeStatusStruct * newElement_0; - newElement_0 = [MTRThermostatClusterAtomicAttributeStatusStruct new]; + MTRDataTypeAtomicAttributeStatusStruct * newElement_0; + newElement_0 = [MTRDataTypeAtomicAttributeStatusStruct new]; newElement_0.attributeID = [NSNumber numberWithUnsignedInt:entry_0.attributeID]; newElement_0.statusCode = [NSNumber numberWithUnsignedChar:entry_0.statusCode]; [array_0 addObject:newElement_0]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index f6c3bd07c32ef3..1257f47c907da7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -19,6 +19,12 @@ NS_ASSUME_NONNULL_BEGIN +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDataTypeAtomicAttributeStatusStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull attributeID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull statusCode MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRDataTypeTestGlobalStruct : NSObject @property (nonatomic, copy) NSString * _Nonnull name MTR_PROVISIONALLY_AVAILABLE; @@ -1704,12 +1710,6 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable builtIn MTR_PROVISIONALLY_AVAILABLE; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTRThermostatClusterAtomicAttributeStatusStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull attributeID MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull statusCode MTR_PROVISIONALLY_AVAILABLE; -@end - MTR_PROVISIONALLY_AVAILABLE @interface MTRThermostatClusterPresetStruct : NSObject @property (nonatomic, copy) NSData * _Nullable presetHandle MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 5cf6fcc7907a1a..7f5599e75b9843 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -19,6 +19,36 @@ NS_ASSUME_NONNULL_BEGIN +@implementation MTRDataTypeAtomicAttributeStatusStruct +- (instancetype)init +{ + if (self = [super init]) { + + _attributeID = @(0); + + _statusCode = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRDataTypeAtomicAttributeStatusStruct alloc] init]; + + other.attributeID = self.attributeID; + other.statusCode = self.statusCode; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; statusCode:%@; >", NSStringFromClass([self class]), _attributeID, _statusCode]; + return descriptionString; +} + +@end + @implementation MTRDataTypeTestGlobalStruct - (instancetype)init { @@ -7220,36 +7250,6 @@ - (NSString *)description @end -@implementation MTRThermostatClusterAtomicAttributeStatusStruct -- (instancetype)init -{ - if (self = [super init]) { - - _attributeID = @(0); - - _statusCode = @(0); - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[MTRThermostatClusterAtomicAttributeStatusStruct alloc] init]; - - other.attributeID = self.attributeID; - other.statusCode = self.statusCode; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; statusCode:%@; >", NSStringFromClass([self class]), _attributeID, _statusCode]; - return descriptionString; -} - -@end - @implementation MTRThermostatClusterPresetStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index fa2bc84c63b37a..ac435ee9430a43 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -129,6 +129,20 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(detail::AreaTypeTag val return EnumType::kUnknownEnumValue; } } +static auto __attribute__((unused)) EnsureKnownEnumValue(Globals::AtomicRequestTypeEnum val) +{ + using EnumType = Globals::AtomicRequestTypeEnum; + switch (val) + { + case EnumType::kBeginWrite: + case EnumType::kCommitWrite: + case EnumType::kRollbackWrite: + return val; + default: + return EnumType::kUnknownEnumValue; + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(detail::ChangeIndicationEnum val) { using EnumType = detail::ChangeIndicationEnum; @@ -2688,19 +2702,6 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::ACTypeEnum return EnumType::kUnknownEnumValue; } } -static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::AtomicRequestTypeEnum val) -{ - using EnumType = Thermostat::AtomicRequestTypeEnum; - switch (val) - { - case EnumType::kBeginWrite: - case EnumType::kCommitWrite: - case EnumType::kRollbackWrite: - return val; - default: - return EnumType::kUnknownEnumValue; - } -} static auto __attribute__((unused)) EnsureKnownEnumValue(Thermostat::ControlSequenceOfOperationEnum val) { using EnumType = Thermostat::ControlSequenceOfOperationEnum; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 978f185e32677a..41a34c2246f580 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -279,6 +279,19 @@ enum class ProductIdentifierTypeEnum : uint8_t namespace Globals { // Global enums. +// Enum for AtomicRequestTypeEnum +enum class AtomicRequestTypeEnum : uint8_t +{ + kBeginWrite = 0x00, + kCommitWrite = 0x01, + kRollbackWrite = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + // Enum for TestGlobalEnum enum class TestGlobalEnum : uint8_t { @@ -3966,19 +3979,6 @@ enum class ACTypeEnum : uint8_t kUnknownEnumValue = 5, }; -// Enum for AtomicRequestTypeEnum -enum class AtomicRequestTypeEnum : uint8_t -{ - kBeginWrite = 0x00, - kCommitWrite = 0x01, - kRollbackWrite = 0x02, - // All received enum values that are not listed above will be mapped - // to kUnknownEnumValue. This is a helper enum value that should only - // be used by code to process how it handles receiving and unknown - // enum value. This specific should never be transmitted. - kUnknownEnumValue = 3, -}; - // Enum for ControlSequenceOfOperationEnum enum class ControlSequenceOfOperationEnum : uint8_t { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 29439c7122e686..ed46770392af82 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 @@ -556,6 +556,47 @@ namespace Globals { // Global structs namespace Structs { +namespace AtomicAttributeStatusStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kAttributeID), attributeID); + encoder.Encode(to_underlying(Fields::kStatusCode), statusCode); + 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::kAttributeID)) + { + err = DataModel::Decode(reader, attributeID); + } + else if (__context_tag == to_underlying(Fields::kStatusCode)) + { + err = DataModel::Decode(reader, statusCode); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace AtomicAttributeStatusStruct + namespace TestGlobalStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -21155,47 +21196,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace ScheduleStruct -namespace AtomicAttributeStatusStruct { -CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const -{ - DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kAttributeID), attributeID); - encoder.Encode(to_underlying(Fields::kStatusCode), statusCode); - 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::kAttributeID)) - { - err = DataModel::Decode(reader, attributeID); - } - else if (__context_tag == to_underlying(Fields::kStatusCode)) - { - err = DataModel::Decode(reader, statusCode); - } - else - { - } - - ReturnErrorOnFailure(err); - } -} - -} // namespace AtomicAttributeStatusStruct - namespace PresetStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { 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 11b454b7fc674c..478373a26d7622 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 @@ -323,6 +323,30 @@ namespace Globals { // Global structs. namespace Structs { +namespace AtomicAttributeStatusStruct { +enum class Fields : uint8_t +{ + kAttributeID = 0, + kStatusCode = 1, +}; + +struct Type +{ +public: + chip::AttributeId attributeID = static_cast(0); + uint8_t statusCode = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace AtomicAttributeStatusStruct + namespace TestGlobalStruct { enum class Fields : uint8_t { @@ -29499,29 +29523,6 @@ struct DecodableType }; } // namespace ScheduleStruct -namespace AtomicAttributeStatusStruct { -enum class Fields : uint8_t -{ - kAttributeID = 0, - kStatusCode = 1, -}; - -struct Type -{ -public: - chip::AttributeId attributeID = static_cast(0); - uint8_t statusCode = static_cast(0); - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; -}; - -using DecodableType = Type; - -} // namespace AtomicAttributeStatusStruct namespace PresetStruct { enum class Fields : uint8_t { @@ -29941,7 +29942,7 @@ struct Type static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } uint8_t statusCode = static_cast(0); - DataModel::List attributeStatus; + DataModel::List attributeStatus; Optional timeout; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -29958,7 +29959,7 @@ struct DecodableType static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } uint8_t statusCode = static_cast(0); - DataModel::DecodableList attributeStatus; + DataModel::DecodableList attributeStatus; Optional timeout; CHIP_ERROR Decode(TLV::TLVReader & reader); }; @@ -29978,7 +29979,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::AtomicRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - AtomicRequestTypeEnum requestType = static_cast(0); + Globals::AtomicRequestTypeEnum requestType = static_cast(0); DataModel::List attributeRequests; Optional timeout; @@ -29995,7 +29996,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::AtomicRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Thermostat::Id; } - AtomicRequestTypeEnum requestType = static_cast(0); + Globals::AtomicRequestTypeEnum requestType = static_cast(0); DataModel::DecodableList attributeRequests; Optional timeout; 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 a8ddf5056af094..5a439b505e30c7 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -320,6 +320,38 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Appli ComplexArgumentParser::Finalize(request.applicationID); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::Globals::Structs::AtomicAttributeStatusStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AtomicAttributeStatusStruct.attributeID", "attributeID", + value.isMember("attributeID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AtomicAttributeStatusStruct.statusCode", "statusCode", + value.isMember("statusCode"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeID, value["attributeID"])); + valueCopy.removeMember("attributeID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "statusCode"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.statusCode, value["statusCode"])); + valueCopy.removeMember("statusCode"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Globals::Structs::AtomicAttributeStatusStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.attributeID); + ComplexArgumentParser::Finalize(request.statusCode); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ErrorStateStruct::Type & request, Json::Value & value) { @@ -4228,38 +4260,6 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::S ComplexArgumentParser::Finalize(request.builtIn); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request, - Json::Value & value) -{ - VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - - // Copy to track which members we already processed. - Json::Value valueCopy(value); - - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AtomicAttributeStatusStruct.attributeID", "attributeID", - value.isMember("attributeID"))); - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AtomicAttributeStatusStruct.statusCode", "statusCode", - value.isMember("statusCode"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeID"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeID, value["attributeID"])); - valueCopy.removeMember("attributeID"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "statusCode"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.statusCode, value["statusCode"])); - valueCopy.removeMember("statusCode"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.attributeID); - ComplexArgumentParser::Finalize(request.statusCode); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Thermostat::Structs::PresetStruct::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 d660d327a49fe4..d001f91625afd5 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -57,6 +57,11 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Globals::Structs::AtomicAttributeStatusStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::Globals::Structs::AtomicAttributeStatusStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ErrorStateStruct::Type & request, Json::Value & value); @@ -483,11 +488,6 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Str static void Finalize(chip::app::Clusters::Thermostat::Structs::ScheduleStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request, - Json::Value & value); - -static void Finalize(chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Thermostat::Structs::PresetStruct::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 5bc7bea555c4b0..86e1533bd89bbd 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -285,6 +285,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::Globals::Structs::AtomicAttributeStatusStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("AttributeID", indent + 1, value.attributeID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AttributeID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("StatusCode", indent + 1, value.statusCode); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StatusCode'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ErrorStateStruct::DecodableType & value) { @@ -3744,32 +3770,6 @@ 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::Thermostat::Structs::AtomicAttributeStatusStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("AttributeID", indent + 1, value.attributeID); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AttributeID'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("StatusCode", indent + 1, value.statusCode); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StatusCode'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::PresetStruct::DecodableType & 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 00474376202bd8..c064ecef4029b4 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -41,6 +41,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::detail::Structs::ApplicationStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::Globals::Structs::AtomicAttributeStatusStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ErrorStateStruct::DecodableType & value); @@ -301,9 +304,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::ScheduleStruct::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::Thermostat::Structs::AtomicAttributeStatusStruct::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::PresetStruct::DecodableType & value); From c41d02c65468e3552221430a4640684abea8e4fb Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Tue, 30 Jul 2024 13:26:28 -0400 Subject: [PATCH 30/63] Restyled patch --- src/app/clusters/thermostat-server/thermostat-server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index b3ee62005812e2..dbaf93a6b06aa4 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1706,13 +1706,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { From 2740112c556c2ca5b300087802f450f9a853a7d2 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Wed, 31 Jul 2024 17:12:44 -0400 Subject: [PATCH 31/63] Apply suggestions from code review Co-authored-by: Boris Zbarsky --- .../thermostat-server/thermostat-server.cpp | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index dbaf93a6b06aa4..a89de826277444 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -829,7 +829,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrDie(aPath.mClusterId == Thermostat::Id); EndpointId endpoint = aPath.mEndpointId; - const Access::SubjectDescriptor subjectDescriptor = aDecoder.GetSubjectDescriptor(); + auto & subjectDescriptor = aDecoder.GetSubjectDescriptor(); ScopedNodeId scopedNodeId = ScopedNodeId(); // Get the node id if the authentication mode is CASE. @@ -1306,7 +1306,7 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( return true; } -bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +bool validAtomicAttributes(Commands::AtomicRequest::DecodableType & commandData) { auto attributeIdsIter = commandData.attributeRequests.begin(); bool requestedPresets, requestedSchedules; @@ -1337,9 +1337,9 @@ bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::Atom return true; } -bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, - const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +bool handleAtomicBegin(CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, + const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData) { EndpointId endpoint = commandPath.mEndpointId; @@ -1360,16 +1360,15 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(endpoint); if (inAtomicWrite) { - chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; + Commands::AtomicResponse::Type response; Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { - { .attributeID = Presets::Id, .statusCode = static_cast(imcode::Busy) }, - { .attributeID = Schedules::Id, .statusCode = static_cast(imcode::Busy) } + { .attributeID = Presets::Id, .statusCode = to_underlying(imcode::Busy) }, + { .attributeID = Schedules::Id, .statusCode = to_underlying(imcode::Busy) } }; - response.statusCode = static_cast(imcode::Failure); + response.statusCode = to_underlying(imcode::Failure); response.attributeStatus = attributeStatus; commandObj->AddResponse(commandPath, response); - // commandObj->AddStatus(commandPath, imcode::Busy); return true; } @@ -1379,13 +1378,13 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI ScheduleTimer(endpoint, timeout); gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); - chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; + Commands::AtomicResponse::Type response; Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { - { .attributeID = Presets::Id, .statusCode = static_cast(imcode::Success) }, - { .attributeID = Schedules::Id, .statusCode = static_cast(imcode::Success) } + { .attributeID = Presets::Id, .statusCode = to_underlying(imcode::Success) }, + { .attributeID = Schedules::Id, .statusCode = to_underlying(imcode::Success) } }; - response.statusCode = static_cast(imcode::Failure); + response.statusCode = to_underlying(imcode::Failure); response.attributeStatus = attributeStatus; response.timeout.Emplace(timeout); commandObj->AddResponse(commandPath, response); @@ -1393,9 +1392,9 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI return true; } -bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, - const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +bool handleAtomicCommit(CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, + const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData) { if (!validAtomicAttributes(commandData)) { @@ -1548,7 +1547,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const ScopedNode return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); } - // If the preset type for the preset scenario does not support name and a name is specified, return CONSTRAINT_ERROR. + // If the preset type for the preset scenario does not support names and a name is specified, return CONSTRAINT_ERROR. if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) { return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); @@ -1599,9 +1598,9 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const ScopedNode return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); } -bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, - const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +bool handleAtomicRollback(CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, + const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData) { if (!validAtomicAttributes(commandData)) { @@ -1637,7 +1636,6 @@ bool emberAfThermostatClusterAtomicRequestCallback( const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { auto & requestType = commandData.requestType; - // auto & timeout = commandData.timeout; ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); From dabc3a06b6a5017b81240ee504d4063c9279faaf Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Thu, 1 Aug 2024 07:37:10 -0400 Subject: [PATCH 32/63] Regen with alchemy 0.6.1 --- .../air-purifier-common/air-purifier-app.matter | 6 +++--- .../all-clusters-common/all-clusters-app.matter | 8 +++++--- .../all-clusters-minimal-app.matter | 6 +++--- ...ensor_humiditysensor_thermostat_56de3d5f45.matter | 6 +++--- .../rootnode_heatingcoolingunit_ncdGai1E5a.matter | 6 +++--- .../rootnode_roomairconditioner_9cf3607804.matter | 6 +++--- .../devices/rootnode_thermostat_bm3fb8dhYi.matter | 6 +++--- examples/placeholder/linux/apps/app1/config.matter | 12 ++++++------ examples/placeholder/linux/apps/app2/config.matter | 12 ++++++------ .../nxp/zap/thermostat_matter_thread.matter | 6 +++--- .../thermostat/nxp/zap/thermostat_matter_wifi.matter | 6 +++--- .../qpg/zap/thermostaticRadiatorValve.matter | 6 +++--- .../thermostat/thermostat-common/thermostat.matter | 6 +++--- .../zcl/data-model/chip/thermostat-cluster.xml | 9 ++++----- src/controller/data_model/controller-clusters.matter | 6 +++--- .../Framework/CHIP/zap-generated/MTRBaseClusters.h | 6 +++--- 16 files changed, 57 insertions(+), 56 deletions(-) diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index cd0cff5ab2c29c..6c9fa928758007 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -1668,13 +1668,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; 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 518c96bbd385a0..15e3cfc7e13d29 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 @@ -5505,13 +5505,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; @@ -9624,3 +9624,5 @@ endpoint 65534 { handle command ReorderNetwork; } } + + diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 711aa680d7838f..0a4bf870ed1825 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -3942,13 +3942,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index ce95cf1f03c4db..6f7e84bd74f6ff 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -1591,13 +1591,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 3bd9bfe411aaf3..d8cba863ec6e37 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -1948,13 +1948,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 54a35b82fb44d5..94b21623ccdea2 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -1531,13 +1531,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index 71a9c121814df0..c05c401c354b63 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1751,13 +1751,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index d8244ae6f4191b..3e7fcf78a9ed7e 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -5225,13 +5225,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; @@ -5580,13 +5580,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index e332eb14454364..ba2240fb33f38d 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -5182,13 +5182,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; @@ -5537,13 +5537,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 45ec86aa875aea..d7cfa0ad0e02fc 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -2342,13 +2342,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 586830df698e84..f73b1ef2703535 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -2253,13 +2253,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index 3155fcbb11c4f4..5a0d8fe7d41d02 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -1950,13 +1950,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 23d172be0c3e0e..20ae1ae6c8c20e 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -2130,13 +2130,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml index bc7faec58df24b..3d49c21c325678 100644 --- a/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml @@ -253,7 +253,7 @@ limitations under the License. - + @@ -449,7 +449,6 @@ limitations under the License. SetpointHoldExpiryTimestamp - Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. @@ -458,7 +457,7 @@ limitations under the License. - Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the + This command is used to update the thermostat weekly setpoint schedule from a management system. @@ -467,7 +466,7 @@ limitations under the License. - Upon receipt, the unit SHOULD send in return the Get + The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. @@ -478,7 +477,7 @@ limitations under the License. - Upon receipt, if the + Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 9342c7c919e5ef..65158fb239c9b4 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6995,13 +6995,13 @@ cluster Thermostat = 513 { /** Upon receipt, the attributes for the indicated setpoint(s) SHALL have the amount specified in the Amount field added to them. */ command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0; - /** Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the */ + /** This command is used to update the thermostat weekly setpoint schedule from a management system. */ command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1; - /** Upon receipt, the unit SHOULD send in return the Get */ + /** The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2; /** This command is used to clear the weekly schedule. */ command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3; - /** Upon receipt, if the */ + /** Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5; /** ID */ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 585320b8907768..51ca35306f057d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -10017,13 +10017,13 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Command SetWeeklySchedule * - * Upon receipt, the weekly schedule for updating setpoints SHALL be stored in the + * This command is used to update the thermostat weekly setpoint schedule from a management system. */ - (void)setWeeklyScheduleWithParams:(MTRThermostatClusterSetWeeklyScheduleParams *)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); /** * Command GetWeeklySchedule * - * Upon receipt, the unit SHOULD send in return the Get + * The Current Weekly Schedule Command is sent from the server in response to the Get Weekly Schedule Command. */ - (void)getWeeklyScheduleWithParams:(MTRThermostatClusterGetWeeklyScheduleParams *)params completion:(void (^)(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); /** @@ -10037,7 +10037,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) /** * Command SetActiveScheduleRequest * - * Upon receipt, if the + * Upon receipt, if the Schedules attribute contains a ScheduleStruct whose ScheduleHandle field matches the value of the ScheduleHandle field, the server SHALL set the thermostat's ActiveScheduleHandle attribute to the value of the ScheduleHandle field. */ - (void)setActiveScheduleRequestWithParams:(MTRThermostatClusterSetActiveScheduleRequestParams *)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; /** From f08c0cf8f12236e24f42d434ba9d644e355e61c4 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Thu, 1 Aug 2024 08:21:41 -0400 Subject: [PATCH 33/63] Updates based on comments --- examples/all-clusters-app/linux/BUILD.gn | 2 - examples/all-clusters-app/tizen/BUILD.gn | 2 - examples/thermostat/linux/BUILD.gn | 4 + .../linux}/include/thermostat-delegate-impl.h | 7 +- .../linux}/include/thermostat-manager.h | 0 examples/thermostat/linux/main.cpp | 16 ++- .../linux}/thermostat-delegate-impl.cpp | 48 ++----- .../linux}/thermostat-manager.cpp | 0 .../thermostat-server/thermostat-delegate.h | 24 +--- .../thermostat-server/thermostat-server.cpp | 133 ++++++++++-------- .../thermostat-server/thermostat-server.h | 21 +++ 11 files changed, 132 insertions(+), 125 deletions(-) rename examples/{all-clusters-app/all-clusters-common => thermostat/linux}/include/thermostat-delegate-impl.h (94%) rename examples/{all-clusters-app/all-clusters-common => thermostat/linux}/include/thermostat-manager.h (100%) rename examples/{all-clusters-app/all-clusters-common/src => thermostat/linux}/thermostat-delegate-impl.cpp (81%) rename examples/{all-clusters-app/all-clusters-common/src => thermostat/linux}/thermostat-manager.cpp (100%) diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 698c8ccd1ba637..c7c5fb0f14ecd3 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -62,8 +62,6 @@ 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/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/water-heater-mode.cpp", "${chip_root}/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 8334ee9abea5ec..855416c0446923 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -38,8 +38,6 @@ source_set("chip-all-clusters-common") { "${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/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.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", diff --git a/examples/thermostat/linux/BUILD.gn b/examples/thermostat/linux/BUILD.gn index 89d24bff8a0835..71c0eccfcfae50 100644 --- a/examples/thermostat/linux/BUILD.gn +++ b/examples/thermostat/linux/BUILD.gn @@ -20,6 +20,8 @@ executable("thermostat-app") { "include/low-power/LowPowerManager.cpp", "include/low-power/LowPowerManager.h", "main.cpp", + "thermostat-delegate-impl.cpp", + "thermostat-manager.cpp", ] deps = [ @@ -28,6 +30,8 @@ executable("thermostat-app") { "${chip_root}/src/lib", ] + include_dirs = [ "include" ] + cflags = [ "-Wconversion" ] output_dir = root_out_dir diff --git a/examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h b/examples/thermostat/linux/include/thermostat-delegate-impl.h similarity index 94% rename from examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h rename to examples/thermostat/linux/include/thermostat-delegate-impl.h index f4b8ac8565cf2c..f559977f341949 100644 --- a/examples/all-clusters-app/all-clusters-common/include/thermostat-delegate-impl.h +++ b/examples/thermostat/linux/include/thermostat-delegate-impl.h @@ -50,12 +50,12 @@ class ThermostatDelegate : public Delegate CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; - void BeginPendingPresetList() override; - CHIP_ERROR GetActivePresetHandle(MutableByteSpan & activePresetHandle) override; CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) override; + void InitializePendingPresets() override; + CHIP_ERROR AppendToPendingPresetList(const Structs::PresetStruct::Type & preset) override; CHIP_ERROR GetPendingPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) override; @@ -64,9 +64,6 @@ class ThermostatDelegate : public Delegate void ClearPendingPresetList() override; - void AttributeChanged(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, - uint16_t size) override; - private: static ThermostatDelegate sInstance; diff --git a/examples/all-clusters-app/all-clusters-common/include/thermostat-manager.h b/examples/thermostat/linux/include/thermostat-manager.h similarity index 100% rename from examples/all-clusters-app/all-clusters-common/include/thermostat-manager.h rename to examples/thermostat/linux/include/thermostat-manager.h diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp index b9f82696e8ce79..2279f02bef3963 100644 --- a/examples/thermostat/linux/main.cpp +++ b/examples/thermostat/linux/main.cpp @@ -22,6 +22,8 @@ #include #include +#include "thermostat-manager.h" + using namespace chip; using namespace chip::app; // using namespace chip::app::Clusters; @@ -74,7 +76,19 @@ void ApplicationShutdown() {} int main(int argc, char * argv[]) { - VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); + if (ChipLinuxAppInit(argc, argv) != 0) + { + return -1; + } + ChipLogProgress(Zcl, "Starting Thermostat Manager"); + CHIP_ERROR err = ThermostatManager().Init(); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Failed to initialize thermostat manager: %" CHIP_ERROR_FORMAT, err.Format()); + chip::DeviceLayer::PlatformMgr().Shutdown(); + return -1; + } ChipLinuxAppMainLoop(); return 0; } diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp similarity index 81% rename from examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp rename to examples/thermostat/linux/thermostat-delegate-impl.cpp index c9c963a32fe998..eaa76d0b71690c 100644 --- a/examples/all-clusters-app/all-clusters-common/src/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -135,22 +135,6 @@ CHIP_ERROR ThermostatDelegate::GetPresetAtIndex(size_t index, PresetStructWithOw return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; } -void ThermostatDelegate::BeginPendingPresetList() -{ - mNextFreeIndexInPendingPresetsList = 0; - for (uint8_t indexInPresets = 0; indexInPresets < mNextFreeIndexInPresetsList; indexInPresets++) - { - auto preset = mPresets[indexInPresets]; - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(preset.GetPresetHandle()); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetScenario(preset.GetPresetScenario()); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetName(preset.GetName()); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetCoolingSetpoint(preset.GetCoolingSetpoint()); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetHeatingSetpoint(preset.GetHeatingSetpoint()); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(preset.GetBuiltIn()); - mNextFreeIndexInPendingPresetsList++; - } -} - CHIP_ERROR ThermostatDelegate::GetActivePresetHandle(MutableByteSpan & activePresetHandle) { return CopySpanToMutableSpan(ByteSpan(mActivePresetHandleData, mActivePresetHandleDataSize), activePresetHandle); @@ -182,10 +166,21 @@ CHIP_ERROR ThermostatDelegate::SetActivePresetHandle(const DataModel::Nullable(preset.presetScenario) }; mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(DataModel::MakeNullable(ByteSpan(handle))); } - else - { - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetHandle(preset.presetHandle); - } - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetPresetScenario(preset.presetScenario); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetName(preset.name); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetCoolingSetpoint(preset.coolingSetpoint); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetHeatingSetpoint(preset.heatingSetpoint); - mPendingPresets[mNextFreeIndexInPendingPresetsList].SetBuiltIn(preset.builtIn); mNextFreeIndexInPendingPresetsList++; return CHIP_NO_ERROR; } @@ -253,15 +239,3 @@ void ThermostatDelegate::ClearPendingPresetList() { mNextFreeIndexInPendingPresetsList = 0; } - -void ThermostatDelegate::AttributeChanged(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, - uint16_t size) -{ - ChipLogProgress(AppServer, "ThermostatDelegate AttributeChanged callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - - ChipLogProgress(AppServer, - "Attribute ID changed: " ChipLogFormatMEI " Endpoint: %d ClusterId: " ChipLogFormatMEI " Value: %u, length %u", - ChipLogValueMEI(attributeId), endpointId, ChipLogValueMEI(clusterId), *value, size); - - ThermostatManager().AttributeChangeHandler(endpointId, clusterId, attributeId, value, size); -} diff --git a/examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp b/examples/thermostat/linux/thermostat-manager.cpp similarity index 100% rename from examples/all-clusters-app/all-clusters-common/src/thermostat-manager.cpp rename to examples/thermostat/linux/thermostat-manager.cpp diff --git a/src/app/clusters/thermostat-server/thermostat-delegate.h b/src/app/clusters/thermostat-server/thermostat-delegate.h index d649a7f31ec3aa..0c09b9dd4d70fc 100644 --- a/src/app/clusters/thermostat-server/thermostat-delegate.h +++ b/src/app/clusters/thermostat-server/thermostat-delegate.h @@ -64,12 +64,6 @@ class Delegate */ virtual CHIP_ERROR GetPresetAtIndex(size_t index, PresetStructWithOwnedMembers & preset) = 0; - /** - * @brief Creates a new pending presets list. - * - */ - virtual void BeginPendingPresetList() = 0; - /** * @brief Get the ActivePresetHandle attribute value. * @@ -86,6 +80,11 @@ class Delegate */ virtual CHIP_ERROR SetActivePresetHandle(const DataModel::Nullable & newActivePresetHandle) = 0; + /** + * @brief Copies existing presets to the pending preset list + */ + virtual void InitializePendingPresets() = 0; + /** * @brief Appends a preset to the pending presets list maintained by the delegate. * The delegate must ensure it makes a copy of the provided preset and the data @@ -127,19 +126,6 @@ class Delegate * */ virtual void ClearPendingPresetList() = 0; - - /** - * @brief Informs of a change in a non-atomic thermostat attribute - * - * @param[in] endpointId The endpoint for the thermostat cluster. - * @param[in] clusterId The ID of the cluster. - * @param[in] attributeId The ID of the attribute being updated. - * @param[in] value The new value of the attribute. - * @param[in] size The size of the new value of the attribute. - * - */ - virtual void AttributeChanged(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t * value, - uint16_t size) = 0; }; } // namespace Thermostat diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index dbaf93a6b06aa4..8297e87c092013 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -126,9 +126,9 @@ void TimerExpiredCallback(System::Layer * systemLayer, void * callbackContext) * @param[in] endpoint The endpoint to use. * @param[in] timeoutMilliseconds The timeout in milliseconds. */ -void ScheduleTimer(EndpointId endpoint, uint16_t timeoutMilliseconds) +void ScheduleTimer(EndpointId endpoint, System::Clock::Milliseconds16 timeout) { - DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds16(timeoutMilliseconds), TimerExpiredCallback, + DeviceLayer::SystemLayer().StartTimer(timeout, TimerExpiredCallback, reinterpret_cast(static_cast(endpoint))); } @@ -674,6 +674,26 @@ bool ThermostatAttrAccess::InAtomicWrite(EndpointId endpoint) return inAtomicWrite; } +bool ThermostatAttrAccess::InAtomicWrite(const Access::SubjectDescriptor & subjectDescriptor, EndpointId endpoint) +{ + if (!InAtomicWrite(endpoint)) + { + return false; + } + return subjectDescriptor.authMode == Access::AuthMode::kCase && + GetAtomicWriteScopedNodeId(endpoint) == ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); +} + +bool ThermostatAttrAccess::InAtomicWrite(CommandHandler * commandObj, EndpointId endpoint) +{ + if (!InAtomicWrite(endpoint)) + { + return false; + } + ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + return GetAtomicWriteScopedNodeId(endpoint) == sourceNodeId; +} + void ThermostatAttrAccess::SetAtomicWriteScopedNodeId(EndpointId endpoint, ScopedNodeId originatorNodeId) { uint16_t ep = @@ -758,7 +778,8 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A Delegate * delegate = GetDelegate(aPath.mEndpointId); VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null")); - if (InAtomicWrite(aPath.mEndpointId)) + auto & subjectDescriptor = aEncoder.GetSubjectDescriptor(); + if (InAtomicWrite(subjectDescriptor, aPath.mEndpointId)) { return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR { for (uint8_t i = 0; true; i++) @@ -1079,7 +1100,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > OccupiedCoolingSetpoint - DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case OccupiedCoolingSetpoint::Id: { @@ -1094,7 +1115,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < OccupiedHeatingSetpoint + DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case UnoccupiedHeatingSetpoint::Id: { @@ -1109,7 +1130,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > UnoccupiedCoolingSetpoint - DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case UnoccupiedCoolingSetpoint::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1123,7 +1144,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < UnoccupiedHeatingSetpoint + DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case MinHeatSetpointLimit::Id: { @@ -1137,7 +1158,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > MinCoolSetpointLimit - DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case MaxHeatSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1150,7 +1171,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested > MaxCoolSetpointLimit - DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case MinCoolSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1163,7 +1184,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < MinHeatSetpointLimit + DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case MaxCoolSetpointLimit::Id: { requested = static_cast(chip::Encoding::LittleEndian::Get16(value)); @@ -1176,7 +1197,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr if (requested < MaxHeatSetpointLimit + DeadBandTemp) return imcode::InvalidValue; } - break; + return imcode::Success; } case MinSetpointDeadBand::Id: { requested = *value; @@ -1184,7 +1205,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr return imcode::UnsupportedAttribute; if (requested < 0 || requested > 25) return imcode::InvalidValue; - break; + return imcode::Success; } case ControlSequenceOfOperation::Id: { @@ -1192,7 +1213,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr requestedCSO = *value; if (requestedCSO > to_underlying(ControlSequenceOfOperationEnum::kCoolingAndHeatingWithReheat)) return imcode::InvalidValue; - break; + return imcode::Success; } case SystemMode::Id: { @@ -1215,27 +1236,22 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr case ControlSequenceOfOperationEnum::kCoolingWithReheat: if (RequestedSystemMode == SystemModeEnum::kHeat || RequestedSystemMode == SystemModeEnum::kEmergencyHeat) return imcode::InvalidValue; - break; + else + return imcode::Success; case ControlSequenceOfOperationEnum::kHeatingOnly: case ControlSequenceOfOperationEnum::kHeatingWithReheat: if (RequestedSystemMode == SystemModeEnum::kCool || RequestedSystemMode == SystemModeEnum::kPrecooling) return imcode::InvalidValue; - break; + else + return imcode::Success; default: - break; + return imcode::Success; } - break; } default: - break; - } - Delegate * delegate = GetDelegate(endpoint); - if (delegate != nullptr) - { - delegate->AttributeChanged(attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId, value, size); + return imcode::Success; } - return imcode::Success; } bool emberAfThermostatClusterClearWeeklyScheduleCallback(app::CommandHandler * commandObj, @@ -1309,7 +1325,7 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { auto attributeIdsIter = commandData.attributeRequests.begin(); - bool requestedPresets, requestedSchedules; + bool requestedPresets = false, requestedSchedules = false; while (attributeIdsIter.Next()) { auto & attributeId = attributeIdsIter.GetValue(); @@ -1317,14 +1333,14 @@ bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::Atom switch (attributeId) { case Presets::Id: - if (requestedPresets) + if (requestedPresets) // Double-requesting an attribute is invalid { return false; } requestedPresets = true; break; case Schedules::Id: - if (requestedSchedules) + if (requestedSchedules) // Double-requesting an attribute is invalid { return false; } @@ -1334,15 +1350,26 @@ bool validAtomicAttributes(const chip::app::Clusters::Thermostat::Commands::Atom return false; } } - return true; + if (attributeIdsIter.GetStatus() != CHIP_NO_ERROR) + { + return false; + } + // If the atomic request doesn't contain at least one of these attributes, it's invalid + return (requestedPresets || requestedSchedules); } -bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, - const chip::app::ConcreteCommandPath & commandPath, +bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { EndpointId endpoint = commandPath.mEndpointId; + if (gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint)) + { + // This client already has an open atomic write + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return true; + } + if (!commandData.timeout.HasValue()) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); @@ -1357,9 +1384,9 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI return true; } - bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(endpoint); - if (inAtomicWrite) + if (gThermostatAttrAccess.InAtomicWrite(endpoint)) { + // Some other client has an open atomic write, return busy chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { { .attributeID = Presets::Id, .statusCode = static_cast(imcode::Busy) }, @@ -1369,14 +1396,15 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI response.statusCode = static_cast(imcode::Failure); response.attributeStatus = attributeStatus; commandObj->AddResponse(commandPath, response); - // commandObj->AddStatus(commandPath, imcode::Busy); return true; } + // This is a valid request to open an atomic write. Note that + uint16_t maxTimeout = 5000; timeout = std::min(timeout, maxTimeout); - ScheduleTimer(endpoint, timeout); + ScheduleTimer(endpoint, static_cast(timeout)); gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); chip::app::Clusters::Thermostat::Commands::AtomicResponse::Type response; @@ -1385,7 +1413,7 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI { .attributeID = Schedules::Id, .statusCode = static_cast(imcode::Success) } }; - response.statusCode = static_cast(imcode::Failure); + response.statusCode = static_cast(imcode::Success); response.attributeStatus = attributeStatus; response.timeout.Emplace(timeout); commandObj->AddResponse(commandPath, response); @@ -1393,8 +1421,7 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const ScopedNodeI return true; } -bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, - const chip::app::ConcreteCommandPath & commandPath, +bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { if (!validAtomicAttributes(commandData)) @@ -1403,19 +1430,13 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const ScopedNode return true; } EndpointId endpoint = commandPath.mEndpointId; - bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(endpoint); + bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint); if (!inAtomicWrite) { commandObj->AddStatus(commandPath, imcode::InvalidInState); return true; } - if (gThermostatAttrAccess.GetAtomicWriteScopedNodeId(endpoint) != sourceNodeId) - { - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; - } - Delegate * delegate = GetDelegate(endpoint); if (delegate == nullptr) @@ -1599,8 +1620,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const ScopedNode return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); } -bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const ScopedNodeId & sourceNodeId, - const chip::app::ConcreteCommandPath & commandPath, +bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { if (!validAtomicAttributes(commandData)) @@ -1609,18 +1629,13 @@ bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const ScopedNo return true; } EndpointId endpoint = commandPath.mEndpointId; - bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(endpoint); + bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint); if (!inAtomicWrite) { commandObj->AddStatus(commandPath, imcode::InvalidInState); return true; } - if (gThermostatAttrAccess.GetAtomicWriteScopedNodeId(endpoint) != sourceNodeId) - { - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; - } Delegate * delegate = GetDelegate(endpoint); if (delegate == nullptr) @@ -1637,18 +1652,18 @@ bool emberAfThermostatClusterAtomicRequestCallback( const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { auto & requestType = commandData.requestType; - // auto & timeout = commandData.timeout; - ScopedNodeId sourceNodeId = GetSourceScopedNodeId(commandObj); + // If we've gotten this far, then the client has manage permission to call AtomicRequest, which is also the + // privilege necessary to write to the atomic attributes, so no need to check switch (requestType) { case Globals::AtomicRequestTypeEnum::kBeginWrite: - return handleAtomicBegin(commandObj, sourceNodeId, commandPath, commandData); + return handleAtomicBegin(commandObj, commandPath, commandData); case Globals::AtomicRequestTypeEnum::kCommitWrite: - return handleAtomicCommit(commandObj, sourceNodeId, commandPath, commandData); + return handleAtomicCommit(commandObj, commandPath, commandData); case Globals::AtomicRequestTypeEnum::kRollbackWrite: - return handleAtomicRollback(commandObj, sourceNodeId, commandPath, commandData); + return handleAtomicRollback(commandObj, commandPath, commandData); case Globals::AtomicRequestTypeEnum::kUnknownEnumValue: commandObj->AddStatus(commandPath, imcode::InvalidCommand); return true; @@ -1706,13 +1721,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h index 64e4bb7bce3c82..230f21b0ccfe25 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.h +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -27,6 +27,7 @@ #include "thermostat-delegate.h" #include +#include namespace chip { namespace app { @@ -83,6 +84,26 @@ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface */ bool InAtomicWrite(EndpointId endpoint); + /** + * @brief Gets whether an atomic write is in progress for the given endpoint + * + * @param[in] subjectDescriptor The subject descriptor. + * @param[in] endpoint The endpoint. + * + * @return Whether an atomic write is in progress for the given endpoint + */ + bool InAtomicWrite(const Access::SubjectDescriptor & subjectDescriptor, EndpointId endpoint); + + /** + * @brief Gets whether an atomic write is in progress for the given endpoint + * + * @param[in] commandObj The command handler. + * @param[in] endpoint The endpoint. + * + * @return Whether an atomic write is in progress for the given endpoint + */ + bool InAtomicWrite(CommandHandler * commandObj, EndpointId endpoint); + private: ScopedNodeId mAtomicWriteNodeIds[kThermostatEndpointCount]; bool mAtomicWriteState[kThermostatEndpointCount]; From 77c0dcafc9826b3cb3c456559e31d5aad7b10df1 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 31 Jul 2024 15:06:04 -0400 Subject: [PATCH 34/63] Add TC_MCORE_FS_1_3.py test implementation (#34650) --- src/python_testing/TC_MCORE_FS_1_3.py | 175 ++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 src/python_testing/TC_MCORE_FS_1_3.py diff --git a/src/python_testing/TC_MCORE_FS_1_3.py b/src/python_testing/TC_MCORE_FS_1_3.py new file mode 100644 index 00000000000000..791d3785f28395 --- /dev/null +++ b/src/python_testing/TC_MCORE_FS_1_3.py @@ -0,0 +1,175 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This test requires a TH_SERVER application that returns UnsupportedAttribute when reading UniqueID from BasicInformation Cluster. Please specify with --string-arg th_server_app_path: + +import logging +import os +import random +import signal +import subprocess +import time +import uuid + +import chip.clusters as Clusters +from chip import ChipDeviceCtrl +from chip.interaction_model import Status +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches +from mobly import asserts + + +class TC_MCORE_FS_1_3(MatterBaseTest): + @async_test_body + async def setup_class(self): + super().setup_class() + self.device_for_th_eco_nodeid = 1111 + self.device_for_th_eco_kvs = None + self.device_for_th_eco_port = 5543 + self.app_process_for_th_eco = None + + self.device_for_dut_eco_nodeid = 1112 + self.device_for_dut_eco_kvs = None + self.device_for_dut_eco_port = 5544 + self.app_process_for_dut_eco = None + + # Create a second controller on a new fabric to communicate to the server + new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority() + new_fabric_admin = new_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, fabricId=2) + paa_path = str(self.matter_test_config.paa_trust_store_path) + self.TH_server_controller = new_fabric_admin.NewController(nodeId=112233, paaTrustStorePath=paa_path) + + def teardown_class(self): + if self.app_process_for_dut_eco is not None: + logging.warning("Stopping app with SIGTERM") + self.app_process_for_dut_eco.send_signal(signal.SIGTERM.value) + self.app_process_for_dut_eco.wait() + if self.app_process_for_th_eco is not None: + logging.warning("Stopping app with SIGTERM") + self.app_process_for_th_eco.send_signal(signal.SIGTERM.value) + self.app_process_for_th_eco.wait() + + os.remove(self.device_for_dut_eco_kvs) + if self.device_for_th_eco_kvs is not None: + os.remove(self.device_for_th_eco_kvs) + super().teardown_class() + + async def create_device_and_commission_to_th_fabric(self, kvs, port, node_id_for_th, device_info): + # TODO: confirm whether we can open processes like this on the TH + app = self.user_params.get("th_server_app_path", None) + if not app: + asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') + + discriminator = random.randint(0, 4095) + passcode = 20202021 + app_args = f'--secured-device-port {port} --discriminator {discriminator} --passcode {passcode} --KVS {kvs}' + cmd = f'{app} {app_args}' + # TODO: Determine if we want these logs cooked or pushed to somewhere else + logging.info(f"Starting TH device for {device_info}") + self.app_process_for_dut_eco = subprocess.Popen(cmd, bufsize=0, shell=True) + logging.info(f"Started TH device for {device_info}") + time.sleep(3) + + logging.info("Commissioning from separate fabric") + await self.TH_server_controller.CommissionOnNetwork(nodeId=node_id_for_th, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) + logging.info("Commissioning device for DUT ecosystem onto TH for managing") + + async def create_and_commission_device_for_th_ecosystem(self): + # TODO: confirm whether we can open processes like this on the TH + app = self.user_params.get("th_server_app_path", None) + + self.device_for_th_eco_kvs = f'kvs_{str(uuid.uuid4())}' + discriminator = random.randint(0, 4095) + passcode = 20202021 + app_args = f'--secured-device-port {self.device_for_th_eco_port} --discriminator {discriminator} --passcode {passcode} --KVS {self.device_for_th_eco_kvs}' + cmd = f'{app} {app_args}' + # TODO: Determine if we want these logs cooked or pushed to somewhere else + logging.info("Starting TH device for TH ecosystem") + self.app_process_for_th_eco = subprocess.Popen(cmd, bufsize=0, shell=True) + logging.info("Started TH device for TH ecosystem") + time.sleep(3) + + logging.info("Commissioning from separate fabric") + self.server_nodeid = 1112 + await self.TH_server_controller.CommissionOnNetwork(nodeId=self.server_nodeid, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) + logging.info("Commissioning TH device for TH ecosystem") + + def steps_TC_MCORE_FS_1_3(self) -> list[TestStep]: + steps = [TestStep(1, "DUT_FSA commissions TH_SED_DUT to DUT_FSAs fabric and generates a UniqueID", is_commissioning=True), + TestStep(2, "TH_FSA commissions TH_SED_TH onto TH_FSAs fabric and generates a UniqueID."), + TestStep(3, "Follow manufacturer provided instructions to enable DUT_FSA to synchronize TH_SED_TH onto DUT_FSAs fabric."), + TestStep(4, "DUT_FSA synchronizes TH_SED_TH onto DUT_FSAs fabric and copies the UniqueID presented by TH_FSAs Bridged Device Basic Information Cluster.")] + return steps + + @async_test_body + async def test_TC_MCORE_FS_1_3(self): + self.is_ci = self.check_pics('PICS_SDK_CI_ONLY') + self.print_step(0, "Commissioning DUT to TH, already done") + self.step(1) + # These steps are not explicitly in step 1, but they help identify the dynamically added endpoint in step 1. + root_node_endpoint = 0 + root_part_list = await self.read_single_attribute_check_success(cluster=Clusters.Descriptor, attribute=Clusters.Descriptor.Attributes.PartsList, endpoint=root_node_endpoint) + set_of_endpoints_before_adding_device = set(root_part_list) + + kvs = f'kvs_{str(uuid.uuid4())}' + device_info = "for DUT ecosystem" + await self.create_device_and_commission_to_th_fabric(kvs, self.device_for_dut_eco_port, self.device_for_dut_eco_nodeid, device_info) + self.device_for_dut_eco_kvs = kvs + read_result = await self.TH_server_controller.ReadAttribute(self.device_for_dut_eco_nodeid, [(root_node_endpoint, Clusters.BasicInformation.Attributes.UniqueID)]) + result = read_result[root_node_endpoint][Clusters.BasicInformation][Clusters.BasicInformation.Attributes.UniqueID] + asserts.assert_true(type_matches(result, Clusters.Attribute.ValueDecodeFailure), "We were expecting a value decode failure") + asserts.assert_equal(result.Reason.status, Status.UnsupportedAttribute, "Incorrect error returned from reading UniqueID") + + params = await self.openCommissioningWindow(dev_ctrl=self.TH_server_controller, node_id=self.device_for_dut_eco_nodeid) + + self.wait_for_user_input( + prompt_msg=f"Using the DUT vendor's provided interface, commission the device using the following parameters:\n" + f"- discriminator: {params.randomDiscriminator}\n" + f"- setupPinCode: {params.commissioningParameters.setupPinCode}\n" + f"- setupQRCode: {params.commissioningParameters.setupQRCode}\n" + f"- setupManualcode: {params.commissioningParameters.setupManualCode}\n" + f"If using FabricSync Admin, you may type:\n" + f">>> pairing onnetwork {params.commissioningParameters.setupPinCode}") + + root_part_list = await self.read_single_attribute_check_success(cluster=Clusters.Descriptor, attribute=Clusters.Descriptor.Attributes.PartsList, endpoint=root_node_endpoint) + set_of_endpoints_after_adding_device = set(root_part_list) + + asserts.assert_true(set_of_endpoints_after_adding_device.issuperset( + set_of_endpoints_before_adding_device), "Expected only new endpoints to be added") + unique_endpoints_set = set_of_endpoints_after_adding_device - set_of_endpoints_before_adding_device + asserts.assert_equal(len(unique_endpoints_set), 1, "Expected only one new endpoint") + newly_added_endpoint = list(unique_endpoints_set)[0] + + th_sed_dut_unique_id = await self.read_single_attribute_check_success(cluster=Clusters.BridgedDeviceBasicInformation, attribute=Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID, endpoint=newly_added_endpoint) + asserts.assert_true(type_matches(th_sed_dut_unique_id, str), "UniqueID should be a string") + asserts.assert_true(th_sed_dut_unique_id, "UniqueID should not be an empty string") + + self.step(2) + kvs = f'kvs_{str(uuid.uuid4())}' + device_info = "for TH_FSA ecosystem" + await self.create_device_and_commission_to_th_fabric(kvs, self.device_for_th_eco_port, self.device_for_th_eco_nodeid, device_info) + self.device_for_th_eco_kvs = kvs + # TODO(https://github.com/CHIP-Specifications/chip-test-plans/issues/4375) During setup we need to create the TH_FSA device + # where we would commission device created in create_device_and_commission_to_th_fabric to be commissioned into TH_FSA. + + # TODO(https://github.com/CHIP-Specifications/chip-test-plans/issues/4375) Because we cannot create a TH_FSA and there is + # no way to mock it the following 2 test steps are skipped for now. + self.skip_step(3) + self.skip_step(4) + + +if __name__ == "__main__": + default_matter_test_main() From 608d034662e246ac5a56b49cf5e8909f27559684 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Wed, 31 Jul 2024 15:37:08 -0400 Subject: [PATCH 35/63] Fix most TC-SWTCH-2.4 remaining issues (#34677) - Move 2.4 in a better place in the file - Add test steps properly - Allow default button press position override Issue #34656 Testing done: - Test still passes on DUT with automation --- src/python_testing/TC_SWTCH.py | 255 +++++++++++++++++---------------- 1 file changed, 132 insertions(+), 123 deletions(-) diff --git a/src/python_testing/TC_SWTCH.py b/src/python_testing/TC_SWTCH.py index 6da5c7a229e0b7..08bf23d91c30d4 100644 --- a/src/python_testing/TC_SWTCH.py +++ b/src/python_testing/TC_SWTCH.py @@ -45,22 +45,28 @@ logger = logging.getLogger(__name__) -class TC_SwitchTests(MatterBaseTest): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) +def bump_substep(step: str) -> str: + """Given a string like "5a", bump it to "5b", or "6c" to "6d" """ + if len(step) == 0: + raise ValueError("Can't bump empty steps!") - def desc_TC_SWTCH_2_4(self) -> str: - """Returns a description of this test""" - return "[TC-SWTCH-2.4] Momentary Switch Long Press Verification" + end_char = step[-1] + if not end_char.isalpha(): + return step + "a" - # TODO(#34656): Fill test steps - # def steps_TC_SWTCH_2_4(self) -> list[TestStep]: - # steps = [ - # TestStep("0", "Commissioning, already done", is_commissioning=True), - # # TODO: fill when test is done - # ] + step_prefix = step[:-1] + next_end_char = chr(ord(end_char) + 1) + if ord(next_end_char) > ord('z'): + raise ValueError(f"Reached max substep for step '{step}'") + next_step = step_prefix + next_end_char - # return steps + return next_step + + +class TC_SwitchTests(MatterBaseTest): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._default_pressed_position = self.user_params.get("default_pressed_position", 1) def _send_named_pipe_command(self, command_dict: dict[str, Any]): app_pid = self.matter_test_config.app_pid @@ -164,14 +170,6 @@ def _ask_for_release(self): else: time.sleep(self.keep_pressed_delay/1000) - def _placeholder_for_step(self, step_id: str): - # TODO(#34656): Global search an replace of `self._placeholder_for_step` with `self.step` when done. - logging.info(f"Step {step_id}") - pass - - def _placeholder_for_skip(self, step_id: str): - logging.info(f"Skipped step {step_id}") - def _await_sequence_of_reports(self, report_queue: queue.Queue, endpoint_id: int, attribute: TypedAttributePath, sequence: list[Any], timeout_sec: float): start_time = time.time() elapsed = 0.0 @@ -269,93 +267,6 @@ def _expect_no_events_for_cluster(self, event_queue: queue.Queue, endpoint_id: i logging.info(f"Successfully waited for no further events on {expected_cluster} for {elapsed:.1f} seconds") - @per_endpoint_test(has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitch)) - async def test_TC_SWTCH_2_4(self): - # TODO(#34656): Make this come from PIXIT - switch_pressed_position = 1 - post_prompt_settle_delay_seconds = 10.0 - - # Commission DUT - already done - - # Read feature map to set bool markers - cluster = Clusters.Objects.Switch - feature_map = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.FeatureMap) - - has_ms_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitch) != 0 - has_msr_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchRelease) != 0 - has_msl_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchLongPress) != 0 - has_as_feature = (feature_map & cluster.Bitmaps.Feature.kActionSwitch) != 0 - # has_msm_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchMultiPress) != 0 - - if not has_ms_feature: - logging.info("Skipping rest of test: SWTCH.S.F01(MS) feature not present") - self.skip_all_remaining_steps("2") - - endpoint_id = self.matter_test_config.endpoint - - # Step 1: Set up subscription to all Switch cluster events - self._placeholder_for_step("1") - event_listener = EventChangeCallback(cluster) - attrib_listener = ClusterAttributeChangeAccumulator(cluster) - await event_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) - await attrib_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) - - # Step 2: Operator does not operate switch on the DUT - self._placeholder_for_step("2") - self._ask_for_switch_idle() - - # Step 3: TH reads the CurrentPosition attribute from the DUT - self._placeholder_for_step("3") - - # Verify that the value is 0 - current_position = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.CurrentPosition) - asserts.assert_equal(current_position, 0) - - # Step 4a: Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT, the release it - self._placeholder_for_step("4a") - self._ask_for_long_press(endpoint_id, switch_pressed_position, feature_map) - - # Step 4b: TH expects report of CurrentPosition 1, followed by a report of Current Position 0. - self._placeholder_for_step("4b") - logging.info( - f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for CurrentPosition to go {switch_pressed_position}, then 0.") - self._await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.CurrentPosition, sequence=[ - switch_pressed_position, 0], timeout_sec=post_prompt_settle_delay_seconds) - - # Step 4c: TH expects at least InitialPress with NewPosition = 1 - self._placeholder_for_step("4c") - logging.info(f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for InitialPress event.") - expected_events = [cluster.Events.InitialPress(newPosition=switch_pressed_position)] - self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, - sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) - - # Step 4d: For MSL/AS, expect to see LongPress/LongRelease in that order - if not has_msl_feature and not has_as_feature: - logging.info("Skipping Step 4d due to missing MSL and AS features") - self._placeholder_for_skip("4d") - else: - # Steb 4d: TH expects report of LongPress, LongRelease in that order. - self._placeholder_for_step("4d") - logging.info(f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for LongPress then LongRelease.") - expected_events = [] - expected_events.append(cluster.Events.LongPress(newPosition=switch_pressed_position)) - expected_events.append(cluster.Events.LongRelease(previousPosition=switch_pressed_position)) - self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, - sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) - - # Step 4e: For MS & (!MSL & !AS & !MSR), expect no further events for 10 seconds. - if not has_msl_feature and not has_as_feature and not has_msr_feature: - self._placeholder_for_step("4e") - self._expect_no_events_for_cluster(event_queue=event_listener.event_queue, - endpoint_id=endpoint_id, expected_cluster=cluster, timeout_sec=10.0) - - # Step 4f: For MSR & not MSL, expect to see ShortRelease. - if not has_msl_feature and has_msr_feature: - self._placeholder_for_step("4f") - expected_events = [cluster.Events.ShortRelease(previousPosition=switch_pressed_position)] - self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, - sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) - def _received_event(self, event_listener: EventChangeCallback, target_event: ClusterObjects.ClusterEvent, timeout_s: int) -> bool: """ Returns true if this event was received, false otherwise @@ -534,6 +445,104 @@ async def test_TC_SWTCH_2_3(self): button_val = await self.read_single_attribute_check_success(cluster=cluster, attribute=cluster.Attributes.CurrentPosition) asserts.assert_equal(button_val, 0, "Button value is not 0") + def desc_TC_SWTCH_2_4(self) -> str: + return "[TC-SWTCH-2.4] Momentary Switch Long Press Verification" + + def steps_TC_SWTCH_2_4(self): + return [TestStep(1, test_plan_support.commission_if_required(), "", is_commissioning=True), + TestStep(2, "Set up subscription to all events of Switch cluster on the endpoint"), + TestStep(3, "Operator does not operate switch on the DUT"), + TestStep(4, "TH reads the CurrentPosition attribute from the DUT", "Verify that the value is 0"), + TestStep(5, "Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT, the release it", + """ + * TH expects receiving a subscription report of CurrentPosition 1, followed by a report of Current Position 0. + * TH expects receiving at InitialPress event with NewPosition = 1. + * if MSL or AS feature is supported, TH expect receiving LongPress/LongRelease in that order. + * if MS & (!MSL & !AS & !MSR) features present, TH expects receiving no further events for 10 seconds after release. + * if (MSR & !MSL) features present, TH expects receiving ShortRelease event. + """) + ] + + @per_endpoint_test(has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitch)) + async def test_TC_SWTCH_2_4(self): + switch_pressed_position = self._default_pressed_position + post_prompt_settle_delay_seconds = 10.0 + + endpoint_id = self.matter_test_config.endpoint + cluster = Clusters.Objects.Switch + + # Step 1: Commission DUT - already done + self.step(1) + + # Read feature map to set bool markers + feature_map = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.FeatureMap) + + has_ms_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitch) != 0 + has_msr_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchRelease) != 0 + has_msl_feature = (feature_map & cluster.Bitmaps.Feature.kMomentarySwitchLongPress) != 0 + has_as_feature = (feature_map & cluster.Bitmaps.Feature.kActionSwitch) != 0 + + if not has_ms_feature: + logging.info("Skipping rest of test: SWTCH.S.F01(MS) feature not present") + self.skip_all_remaining_steps("2") + + # Step 2: Set up subscription to all events of Switch cluster on the endpoint + self.step(2) + event_listener = EventChangeCallback(cluster) + attrib_listener = ClusterAttributeChangeAccumulator(cluster) + await event_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) + await attrib_listener.start(self.default_controller, self.dut_node_id, endpoint=endpoint_id) + + # Step 3: Operator does not operate switch on the DUT + self.step(3) + self._ask_for_switch_idle() + + # Step 4: TH reads the CurrentPosition attribute from the DUT + self.step(4) + + # Verify that the value is 0 + current_position = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.CurrentPosition) + asserts.assert_equal(current_position, 0) + + # Step 5: Operator operates switch (keep pressed for long time, e.g. 5 seconds) on the DUT, the release it + self.step(5) + self._ask_for_long_press(endpoint_id, switch_pressed_position, feature_map) + + # - TH expects report of CurrentPosition 1, followed by a report of Current Position 0. + logging.info( + f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for CurrentPosition to go {switch_pressed_position}, then 0.") + self._await_sequence_of_reports(report_queue=attrib_listener.attribute_queue, endpoint_id=endpoint_id, attribute=cluster.Attributes.CurrentPosition, sequence=[ + switch_pressed_position, 0], timeout_sec=post_prompt_settle_delay_seconds) + + # - TH expects at least InitialPress with NewPosition = 1 + logging.info(f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for InitialPress event.") + expected_events = [cluster.Events.InitialPress(newPosition=switch_pressed_position)] + self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, + sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) + + # - if MSL or AS feature is supported, expect to see LongPress/LongRelease in that order. + if not has_msl_feature and not has_as_feature: + logging.info("Since MSL and AS features both unsupported, skipping check for LongPress/LongRelease") + else: + # - TH expects report of LongPress, LongRelease in that order. + logging.info(f"Starting to wait for {post_prompt_settle_delay_seconds:.1f} seconds for LongPress then LongRelease.") + expected_events = [] + expected_events.append(cluster.Events.LongPress(newPosition=switch_pressed_position)) + expected_events.append(cluster.Events.LongRelease(previousPosition=switch_pressed_position)) + self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, + sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) + + # - if MS & (!MSL & !AS & !MSR) features present, expect no further events for 10 seconds after release. + if not has_msl_feature and not has_as_feature and not has_msr_feature: + self._expect_no_events_for_cluster(event_queue=event_listener.event_queue, + endpoint_id=endpoint_id, expected_cluster=cluster, timeout_sec=10.0) + + # - if (MSR & !MSL) features present, expect to see ShortRelease event. + if not has_msl_feature and has_msr_feature: + expected_events = [cluster.Events.ShortRelease(previousPosition=switch_pressed_position)] + self._await_sequence_of_events(event_queue=event_listener.event_queue, endpoint_id=endpoint_id, + sequence=expected_events, timeout_sec=post_prompt_settle_delay_seconds) + def steps_TC_SWTCH_2_5(self): return [TestStep(1, test_plan_support.commission_if_required(), "", is_commissioning=True), TestStep(2, "Set up a subscription to all Switch cluster events"), @@ -638,7 +647,7 @@ async def test_TC_SWTCH_2_5(self): multi_press_max = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.MultiPressMax) endpoint_id = self.matter_test_config.endpoint - pressed_position = 1 + pressed_position = self._default_pressed_position self.step(2) event_listener = EventChangeCallback(cluster) @@ -657,27 +666,27 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = else: self._ask_for_multi_press(endpoint_id, number_of_presses=count, pressed_position=pressed_position, feature_map=feature_map, multi_press_max=multi_press_max) - for i in range(count): + for pos_idx in range(count): event = event_listener.wait_for_event_report(cluster.Events.InitialPress) asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") - if i > 0: + if pos_idx > 0: event = event_listener.wait_for_event_report(cluster.Events.MultiPressOngoing) asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on MultiPressOngoing") - asserts.assert_equal(event.currentNumberOfPressesCounted, i+1, + asserts.assert_equal(event.currentNumberOfPressesCounted, pos_idx + 1, "Unexpected CurrentNumberOfPressesCounted on MultiPressOngoing") event = event_listener.wait_for_event_report(cluster.Events.ShortRelease) asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on ShortRelease") - step = step[:-1] + chr(ord(step[-1])+1) + step = bump_substep(step) self.step(step) self._ask_for_switch_idle() event = event_listener.wait_for_event_report(cluster.Events.MultiPressComplete) asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on MultiPressComplete") asserts.assert_equal(event.totalNumberOfPressesCounted, count, "Unexpected count on MultiPressComplete") - test_multi_press_sequence("4a", 1) + test_multi_press_sequence("4a", count=1) - test_multi_press_sequence("5a", 2) + test_multi_press_sequence("5a", count=2) self.step("6a") multi_press_max = await self.read_single_attribute_check_success(cluster=cluster, attribute=cluster.Attributes.MultiPressMax) @@ -685,7 +694,7 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = self.skip_step("6b") self.skip_step("6c") else: - test_multi_press_sequence("6b", 3) + test_multi_press_sequence("6b", count=3) if not has_msl_feature: self.skip_all_remaining_steps(7) @@ -694,7 +703,7 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = self.step(7) # subscription is already set up - test_multi_press_sequence("8a", 2, short_long=True) + test_multi_press_sequence("8a", count=2, short_long=True) self.step("9a") self._ask_for_multi_press_long_short(endpoint_id, pressed_position, feature_map) @@ -813,7 +822,7 @@ async def test_TC_SWTCH_2_6(self): multi_press_max = await self.read_single_attribute_check_success(cluster, attribute=cluster.Attributes.MultiPressMax) endpoint_id = self.matter_test_config.endpoint - pressed_position = 1 + pressed_position = self._default_pressed_position self.step(2) event_listener = EventChangeCallback(cluster) @@ -836,7 +845,7 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = event = event_listener.wait_for_event_report(cluster.Events.InitialPress) asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on InitialEvent") - step = step[:-1] + chr(ord(step[-1])+1) + step = bump_substep(step) self.step(step) self._ask_for_switch_idle() event = event_listener.wait_for_event_report(cluster.Events.MultiPressComplete) @@ -844,11 +853,11 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = expected_count = 0 if count > multi_press_max else count asserts.assert_equal(event.totalNumberOfPressesCounted, expected_count, "Unexpected count on MultiPressComplete") - test_multi_press_sequence("4a", 1) + test_multi_press_sequence("4a", count=1) - test_multi_press_sequence("5a", 2) + test_multi_press_sequence("5a", count=2) - test_multi_press_sequence("6a", multi_press_max + 1) + test_multi_press_sequence("6a", count=(multi_press_max + 1)) self.step("7a") if not has_msl_feature: @@ -857,7 +866,7 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = # subscription is already established self.step("7b") - test_multi_press_sequence("8a", 2, short_long=True) + test_multi_press_sequence("8a", count=2, short_long=True) self.step("9a") self._ask_for_multi_press_long_short(endpoint_id, pressed_position, feature_map) From dc312d7fa3c6d5b8bd2a7aa6c484713297b71f67 Mon Sep 17 00:00:00 2001 From: Chris Letnick Date: Wed, 31 Jul 2024 13:17:01 -0700 Subject: [PATCH 36/63] Initial test script for Fabric Sync TC_MCORE_FS_1_2 (#34675) * Initial test script for Fabric Sync TC_MCORE_FS_1_2 * Apply suggestions from code review Co-authored-by: C Freeman * Address Review Comments * Address review comments * Fix default timeout after other timeouts changed * Restyled by autopep8 * Fix linter error --------- Co-authored-by: C Freeman Co-authored-by: Restyled.io --- src/python_testing/TC_MCORE_FS_1_2.py | 176 ++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 src/python_testing/TC_MCORE_FS_1_2.py diff --git a/src/python_testing/TC_MCORE_FS_1_2.py b/src/python_testing/TC_MCORE_FS_1_2.py new file mode 100644 index 00000000000000..0af8cbedb30345 --- /dev/null +++ b/src/python_testing/TC_MCORE_FS_1_2.py @@ -0,0 +1,176 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# TODO: add to CI. See https://github.com/project-chip/connectedhomeip/issues/34676 +# for details about the block below. +# + +import base64 +import logging +import queue +import time + +import chip.clusters as Clusters +from chip import ChipDeviceCtrl +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from TC_SC_3_6 import AttributeChangeAccumulator + + +class TC_MCORE_FS_1_2(MatterBaseTest): + def steps_TC_MCORE_FS_1_2(self) -> list[TestStep]: + steps = [TestStep(1, "TH_FSA subscribes to all the Bridged Device Basic Information clusters provided by DUT_FSA to identify the presence of a Bridged Node endpoint with a UniqueID matching the UniqueID provided by the BasicInformationCluster of the TH_SED_DUT."), + TestStep(2, "TH_FSA initiates commissioning of TH_SED_DUT by sending the OpenCommissioningWindow command to the Administrator Commissioning Cluster on the endpoint with the uniqueID matching that of TH_SED_DUT."), + TestStep(3, "TH_FSA completes commissioning of TH_SED_DUT using the Enhanced Commissioning Method."), + TestStep(4, "Commission TH_SED_L onto DUT_FSA’s fabric using the manufacturer specified mechanism."), + TestStep(5, "TH_FSA waits for subscription report from a the Bridged Device Basic Information clusters provided by DUT_FSA to identify the presence of a Bridged Node endpoint with a UniqueID matching the UniqueID provided by the BasicInformationCluster of the TH_SED_L."), + TestStep(6, "TH_FSA initiates commissions of TH_SED_L by sending the OpenCommissioningWindow command to the Administrator Commissioning Cluster on the endpoint with the uniqueID matching that of TH_SED_L."), + TestStep(7, "TH_FSA completes commissioning of TH_SED_L using the Enhanced Commissioning Method.")] + return steps + + @property + def default_timeout(self) -> int: + return self.user_params.get("report_waiting_timeout_delay_sec", 10)*2 + 60 + + @async_test_body + async def test_TC_MCORE_FS_1_2(self): + self.is_ci = self.check_pics('PICS_SDK_CI_ONLY') + min_report_interval_sec = self.user_params.get("min_report_interval_sec", 0) + max_report_interval_sec = self.user_params.get("max_report_interval_sec", 2) + report_waiting_timeout_delay_sec = self.user_params.get("report_waiting_timeout_delay_sec", 10) + + self.step(1) + + # Subscribe to the UniqueIDs + unique_id_queue = queue.Queue() + subscription_contents = [ + (Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID) # On all endpoints + ] + sub = await self.default_controller.ReadAttribute( + nodeid=self.dut_node_id, + attributes=subscription_contents, + reportInterval=(min_report_interval_sec, max_report_interval_sec), + keepSubscriptions=False + ) + attribute_handler = AttributeChangeAccumulator( + name=self.default_controller.name, expected_attribute=Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID, output=unique_id_queue) + sub.SetAttributeUpdateCallback(attribute_handler) + + logging.info("Waiting for First BridgedDeviceBasicInformation.") + start_time = time.time() + elapsed = 0 + time_remaining = report_waiting_timeout_delay_sec + + th_sed_dut_bdbi_endpoint = -1 + th_sed_dut_unique_id = -1 + + while time_remaining > 0 and th_sed_dut_bdbi_endpoint < 0: + try: + item = unique_id_queue.get(block=True, timeout=time_remaining) + endpoint, attribute, value = item['endpoint'], item['attribute'], item['value'] + + # Record arrival of an expected subscription change when seen + if attribute == Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID: + th_sed_dut_bdbi_endpoint = endpoint + th_sed_dut_unique_id = value + + except queue.Empty: + # No error, we update timeouts and keep going + pass + + elapsed = time.time() - start_time + time_remaining = report_waiting_timeout_delay_sec - elapsed + + asserts.assert_greater(th_sed_dut_bdbi_endpoint, 0, "Failed to find any BDBI instances with UniqueID present.") + logging.info("Found BDBI with UniqueID (%d) on endpoint %d." % th_sed_dut_unique_id, th_sed_dut_bdbi_endpoint) + + self.step(2) + + self.sync_passcode = 20202024 + self.th_sed_dut_discriminator = 2222 + cmd = Clusters.AdministratorCommissioning.Commands.OpenCommissioningWindow(commissioningTimeout=3*60, + PAKEPasscodeVerifier=b"+w1qZQR05Zn0bc2LDyNaDAhsrhDS5iRHPTN10+EmNx8E2OpIPC4SjWRDQVOgqcbnXdYMlpiZ168xLBqn1fx9659gGK/7f9Yc6GxpoJH8kwAUYAYyLGsYeEBt1kL6kpXjgA==", + discriminator=self.th_sed_dut_discriminator, + iterations=10000, salt=base64.b64encode(bytes('SaltyMcSalterson', 'utf-8'))) + await self.send_single_cmd(cmd, endpoint=th_sed_dut_bdbi_endpoint, timedRequestTimeoutMs=5000) + + logging.info("Commissioning Window open for TH_SED_DUT.") + + self.step(3) + + self.th_sed_dut_nodeid = 1111 + await self.TH_server_controller.CommissionOnNetwork(nodeId=self.th_sed_dut_nodeid, setupPinCode=self.sync_passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=self.th_sed_dut_discriminator) + logging.info("Commissioning TH_SED_DUT complete") + + self.step(4) + if not self.is_ci: + self.wait_for_use_input( + "Commission TH_SED_DUT onto DUT_FSA’s fabric using the manufacturer specified mechanism. (ensure Synchronization is enabled.)") + else: + logging.info("Stopping after step 3 while running in CI to avoid manual steps.") + return + + self.step(5) + + th_sed_later_bdbi_endpoint = -1 + th_sed_later_unique_id = -1 + logging.info("Waiting for Second BridgedDeviceBasicInformation.") + start_time = time.time() + elapsed = 0 + time_remaining = report_waiting_timeout_delay_sec + + while time_remaining > 0 and th_sed_later_bdbi_endpoint < 0: + try: + item = unique_id_queue.get(block=True, timeout=time_remaining) + endpoint, attribute, value = item['endpoint'], item['attribute'], item['value'] + + # Record arrival of an expected subscription change when seen + if attribute == Clusters.BridgedDeviceBasicInformation.Attributes.UniqueID and endpoint != th_sed_dut_bdbi_endpoint and th_sed_later_unique_id != th_sed_dut_unique_id: + th_sed_later_bdbi_endpoint = endpoint + th_sed_later_unique_id = value + + except queue.Empty: + # No error, we update timeouts and keep going + pass + + elapsed = time.time() - start_time + time_remaining = report_waiting_timeout_delay_sec - elapsed + + asserts.assert_greater(th_sed_later_bdbi_endpoint, 0, "Failed to find any BDBI instances with UniqueID present.") + logging.info("Found another BDBI with UniqueID (%d) on endpoint %d." % th_sed_later_unique_id, th_sed_later_bdbi_endpoint) + + self.step(6) + + self.th_sed_later_discriminator = 3333 + # min commissioning timeout is 3*60 seconds, so use that even though the command said 30. + cmd = Clusters.AdministratorCommissioning.Commands.OpenCommissioningWindow(commissioningTimeout=3*60, + PAKEPasscodeVerifier=b"+w1qZQR05Zn0bc2LDyNaDAhsrhDS5iRHPTN10+EmNx8E2OpIPC4SjWRDQVOgqcbnXdYMlpiZ168xLBqn1fx9659gGK/7f9Yc6GxpoJH8kwAUYAYyLGsYeEBt1kL6kpXjgA==", + discriminator=self.th_sed_later_discriminator, + iterations=10000, salt=base64.b64encode(bytes('SaltyMcSalterson', 'utf-8'))) + await self.send_single_cmd(cmd, endpoint=th_sed_later_bdbi_endpoint, timedRequestTimeoutMs=5000) + + logging.info("Commissioning Window open for TH_SED_L.") + + self.step(7) + + self.th_sed_later_nodeid = 2222 + await self.TH_server_controller.CommissionOnNetwork(nodeId=self.th_sed_later_nodeid, setupPinCode=self.sync_passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=self.th_sed_later_discriminator) + logging.info("Commissioning TH_SED_L complete") + + +if __name__ == "__main__": + default_matter_test_main() From ad792f16dc36aa2a8a2aa2d68e94526ef42e0ab4 Mon Sep 17 00:00:00 2001 From: Douglas Rocha Ferraz Date: Wed, 31 Jul 2024 16:19:41 -0400 Subject: [PATCH 37/63] Test automation for FabricSync ICD BridgedDeviceBasicInfoCluster (#34628) * WIP Bridged ICD, commissioning to both fabrics * wip testing sending KeepActive * wip most steps implemented * using SIGSTOP and SIGCONT to control ICD server pausing * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * comments addressed * more comments addressed * lint pass * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: C Freeman * comments addressed, incl TH_SERVER configurable * added setupQRCode and setupManualCode as options for DUT commissioning * Restyled by autopep8 * Restyled by isort * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * Update src/python_testing/TC_BRBINFO_4_1.py Co-authored-by: Terence Hampson * comments addressed * Restyled by autopep8 --------- Co-authored-by: Terence Hampson Co-authored-by: C Freeman Co-authored-by: Restyled.io --- src/python_testing/TC_BRBINFO_4_1.py | 275 +++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 src/python_testing/TC_BRBINFO_4_1.py diff --git a/src/python_testing/TC_BRBINFO_4_1.py b/src/python_testing/TC_BRBINFO_4_1.py new file mode 100644 index 00000000000000..6c65f634bb6a7b --- /dev/null +++ b/src/python_testing/TC_BRBINFO_4_1.py @@ -0,0 +1,275 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This test requires a TH_SERVER application. Please specify with --string-arg th_server_app_path: +# TH_SERVER must support following arguments: --secured-device-port --discriminator --passcode --KVS +# E.g: python3 src/python_testing/TC_BRBINFO_4_1.py --commissioning-method on-network --qr-code MT:-24J042C00KA0648G00 \ +# --string-arg th_server_app_path:out/linux-x64-lit-icd/lit-icd-app + +import logging +import os +import queue +import signal +import subprocess +import time +import uuid + +import chip.clusters as Clusters +from chip import ChipDeviceCtrl +from matter_testing_support import MatterBaseTest, SimpleEventCallback, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) +_ROOT_ENDPOINT_ID = 0 + + +class TC_BRBINFO_4_1(MatterBaseTest): + + # + # Class Helper functions + # + + async def _read_attribute_expect_success(self, endpoint, cluster, attribute, node_id): + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute, node_id=node_id) + + # Override default timeout to support a 60 min wait + @property + def default_timeout(self) -> int: + return 63*60 + + def desc_TC_BRBINFO_4_1(self) -> str: + """Returns a description of this test""" + return "[TC_BRBINFO_4_1] Verification of KeepActive Command [DUT-Server]" + + def steps_TC_BRBINFO_4_1(self) -> list[TestStep]: + steps = [ + TestStep("0", "Preconditions"), + TestStep("1a", "TH reads from the ICD the A_IDLE_MODE_DURATION, A_ACTIVE_MODE_DURATION, and ACTIVE_MODE_THRESHOLD attributes"), + TestStep("1b", "Simple KeepActive command w/ subscription. ActiveChanged event received by TH contains PromisedActiveDuration"), + TestStep("2", "Sends 3x KeepActive commands w/ subscription. ActiveChanged event received ONCE and contains PromisedActiveDuration"), + TestStep("3", "KeepActive not returned after 60 minutes of offline ICD"), + ] + return steps + + def _ask_for_vendor_commissioniong_ux_operation(self, discriminator, setupPinCode, setupManualCode, setupQRCode): + self.wait_for_user_input( + prompt_msg=f"Using the DUT vendor's provided interface, commission the ICD device using the following parameters:\n" + f"- discriminator: {discriminator}\n" + f"- setupPinCode: {setupPinCode}\n" + f"- setupQRCode: {setupQRCode}\n" + f"- setupManualcode: {setupManualCode}\n" + f"If using FabricSync Admin test app, you may type:\n" + f">>> pairing onnetwork 111 {setupPinCode}") + + async def _send_keep_active_command(self, duration, endpoint_id) -> int: + logging.info("Sending keep active command") + keep_active = await self.default_controller.SendCommand(nodeid=self.dut_node_id, endpoint=endpoint_id, payload=Clusters.Objects.BridgedDeviceBasicInformation.Commands.KeepActive(stayActiveDuration=duration)) + return keep_active + + async def _wait_for_active_changed_event(self, timeout) -> int: + try: + promised_active_duration = self.q.get(block=True, timeout=timeout) + logging.info(f"PromisedActiveDuration: {promised_active_duration}") + return promised_active_duration + except queue.Empty: + asserts.fail("Timeout on event ActiveChanged") + + async def _get_dynamic_endpoint(self) -> int: + root_part_list = await self.read_single_attribute_check_success(cluster=Clusters.Descriptor, attribute=Clusters.Descriptor.Attributes.PartsList, endpoint=_ROOT_ENDPOINT_ID) + set_of_endpoints_after_adding_device = set(root_part_list) + + asserts.assert_true(set_of_endpoints_after_adding_device.issuperset( + self.set_of_dut_endpoints_before_adding_device), "Expected only new endpoints to be added") + unique_endpoints_set = set_of_endpoints_after_adding_device - self.set_of_dut_endpoints_before_adding_device + asserts.assert_equal(len(unique_endpoints_set), 1, "Expected only one new endpoint") + newly_added_endpoint = list(unique_endpoints_set)[0] + return newly_added_endpoint + + @async_test_body + async def setup_class(self): + # These steps are not explicitly, but they help identify the dynamically added endpoint + # The second part of this process happens on _get_dynamic_endpoint() + root_part_list = await self.read_single_attribute_check_success(cluster=Clusters.Descriptor, attribute=Clusters.Descriptor.Attributes.PartsList, endpoint=_ROOT_ENDPOINT_ID) + self.set_of_dut_endpoints_before_adding_device = set(root_part_list) + + super().setup_class() + app = self.user_params.get("th_server_app_path", None) + if not app: + asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') + + self.kvs = f'kvs_{str(uuid.uuid4())}' + self.port = 5543 + discriminator = 3850 + passcode = 20202021 + app_args = f'--secured-device-port {self.port} --discriminator {discriminator} --passcode {passcode} --KVS {self.kvs} ' + cmd = f'{app} {app_args}' + + logging.info("Starting ICD Server App") + self.app_process = subprocess.Popen(cmd, bufsize=0, shell=True) + logging.info("ICD started") + time.sleep(3) + + logging.info("Commissioning of ICD to fabric one (TH)") + self.icd_nodeid = 1111 + + await self.default_controller.CommissionOnNetwork(nodeId=self.icd_nodeid, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) + + logging.info("Commissioning of ICD to fabric two (DUT)") + params = await self.openCommissioningWindow(dev_ctrl=self.default_controller, node_id=self.icd_nodeid) + + self._ask_for_vendor_commissioniong_ux_operation(params.randomDiscriminator, params.commissioningParameters.setupPinCode, + params.commissioningParameters.setupManualCode, params.commissioningParameters.setupQRCode) + + def teardown_class(self): + logging.warning("Stopping app with SIGTERM") + self.app_process.send_signal(signal.SIGTERM.value) + self.app_process.wait() + os.remove(self.kvs) + super().teardown_class() + + # + # BRBINFO 4.1 Test Body + # + + @async_test_body + async def test_TC_BRBINFO_4_1(self): + self.is_ci = self.check_pics('PICS_SDK_CI_ONLY') + icdm_cluster = Clusters.Objects.IcdManagement + icdm_attributes = icdm_cluster.Attributes + brb_info_cluster = Clusters.Objects.BridgedDeviceBasicInformation + basic_info_cluster = Clusters.Objects.BasicInformation + basic_info_attributes = basic_info_cluster.Attributes + + dynamic_endpoint_id = await self._get_dynamic_endpoint() + logging.info(f"Dynamic endpoint is {dynamic_endpoint_id}") + + # Preconditions + self.step("0") + + logging.info("Ensuring DUT is commissioned to TH") + + # Confirms commissioning of DUT on TH as it reads its fature map + await self._read_attribute_expect_success( + _ROOT_ENDPOINT_ID, + basic_info_cluster, + basic_info_attributes.FeatureMap, + self.dut_node_id + ) + + logging.info("Ensuring ICD is commissioned to TH") + + # Confirms commissioning of ICD on TH as it reads its feature map + await self._read_attribute_expect_success( + _ROOT_ENDPOINT_ID, + basic_info_cluster, + basic_info_attributes.FeatureMap, + self.icd_nodeid + ) + + self.step("1a") + + idle_mode_duration = await self._read_attribute_expect_success( + _ROOT_ENDPOINT_ID, + icdm_cluster, + icdm_attributes.IdleModeDuration, + self.icd_nodeid + ) + logging.info(f"IdleModeDuration: {idle_mode_duration}") + + active_mode_duration = await self._read_attribute_expect_success( + _ROOT_ENDPOINT_ID, + icdm_cluster, + icdm_attributes.ActiveModeDuration, + self.icd_nodeid + ) + logging.info(f"ActiveModeDuration: {active_mode_duration}") + + self.step("1b") + + # Subscription to ActiveChanged + event = brb_info_cluster.Events.ActiveChanged + self.q = queue.Queue() + urgent = 1 + cb = SimpleEventCallback("ActiveChanged", event.cluster_id, event.event_id, self.q) + subscription = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=[(dynamic_endpoint_id, event, urgent)], reportInterval=[1, 3]) + subscription.SetEventUpdateCallback(callback=cb) + + stay_active_duration = 1000 + logging.info(f"Sending KeepActiveCommand({stay_active_duration}ms)") + self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) + + logging.info("Waiting for ActiveChanged from DUT...") + promised_active_duration = await self._wait_for_active_changed_event((idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000) + + asserts.assert_greater_equal(promised_active_duration, stay_active_duration, "PromisedActiveDuration < StayActiveDuration") + + self.step("2") + + stay_active_duration = 1500 + logging.info(f"Sending KeepActiveCommand({stay_active_duration}ms)") + self._send_keep_active_command(stay_active_duration) + + logging.info("Waiting for ActiveChanged from DUT...") + promised_active_duration = await self._wait_for_active_changed_event((idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000) + + # wait for active time duration + time.sleep(max(stay_active_duration/1000, promised_active_duration)) + # ICD now should be in idle mode + + # sends 3x keep active commands + logging.info(f"Sending KeepActiveCommand({stay_active_duration})") + self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) + time.sleep(100) + logging.info(f"Sending KeepActiveCommand({stay_active_duration})") + self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) + time.sleep(100) + logging.info(f"Sending KeepActiveCommand({stay_active_duration})") + self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) + time.sleep(100) + + logging.info("Waiting for ActiveChanged from DUT...") + promised_active_duration = await self._wait_for_active_changed_event((idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000) + + asserts.assert_equal(self.q.qSize(), 0, "More than one event received from DUT") + + self.step("3") + + stay_active_duration = 10000 + logging.info(f"Sending KeepActiveCommand({stay_active_duration})") + self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) + + # stops (halts) the ICD server process by sending a SIGTOP signal + self.app_process.send_signal(signal.SIGSTOP.value) + + if not self.is_ci: + logging.info("Waiting for 60 minutes") + self._timeout + time.sleep(60*60) + + # resumes (continues) the ICD server process by sending a SIGCONT signal + self.app_process.send_signal(signal.SIGCONT.value) + + # wait for active changed event, expect no event will be sent + event_timeout = (idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000 + try: + promised_active_duration = self.q.get(block=True, timeout=event_timeout) + finally: + asserts.assert_true(queue.Empty(), "ActiveChanged event received when not expected") + + +if __name__ == "__main__": + default_matter_test_main() From 60d0429e537fa64e2b5754c224f7c1ae104948d9 Mon Sep 17 00:00:00 2001 From: Petru Lauric <81822411+plauric@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:24:17 -0400 Subject: [PATCH 38/63] ServiceArea test scripts (#34548) * initial commit * fix bugs * fix issues reported by the linter * fix bug in checking for unique areaDesc * add TC 1.5 * Update src/python_testing/TC_SEAR_1_2.py Co-authored-by: William * Update src/python_testing/TC_SEAR_1_2.py Co-authored-by: William * address code review comments * fix issue introduced by the previous commit * address code review feedback * Update src/python_testing/TC_SEAR_1_2.py Co-authored-by: Kiel Oleson * address code review feedback * remove PICS checked by the TC_SEAR_1.6 * more code review updates * Restyled by autopep8 --------- Co-authored-by: William Co-authored-by: Kiel Oleson Co-authored-by: Restyled.io --- src/python_testing/TC_SEAR_1_2.py | 368 ++++++++++++++++++++++++++++++ src/python_testing/TC_SEAR_1_3.py | 155 +++++++++++++ src/python_testing/TC_SEAR_1_4.py | 84 +++++++ src/python_testing/TC_SEAR_1_5.py | 283 +++++++++++++++++++++++ src/python_testing/TC_SEAR_1_6.py | 148 ++++++++++++ 5 files changed, 1038 insertions(+) create mode 100644 src/python_testing/TC_SEAR_1_2.py create mode 100644 src/python_testing/TC_SEAR_1_3.py create mode 100644 src/python_testing/TC_SEAR_1_4.py create mode 100644 src/python_testing/TC_SEAR_1_5.py create mode 100644 src/python_testing/TC_SEAR_1_6.py diff --git a/src/python_testing/TC_SEAR_1_2.py b/src/python_testing/TC_SEAR_1_2.py new file mode 100644 index 00000000000000..4ebb3342ee9bfc --- /dev/null +++ b/src/python_testing/TC_SEAR_1_2.py @@ -0,0 +1,368 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# TODO - this was copied/pasted from another test, it needs to be reviewed and updated +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${CHIP_RVC_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +from time import sleep + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_SEAR_1_2(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = None + self.is_ci = False + self.app_pipe = "/tmp/chip_rvc_fifo_" + self.mapid_list = [] + + # this must be kept in sync with the definitions from the Common Landmark Semantic Tag Namespace + self.MAX_LANDMARK_ID = 0x33 + + # this must be kept in sync with the definitions from the Common Relative Position Semantic Tag Namespace + self.MAX_RELPOS_ID = 0x07 + + async def read_sear_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.ServiceArea + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + async def read_and_validate_supported_maps(self, step): + self.print_step(step, "Read SupportedMaps attribute") + supported_maps = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedMaps) + logging.info("SupportedMaps: %s" % (supported_maps)) + asserts.assert_less_equal(len(supported_maps), 255, + "SupportedMaps should have max 255 entries") + + mapid_list = [m.mapID for m in supported_maps] + asserts.assert_true(len(set(mapid_list)) == len(mapid_list), "SupportedMaps must have unique MapID values!") + + name_list = [m.name for m in supported_maps] + asserts.assert_true(len(set(name_list)) == len(name_list), "SupportedMaps must have unique Name values!") + + # save so other methods can use this if neeeded + self.mapid_list = mapid_list + + async def read_and_validate_supported_areas(self, step): + self.print_step(step, "Read SupportedAreas attribute") + supported_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedAreas) + logging.info("SupportedAreas: %s" % (supported_areas)) + asserts.assert_less_equal(len(supported_areas), 255, + "SupportedAreas should have max 255 entries") + areaid_list = [] + areadesc_s = set() + for a in supported_areas: + asserts.assert_true(a.areaID not in areaid_list, "SupportedAreas must have unique AreaID values!") + + areaid_list.append(a.areaID) + + if len(self.mapid_list) > 0: + asserts.assert_is_not(a.mapID, NullValue, + f"SupportedAreas entry with AreaID({a.areaID}) should not have null MapID") + asserts.assert_is(a.mapID in self.mapid_list, + f"SupportedAreas entry with AreaID({a.areaID}) has unknown MapID({a.mapID})") + k = f"mapID:{a.mapID} areaDesc:{a.areaDesc}" + asserts.assert_true(k not in areadesc_s, + f"SupportedAreas must have unique MapID({a.mapID}) + AreaDesc({a.areaDesc}) values!") + areadesc_s.add(k) + else: + # empty SupportedMaps + asserts.assert_is(a.mapID, NullValue, + f"SupportedAreas entry with AreaID({a.areaID}) should have null MapID") + k = f"areaDesc:{a.areaDesc}" + asserts.assert_true(k not in areadesc_s, f"SupportedAreas must have unique AreaDesc({a.areaDesc}) values!") + areadesc_s.add(k) + + if a.locationInfo is NullValue and a.landmarkTag is NullValue: + asserts.assert_true( + f"SupportedAreas entry with AreaID({a.areaID}) should not have null LocationInfo and null LandmarkTag") + if a.landmarkTag is not NullValue: + asserts.assert_true(a.landmarkTag <= self.MAX_LANDMARK_ID, + f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.landmarkTag})") + asserts.assert_true(a.positionTag is NullValue or a.positionTag in range(0, self.MAX_RELPOS_ID), + f"SupportedAreas entry with AreaID({a.areaID}) has invalid PositionTag({a.positionTag})") + # save so other methods can use this if neeeded + self.areaid_list = areaid_list + + async def read_and_validate_selected_areas(self, step): + self.print_step(step, "Read SelectedAreas attribute") + selected_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SelectedAreas) + logging.info(f"SelectedAreas {selected_areas}") + + # TODO how to check if all entries are uint32? + + asserts.assert_true(len(selected_areas) <= len(self.areaid_list), + f"SelectedAreas(len {len(selected_areas)}) should have at most {len(self.areaid_list)} entries") + + asserts.assert_true(len(set(selected_areas)) == len(selected_areas), "SelectedAreas must have unique AreaID values!") + + for a in selected_areas: + asserts.assert_true(a in self.areaid_list, + f"SelectedAreas entry {a} has invalid value") + # save so other methods can use this if neeeded + self.selareaid_list = selected_areas + + async def read_and_validate_current_area(self, step): + self.print_step(step, "Read CurrentArea attribute") + current_area = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.CurrentArea) + logging.info(f"CurrentArea {current_area}") + + asserts.assert_true((len(self.selareaid_list) == 0 and current_area is NullValue) + or + current_area in self.selareaid_list, + f"CurrentArea {current_area} is invalid. SelectedAreas is {self.selareaid_list}.") + # save so other methods can use this if neeeded + self.current_area = current_area + + async def read_and_validate_estimated_end_time(self, step): + import time + read_time = int(time.time()) + self.print_step(step, "Read EstimatedEndTime attribute") + estimated_end_time = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.EstimatedEndTime) + logging.info(f"EstimatedEndTime {estimated_end_time}") + + if self.current_area is NullValue: + asserts.assert_true(estimated_end_time is NullValue, + "EstimatedEndTime should be null if CurrentArea is null.") + else: + # allow for some clock skew + asserts.assert_true(estimated_end_time >= read_time - 3*60, + f"EstimatedEndTime({estimated_end_time}) should be greater than the time when it was read({read_time})") + + async def read_and_validate_progress(self, step): + self.print_step(step, "Read Progress attribute") + progress = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress) + logging.info(f"Progress {progress}") + + asserts.assert_true(len(progress) <= len(self.areaid_list), + f"Progress(len {len(progress)}) should have at most {len(self.areaid_list)} entries") + + progareaid_list = [] + for p in progress: + if p.areaID in progareaid_list: + asserts.fail("Progress must have unique AreaID values!") + else: + progareaid_list.append(p.areaID) + asserts.assert_true(p.areaID in self.areaid_list, + f"Progress entry has invalid AreaID value ({p.areaID})") + asserts.assert_true(p.status in (Clusters.ServiceArea.OperationalStatusEnum.kPending, + Clusters.ServiceArea.OperationalStatusEnum.kOperating, + Clusters.ServiceArea.OperationalStatusEnum.kSkipped, + Clusters.ServiceArea.OperationalStatusEnum.kCompleted), + f"Progress entry has invalid Status value ({p.status})") + if p.status not in (Clusters.ServiceArea.OperationalStatusEnum.kSkipped, Clusters.ServiceArea.OperationalStatusEnum.kCompleted): + asserts.assert_true(p.totalOperationalTime is NullValue, + f"Progress entry should have a null TotalOperationalTime value (Status is {p.status})") + # TODO how to check that InitialTimeEstimate is either null or uint32? + + # Sends and out-of-band command to the rvc-app + def write_to_app_pipe(self, command): + with open(self.app_pipe, "w") as app_pipe: + app_pipe.write(command + "\n") + # Allow some time for the command to take effect. + # This removes the test flakyness which is very annoying for everyone in CI. + sleep(0.001) + + def TC_SEAR_1_2(self) -> list[str]: + return ["SEAR.S"] + + @async_test_body + async def test_TC_SEAR_1_2(self): + self.endpoint = self.matter_test_config.endpoint + asserts.assert_false(self.endpoint is None, "--endpoint must be included on the command line in.") + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + if self.is_ci: + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") + self.app_pipe = self.app_pipe + str(app_pid) + + self.print_step(1, "Commissioning, already done") + + # Ensure that the device is in the correct state + if self.is_ci: + self.write_to_app_pipe('{"Name": "Reset"}') + + if self.check_pics("SEAR.S.F02"): + await self.read_and_validate_supported_maps(step=2) + + await self.read_and_validate_supported_areas(step=3) + + await self.read_and_validate_selected_areas(step=4) + + if self.check_pics("SEAR.S.A0003"): + await self.read_and_validate_current_area(step=5) + + if self.check_pics("SEAR.S.A0004"): + await self.read_and_validate_estimated_end_time(step=6) + + if self.check_pics("SEAR.S.A0005"): + await self.read_and_validate_progress(step=7) + + if self.check_pics("SEAR.S.F02") and self.check_pics("SEAR.S.M.REMOVE_MAP"): + test_step = "Manually ensure the SupportedMaps attribute is not empty and that the device is not operating" + self.print_step("8", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_maps(step=9) + old_supported_maps = self.mapid_list + + test_step = "Manually intervene to remove one or more entries in the SupportedMaps list" + self.print_step("10", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_maps(step=11) + new_supported_maps = self.mapid_list + asserts.assert_true(len(old_supported_maps) > len(new_supported_maps), "Failed to remove map(s)") + + # NOTE the following operations are all part of step 11 - read all these attributes and check the data consistency + # after removing map(s) + await self.read_and_validate_supported_areas(step=11) + + await self.read_and_validate_selected_areas(step=11) + + if self.check_pics("SEAR.S.A0003"): + await self.read_and_validate_current_area(step=11) + + if self.check_pics("SEAR.S.A0004"): + await self.read_and_validate_estimated_end_time(step=11) + + if self.check_pics("SEAR.S.A0005"): + await self.read_and_validate_progress(step=11) + + if self.check_pics("SEAR.S.F02") and self.check_pics("SEAR.S.M.ADD_MAP"): + test_step = "Manually ensure the SupportedMaps attribute has less than 255 entries and that the device is not operating" + self.print_step("12", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_maps(step=13) + old_supported_maps = self.mapid_list + + test_step = "Manually intervene to add one or more entries to the SupportedMaps list" + self.print_step("14", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_maps(step=15) + new_supported_maps = self.mapid_list + asserts.assert_true(len(old_supported_maps) < len(new_supported_maps), "Failed to add map(s)") + + # NOTE the following operations are all part of step 15 - read all these attributes and check the data consistency + # after adding map(s) + await self.read_and_validate_supported_areas(step=15) + + await self.read_and_validate_selected_areas(step=15) + + if self.check_pics("SEAR.S.A0003"): + await self.read_and_validate_current_area(step=15) + + if self.check_pics("SEAR.S.A0004"): + await self.read_and_validate_estimated_end_time(step=15) + + if self.check_pics("SEAR.S.A0005"): + await self.read_and_validate_progress(step=15) + + if self.check_pics("SEAR.S.M.REMOVE_AREA"): + test_step = "Manually ensure the SupportedAreas attribute is not empty and that the device is not operating" + self.print_step("16", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_areas(step=17) + old_supported_areas = self.areaid_list + + test_step = "Manually intervene to remove one or more entries from the SupportedAreas list" + self.print_step("18", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_areas(step=19) + new_supported_areas = self.areaid_list + asserts.assert_true(len(old_supported_areas) > len(new_supported_areas), "Failed to remove area(s)") + + # NOTE the following operations are all part of step 19 - read all these attributes and check the data consistency + # after removing areas(s) + + await self.read_and_validate_selected_areas(step=19) + + if self.check_pics("SEAR.S.A0003"): + await self.read_and_validate_current_area(step=19) + + if self.check_pics("SEAR.S.A0004"): + await self.read_and_validate_estimated_end_time(step=19) + + if self.check_pics("SEAR.S.A0005"): + await self.read_and_validate_progress(step=19) + + if self.check_pics("SEAR.S.M.ADD_AREA"): + test_step = "Manually ensure the SupportedAreas attribute has less than 255 entries and that the device is not operating" + self.print_step("20", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_areas(step=21) + old_supported_areas = self.areaid_list + + test_step = "Manually intervene to add one or more entries to the SupportedAreas list" + self.print_step("22", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.read_and_validate_supported_areas(step=23) + new_supported_areas = self.areaid_list + asserts.assert_true(len(old_supported_areas) < len(new_supported_areas), "Failed to add area(s)") + + # NOTE the following operations are all part of step 23 - read all these attributes and check the data consistency + # after removing areas(s) + + await self.read_and_validate_selected_areas(step=23) + + if self.check_pics("SEAR.S.A0003"): + await self.read_and_validate_current_area(step=23) + + if self.check_pics("SEAR.S.A0004"): + await self.read_and_validate_estimated_end_time(step=23) + + if self.check_pics("SEAR.S.A0005"): + await self.read_and_validate_progress(step=23) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_SEAR_1_3.py b/src/python_testing/TC_SEAR_1_3.py new file mode 100644 index 00000000000000..0acee1b34cdeb8 --- /dev/null +++ b/src/python_testing/TC_SEAR_1_3.py @@ -0,0 +1,155 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# TODO - this was copied/pasted from abother test, it needs to be reviewed and updated +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${CHIP_RVC_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +from time import sleep + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_SEAR_1_3(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = None + self.is_ci = False + self.app_pipe = "/tmp/chip_rvc_fifo_" + + async def read_sear_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.ServiceArea + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + async def read_supported_areas(self, step): + self.print_step(step, "Read SupportedAreas attribute") + supported_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedAreas) + logging.info("SupportedAreas: %s" % (supported_areas)) + + return [a.areaID for a in supported_areas] + + async def read_selected_areas(self, step): + self.print_step(step, "Read SelectedAreas attribute") + selected_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SelectedAreas) + logging.info(f"SelectedAreas {selected_areas}") + + return selected_areas + + async def send_cmd_select_areas_expect_response(self, step, new_areas, expected_response): + self.print_step(step, f"Send SelectAreas command with NewAreas({new_areas})") + ret = await self.send_single_cmd(cmd=Clusters.Objects.ServiceArea.Commands.SelectAreas(newAreas=new_areas), + endpoint=self.endpoint) + + asserts.assert_equal(ret.commandResponseState.errorStateID, + expected_response, + f"Command response ({ret.commandResponseState}) doesn't match the expected one") + + # Sends and out-of-band command to the rvc-app + def write_to_app_pipe(self, command): + with open(self.app_pipe, "w") as app_pipe: + app_pipe.write(command + "\n") + # Allow some time for the command to take effect. + # This removes the test flakyness which is very annoying for everyone in CI. + sleep(0.001) + + def TC_SEAR_1_3(self) -> list[str]: + return ["SEAR.S"] + + @async_test_body + async def test_TC_SEAR_1_3(self): + self.endpoint = self.matter_test_config.endpoint + asserts.assert_false(self.endpoint is None, "--endpoint must be included on the command line in.") + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + if self.is_ci: + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") + self.app_pipe = self.app_pipe + str(app_pid) + + self.print_step(1, "Commissioning, already done") + + # Ensure that the device is in the correct state + if self.is_ci: + self.write_to_app_pipe('{"Name": "Reset"}') + + supported_area_ids = await self.read_supported_areas(step=2) + asserts.assert_true(len(self.supported_areas) > 0, "SupportedAreas is empty") + valid_area_id = supported_area_ids[0] + invalid_area_id = 1 + max(supported_area_ids) + + duplicated_areas = [valid_area_id, valid_area_id] + + # FIXME need to check if this is the correct name of this status code + await self.send_cmd_select_areas_expect_response(step=3, new_areas=duplicated_areas, expected_response=Clusters.ServiceArea.SelectAreasStatus.kDuplicatedAreas) + + await self.send_cmd_select_areas_expect_response(step=4, new_areas=[], expected_response=Clusters.ServiceArea.SelectAreasStatus.kSuccess) + + selected_areas = await self.read_selected_areas(step=5) + asserts.assert_true(len(selected_areas) == 0, "SelectedAreas should be empty") + + await self.send_cmd_select_areas_expect_response(step=6, new_areas=[invalid_area_id], expected_response=Clusters.ServiceArea.SelectAreasStatus.kUnsupportedArea) + + if self.check_pics("SEAR.S.M.INVALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL"): + test_step = "Manually intervene to put the device in a state that prevents it from executing the SelectAreas command" + self.print_step("7", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.send_cmd_select_areas_expect_response(step=8, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.SelectAreasStatus.kInvalidInMode) + + if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL"): + test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({supported_area_ids}) command" + self.print_step("9", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.send_cmd_select_areas_expect_response(step=10, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.SelectAreasStatus.kSuccess) + + selected_areas = await self.read_selected_areas(step=11) + asserts.assert_true(len(selected_areas) == len(supported_area_ids), + f"SelectedAreas({selected_areas}) should match SupportedAreas({supported_area_ids})") + + await self.send_cmd_select_areas_expect_response(step=12, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.SelectAreasStatus.kSuccess) + + if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL") and self.check_pics("SEAR.S.M.SELECT_AREAS_WHILE_NON_IDLE"): + test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({valid_area_id}) command, and put the device in a non-idle state" + self.print_step("13", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + if self.check_pics("SEAR.S.F00"): + await self.send_cmd_select_areas_expect_response(step=14, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.SelectAreasStatus.kSuccess) + else: + await self.send_cmd_select_areas_expect_response(step=14, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.SelectAreasStatus.kInvalidInMode) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_SEAR_1_4.py b/src/python_testing/TC_SEAR_1_4.py new file mode 100644 index 00000000000000..a6326559beaa20 --- /dev/null +++ b/src/python_testing/TC_SEAR_1_4.py @@ -0,0 +1,84 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# TODO - this was copied/pasted from abother test, it needs to be reviewed and updated +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${CHIP_RVC_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_SEAR_1_4(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = None + self.is_ci = False + self.app_pipe = "/tmp/chip_rvc_fifo_" + + async def read_sear_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.ServiceArea + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + def TC_SEAR_1_4(self) -> list[str]: + return ["SEAR.S"] + + @async_test_body + async def test_TC_SEAR_1_4(self): + self.endpoint = self.matter_test_config.endpoint + asserts.assert_false(self.endpoint is None, "--endpoint must be included on the command line in.") + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + if self.is_ci: + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") + self.app_pipe = self.app_pipe + str(app_pid) + + self.print_step(1, "Commissioning, already done") + + # Ensure that the device is in the correct state + if self.is_ci: + self.write_to_app_pipe('{"Name": "Reset"}') + + attribute_list = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) + logging.info("AttributeList: %s" % (attribute_list)) + + if Clusters.ServiceArea.Attributes.CurrentArea not in attribute_list \ + and Clusters.ServiceArea.Attributes.Progress not in attribute_list: + + cmd_list = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AcceptedCommandList) + logging.info("AcceptedCommandList: %s" % (cmd_list)) + asserts.assert_true(Clusters.ServiceArea.Commands.SkipArea not in cmd_list, + "SkipArea command should not be implemented if both CurrentArea and Progress are not") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py new file mode 100644 index 00000000000000..adcf8341c93389 --- /dev/null +++ b/src/python_testing/TC_SEAR_1_5.py @@ -0,0 +1,283 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# TODO - this was copied/pasted from abother test, it needs to be reviewed and updated +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${CHIP_RVC_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +from time import sleep + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_SEAR_1_5(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = None + self.is_ci = False + self.app_pipe = "/tmp/chip_rvc_fifo_" + + async def read_sear_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.ServiceArea + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + async def read_supported_areas(self, step): + self.print_step(step, "Read SupportedAreas attribute") + supported_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedAreas) + logging.info("SupportedAreas: %s" % (supported_areas)) + + return [a.areaID for a in supported_areas] + + async def read_selected_areas(self, step): + self.print_step(step, "Read SelectedAreas attribute") + selected_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SelectedAreas) + logging.info(f"SelectedAreas {selected_areas}") + + return selected_areas + + async def read_progress(self, step): + self.print_step(step, "Read Progress attribute") + progress = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress) + logging.info(f"Progress {progress}") + + return progress + + async def read_current_area(self, step): + self.print_step(step, "Read CurrentArea attribute") + current_area = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.CurrentArea) + logging.info(f"CurrentArea {current_area}") + + return current_area + + async def send_cmd_skip_area_expect_response(self, step, skipped_area, expected_response): + self.print_step(step, f"Send SkipArea command with SkippedArea({skipped_area})") + ret = await self.send_single_cmd(cmd=Clusters.Objects.ServiceArea.Commands.SkipArea(skippedArea=skipped_area), + endpoint=self.endpoint) + + asserts.assert_equal(ret.commandResponseState.errorStateID, + expected_response, + f"Command response ({ret.commandResponseState}) doesn't match the expected one") + + # Sends and out-of-band command to the rvc-app + + def write_to_app_pipe(self, command): + with open(self.app_pipe, "w") as app_pipe: + app_pipe.write(command + "\n") + # Allow some time for the command to take effect. + # This removes the test flakyness which is very annoying for everyone in CI. + sleep(0.001) + + def TC_SEAR_1_5(self) -> list[str]: + return ["SEAR.S", "SEAR.S.C02.Rsp"] + + @async_test_body + async def test_TC_SEAR_1_5(self): + self.endpoint = self.matter_test_config.endpoint + asserts.assert_false(self.endpoint is None, "--endpoint must be included on the command line in.") + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + if self.is_ci: + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") + self.app_pipe = self.app_pipe + str(app_pid) + + self.print_step(1, "Commissioning, already done") + + # Ensure that the device is in the correct state + if self.is_ci: + self.write_to_app_pipe('{"Name": "Reset"}') + + supported_area_ids = await self.read_supported_areas(step=2) + asserts.assert_true(len(supported_area_ids) > 0, "SupportedAreas is empty") + valid_area_id = supported_area_ids[0] + invalid_area_id = 1 + max(supported_area_ids) + + if self.check_pics("SEAR.S.M.INVALID_STATE_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): + test_step = "Manually intervene to put the device in a state that prevents it from executing the SkipArea command \ + (e.g. set CurrentArea to null or make it not operate, i.e. be in the idle state)" + self.print_step("3", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.send_cmd_skip_area_expect_response(step=4, skipped_area=valid_area_id, + expected_response=Clusters.ServiceArea.SkipAreaStatus.kInvalidInMode) + + if self.check_pics("SEAR.S.M.NO_SELAREA_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): + test_step = "Manually intervene to put the device in a state where the state would allow it to execute the SkipArea command, \ + if SelectedAreas wasn't empty, and SelectedAreas is empty" + self.print_step("5", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.send_cmd_skip_area_expect_response(step=6, skipped_area=valid_area_id, + expected_response=Clusters.ServiceArea.SkipAreaStatus.kInvalidAreaList) + + if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): + test_step = "Manually intervene to put the device in a state that allows it to execute the SkipArea command" + self.print_step("7", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + await self.send_cmd_skip_area_expect_response(step=8, skipped_area=invalid_area_id, + expected_response=Clusters.ServiceArea.SkipAreaStatus.kInvalidSkippedArea) + + if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"): + return + + if self.check_pics("SEAR.S.A0005"): + old_progress_list = await self.read_progress(step=9) + asserts.assert_true(len(old_progress_list) > 0, f"len of Progress({len(old_progress_list)}) should not be zero)") + + selected_areas = await self.read_selected_areas(step=10) + asserts.assert_true(len(selected_areas) > 0, "SelectedAreas is empty") + + old_current_area = NullValue + if self.check_pics("SEAR.S.A0003"): + old_current_area = await self.read_current_area(step=11) + + self.print_step("12", "") + if old_current_area is not NullValue: + await self.send_cmd_skip_area_expect_response(step=13, skipped_area=old_current_area, + expected_response=Clusters.ServiceArea.SkipAreaStatus.kSuccess) + if self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): + test_step = "(Manual operation) wait for the device to skip the current area, and start operating at\ + the next one it should process, or stop operating" + self.print_step("14", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + if self.check_pics("SEAR.S.A0005"): + new_progress_list = await self.read_progress(step=15) + asserts.assert_true(len(new_progress_list) > 0, + f"len of Progress({len(new_progress_list)}) should not be zero)") + + prog_areas = [p.areaID for p in new_progress_list] + + asserts.assert_true(old_current_area in prog_areas, f"Progress should include area {old_current_area}") + + new_current_area = await self.read_current_area(step=16) + for p in new_progress_list: + if p.areaID == old_current_area: + asserts.assert_true(p.status == Clusters.ServiceArea.OperationalStatusEnum.kSkipped, + "Progress for areaID({old_current_area}) should be Skipped") + break + test_step = "Indicate whether the device has stopped operating (y/n)" + ret = self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + # Verify that if the device hasn't stopped operating, the `new_progress_list`'s entry matching `new_current_area` shows the Operating status + if ret != "y": + for p in new_progress_list: + if p.areaID == new_current_area: + asserts.assert_true(p.status == Clusters.ServiceArea.OperationalStatusEnum.kOperating, + "Progress for areaID({new_current_area}) should be Operating") + break + + # next, we need to check for something else (so the condition of the 'if' above becomes part of the 'then' statement below): + # if before skipping all areas, except the current one, were Skipped or Completed, the device MUST have stopped operating + was_only_skipped_or_completed = True + for p in old_progress_list: + if p.areaID != old_current_area: + if p.status not in (Clusters.ServiceArea.OperationalStatusEnum.kSkipped, + Clusters.ServiceArea.OperationalStatusEnum.kCompleted): + was_only_skipped_or_completed = False + break + if was_only_skipped_or_completed: + asserts.assert_true(ret == "y", "The device should not be operating") + + self.print_step("17", "") + return + + if not self.check_pics("SEAR.S.A0005"): + return + + if self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): + test_step = "Manually intervene to put the device in a state that allows it to execute the SkipArea command" + self.print_step("18", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + self.print_step("19", "") + if len(old_progress_list) == 0: + return + + area_to_skip = NullValue + self.print_step("20", "") + for p in old_progress_list: + if p.status in (Clusters.ServiceArea.OperationalStatusEnum.kPending, + Clusters.ServiceArea.OperationalStatusEnum.kOperating): + area_to_skip = p.areaID + break + + if area_to_skip is NullValue: + return + + await self.send_cmd_skip_area_expect_response(step=21, skipped_area=area_to_skip, + expected_response=Clusters.ServiceArea.SkipAreaStatus.kSuccess) + + if self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): + test_step = "(Manual operation) wait for the device to update Progress or to stop operating" + self.print_step("22", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + new_progress_list = await self.read_progress(step=23) + asserts.assert_true(len(new_progress_list) > 0, f"len of Progress({len(new_progress_list)}) should not be zero)") + + for p in new_progress_list: + if p.areaID == area_to_skip: + asserts.assert_true(p.status == Clusters.ServiceArea.OperationalStatusEnum.kSkipped, + "Progress for areaID({new_current_area}) should be Skipped") + break + + test_step = "Indicate whether the device has stopped operating (y/n)" + ret = self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + was_only_skipped_or_completed = True + for p in old_progress_list: + if p.areaID != area_to_skip: + if p.status not in (Clusters.ServiceArea.OperationalStatusEnum.kSkipped, + Clusters.ServiceArea.OperationalStatusEnum.kCompleted): + was_only_skipped_or_completed = False + break + if was_only_skipped_or_completed: + asserts.assert_true(ret == "y", "The device should not be operating") + for p in new_progress_list: + if p.areaID == old_current_area: + asserts.assert_true(p.status == Clusters.ServiceArea.OperationalStatusEnum.kSkipped, + "Progress for areaID({old_current_area}) should be Skipped") + break + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_SEAR_1_6.py b/src/python_testing/TC_SEAR_1_6.py new file mode 100644 index 00000000000000..02a0fcdd33133a --- /dev/null +++ b/src/python_testing/TC_SEAR_1_6.py @@ -0,0 +1,148 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# TODO - this was copied/pasted from abother test, it needs to be reviewed and updated +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${CHIP_RVC_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +from time import sleep + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_SEAR_1_6(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = None + self.is_ci = False + self.app_pipe = "/tmp/chip_rvc_fifo_" + + async def read_sear_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.ServiceArea + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + async def read_supported_areas(self, step): + self.print_step(step, "Read SupportedAreas attribute") + supported_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedAreas) + logging.info("SupportedAreas: %s" % (supported_areas)) + + return [a.areaID for a in supported_areas] + + async def read_selected_areas(self, step): + self.print_step(step, "Read SelectedAreas attribute") + selected_areas = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SelectedAreas) + logging.info(f"SelectedAreas {selected_areas}") + + return selected_areas + + async def read_progress(self, step): + self.print_step(step, "Read Progress attribute") + progress = await self.read_sear_attribute_expect_success( + endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress) + logging.info(f"Progress {progress}") + + return progress + + # Sends and out-of-band command to the rvc-app + def write_to_app_pipe(self, command): + with open(self.app_pipe, "w") as app_pipe: + app_pipe.write(command + "\n") + # Allow some time for the command to take effect. + # This removes the test flakyness which is very annoying for everyone in CI. + sleep(0.001) + + def TC_SEAR_1_6(self) -> list[str]: + return ["SEAR.S", "SEAR.S.A0005", "SEAR.S.A0000", "SEAR.S.A0002", "SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL"] + + @async_test_body + async def test_TC_SEAR_1_6(self): + self.endpoint = self.matter_test_config.endpoint + asserts.assert_false(self.endpoint is None, "--endpoint must be included on the command line in.") + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + if self.is_ci: + app_pid = self.matter_test_config.app_pid + if app_pid == 0: + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") + self.app_pipe = self.app_pipe + str(app_pid) + + self.print_step(1, "Commissioning, already done") + + # Ensure that the device is in the correct state + if self.is_ci: + self.write_to_app_pipe('{"Name": "Reset"}') + + test_step = "Manually intervene to put the device in the idle state and ensure SupportedAreas and SelectedAreas are not empty" + self.print_step("2", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + supported_area_ids = await self.read_supported_areas(step=3) + asserts.assert_true(len(supported_area_ids) > 0, "SupportedAreas is empty") + + selected_areas = await self.read_selected_areas(step=4) + asserts.assert_true(len(selected_areas) > 0, "SelectedAreas is empty") + + test_step = "Manually intervene to put the device in the operating state" + self.print_step("5", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + progress_list_operating = await self.read_progress(step=6) + asserts.assert_true(len(selected_areas) == len(progress_list_operating), + f"len of SelectedAreas({len(selected_areas)}) should be equal to len of Progress({len(progress_list_operating)})") + + for p in progress_list_operating: + asserts.assert_true(p.areaID in selected_areas, f"Progress entry with unknown AreaID({p.areaID})") + asserts.assert_true(p.status in (Clusters.ServiceArea.OperationalStatusEnum.kPending, + Clusters.ServiceArea.OperationalStatusEnum.kOperating), + f"Progress entry with unexpected Status({p.status})") + asserts.assert_true(p.TotalOperationalTime is NullValue, "Progress entry with non-null TotalOperationalTime") + + test_step = "While all entries in Progress show the Pending or Operating status (i.e. \ + before any area is skipped or completed), manually intervene to put the device \ + in the idle state, by ending the operation unexpectedly (e.g. force an error)" + self.print_step("7", test_step) + if not self.is_ci: + self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") + + progress_list_idle = await self.read_progress(step=8) + asserts.assert_true(len(selected_areas) == len(progress_list_idle), + f"len of SelectedAreas({len(selected_areas)}) should be equal to len of Progress({len(progress_list_idle)})") + + for p in progress_list_idle: + asserts.assert_true(p.areaID in selected_areas, f"Progress entry with unknown AreaID({p.areaID})") + asserts.assert_true(p.status == Clusters.ServiceArea.OperationalStatusEnum.kSkipped, + f"Progress entry with unexpected Status({p.status})") + + +if __name__ == "__main__": + default_matter_test_main() From 78dab72509edb243413941dd38a6562d1b228de2 Mon Sep 17 00:00:00 2001 From: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:49:12 -0700 Subject: [PATCH 39/63] Remove manual tests for Thermostat presets (#34679) --- .../certification/Test_TC_TSTAT_4_2.yaml | 2228 ----------------- 1 file changed, 2228 deletions(-) delete mode 100644 src/app/tests/suites/certification/Test_TC_TSTAT_4_2.yaml diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_4_2.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_4_2.yaml deleted file mode 100644 index b813eafd402606..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_4_2.yaml +++ /dev/null @@ -1,2228 +0,0 @@ -# Copyright (c) 2024 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. - -name: 42.4.2. [TC-TSTAT-4.2] Preset Test Cases with server as DUT - -PICS: - - TSTAT.S - -config: - nodeId: 0x12344321 - cluster: "Thermostat" - endpoint: 1 - -tests: - - label: "Step 1: Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2: Test Harness writes to the Presets attribute without calling - the StartPresetsSchedulesEditRequest" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #2 Test Harness Client attempts to write Presets and gets an INVALID_IN_STATE error since the client didn't send a request to edit the presets by calling StartPresetsSchedulesEditRequest command. - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": null, "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a INVALID_IN_STATE (0xCB) - - [1722285385.263] [53729:5380292] [DMG] WriteClient moving to [AwaitingDe] - [1722285385.263] [53729:5380292] [TOO] Response Failure: IM Error 0x000005CB: General error: 0xcb (INVALID_IN_STATE) - [1722285385.263] [53729:5380292] [EM] <<< [E:42658i S:21691 M:14088666 (Ack:20978215)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722285385.263] [53729:5380292] [EM] Flushed pending ack for MessageCounter:20978215 on exchange 42658i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 3a: Test Harness writes to the Presets attribute after calling - the StartPresetsSchedulesEditRequest command" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #3a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 3b: Test Harness writes to the Presets attribute adding 3 - presets for Sleep, Wake and GoingToSleep" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #3b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": null, "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": null, "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": null, "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286250.503] [54321:5397545] [DMG] WriteClient moving to [ResponseRe] - [1722286250.503] [54321:5397545] [DMG] WriteResponseMessage = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] AttributeStatusIBs = - [1722286250.503] [54321:5397545] [DMG] [ - [1722286250.503] [54321:5397545] [DMG] AttributeStatusIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] AttributePathIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] Endpoint = 0x1, - [1722286250.503] [54321:5397545] [DMG] Cluster = 0x201, - [1722286250.503] [54321:5397545] [DMG] Attribute = 0x0000_0050, - [1722286250.503] [54321:5397545] [DMG] } - [1722286250.503] [54321:5397545] [DMG] - [1722286250.503] [54321:5397545] [DMG] StatusIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] status = 0x00 (SUCCESS), - [1722286250.503] [54321:5397545] [DMG] }, - [1722286250.503] [54321:5397545] [DMG] - [1722286250.503] [54321:5397545] [DMG] }, - [1722286250.503] [54321:5397545] [DMG] - [1722286250.503] [54321:5397545] [DMG] AttributeStatusIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] AttributePathIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] Endpoint = 0x1, - [1722286250.503] [54321:5397545] [DMG] Cluster = 0x201, - [1722286250.503] [54321:5397545] [DMG] Attribute = 0x0000_0050, - [1722286250.503] [54321:5397545] [DMG] ListIndex = Null, - [1722286250.503] [54321:5397545] [DMG] } - [1722286250.503] [54321:5397545] [DMG] - [1722286250.503] [54321:5397545] [DMG] StatusIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] status = 0x00 (SUCCESS), - [1722286250.503] [54321:5397545] [DMG] }, - [1722286250.503] [54321:5397545] [DMG] - [1722286250.503] [54321:5397545] [DMG] }, - [1722286250.503] [54321:5397545] [DMG] - [1722286250.503] [54321:5397545] [DMG] AttributeStatusIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] AttributePathIB = - [1722286250.503] [54321:5397545] [DMG] { - [1722286250.503] [54321:5397545] [DMG] Endpoint = 0x1, - [1722286250.503] [54321:5397545] [DMG] Cluster = 0x201, - [1722286250.503] [54321:5397545] [DMG] Attribute = 0x0000_0050, - [1722286250.503] [54321:5397545] [DMG] ListIndex = Null, - [1722286250.503] [54321:5397545] [DMG] } - [1722286250.503] [54321:5397545] [DMG] - [1722286250.503] [54321:5397545] [DMG] StatusIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] status = 0x00 (SUCCESS), - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] AttributeStatusIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] AttributePathIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] Endpoint = 0x1, - [1722286250.504] [54321:5397545] [DMG] Cluster = 0x201, - [1722286250.504] [54321:5397545] [DMG] Attribute = 0x0000_0050, - [1722286250.504] [54321:5397545] [DMG] ListIndex = Null, - [1722286250.504] [54321:5397545] [DMG] } - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] StatusIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] status = 0x00 (SUCCESS), - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] AttributeStatusIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] AttributePathIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] Endpoint = 0x1, - [1722286250.504] [54321:5397545] [DMG] Cluster = 0x201, - [1722286250.504] [54321:5397545] [DMG] Attribute = 0x0000_0050, - [1722286250.504] [54321:5397545] [DMG] ListIndex = Null, - [1722286250.504] [54321:5397545] [DMG] } - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] StatusIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] status = 0x00 (SUCCESS), - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] AttributeStatusIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] AttributePathIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] Endpoint = 0x1, - [1722286250.504] [54321:5397545] [DMG] Cluster = 0x201, - [1722286250.504] [54321:5397545] [DMG] Attribute = 0x0000_0050, - [1722286250.504] [54321:5397545] [DMG] ListIndex = Null, - [1722286250.504] [54321:5397545] [DMG] } - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] StatusIB = - [1722286250.504] [54321:5397545] [DMG] { - [1722286250.504] [54321:5397545] [DMG] status = 0x00 (SUCCESS), - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] }, - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] ], - [1722286250.504] [54321:5397545] [DMG] - [1722286250.504] [54321:5397545] [DMG] InteractionModelRevision = 11 - [1722286250.504] [54321:5397545] [DMG] } - [1722286250.504] [54321:5397545] [DMG] WriteClient moving to [AwaitingDe] - [1722286250.504] [54321:5397545] [EM] <<< [E:14426i S:42250 M:116961408 (Ack:156984778)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286250.504] [54321:5397545] [EM] Flushed pending ack for MessageCounter:156984778 on exchange 14426i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 3c: Test Harness reads the Presets attribute without calling - the CommitPresetsSchedulesRequest command" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #3c Test Harness Client reads Presets attribute but the new additions are not committed since the client didn't call the CommitPresetsSchedulesRequest command - - ./chip-tool thermostat read presets 0x12344321 1 - On TH(chip-tool) verify that DUT successfully read Presets (but without the new changes) - [1722286701.424] [54699:5406692] [TOO] Endpoint: 1 Cluster: 0x0000_0201 Attribute 0x0000_0050 DataVersion: 3807987049 - [1722286701.425] [54699:5406692] [TOO] Presets: 2 entries - [1722286701.425] [54699:5406692] [TOO] [1]: { - [1722286701.425] [54699:5406692] [TOO] PresetHandle: 01 - [1722286701.425] [54699:5406692] [TOO] PresetScenario: 1 - [1722286701.425] [54699:5406692] [TOO] CoolingSetpoint: 2500 - [1722286701.425] [54699:5406692] [TOO] HeatingSetpoint: 2100 - [1722286701.426] [54699:5406692] [TOO] BuiltIn: TRUE - [1722286701.426] [54699:5406692] [TOO] } - [1722286701.426] [54699:5406692] [TOO] [2]: { - [1722286701.426] [54699:5406692] [TOO] PresetHandle: 02 - [1722286701.426] [54699:5406692] [TOO] PresetScenario: 2 - [1722286701.426] [54699:5406692] [TOO] CoolingSetpoint: 2600 - [1722286701.426] [54699:5406692] [TOO] HeatingSetpoint: 2000 - [1722286701.426] [54699:5406692] [TOO] BuiltIn: TRUE - [1722286701.426] [54699:5406692] [TOO] } - [1722286701.426] [54699:5406692] [EM] <<< [E:49759i S:37002 M:67372150 (Ack:254131025)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 3d: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #3d Test Harness Client calls CommitPresetsSchedulesRequest command - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722287841.505] [55282:5425045] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x0 - [1722287841.505] [55282:5425045] [DMG] ICR moving to [AwaitingDe] - [1722287841.505] [55282:5425045] [EM] <<< [E:46441i S:57071 M:61366563 (Ack:138534230)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 3e: Test Harness reads the Presets attribute after calling the - CommitPresetsSchedulesRequest command" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #3e Test Harness Client reads Presets attribute and can see the added Presets. - - ./chip-tool thermostat read presets 0x12344321 1 - On TH(chip-tool) verify that DUT successfully read Presets (with the new changes) - [1722288101.757] [55446:5430009] [TOO] Endpoint: 1 Cluster: 0x0000_0201 Attribute 0x0000_0050 DataVersion: 3807987055 - [1722288101.757] [55446:5430009] [TOO] Presets: 5 entries - [1722288101.758] [55446:5430009] [TOO] [1]: { - [1722288101.759] [55446:5430009] [TOO] PresetHandle: 01 - [1722288101.759] [55446:5430009] [TOO] PresetScenario: 1 - [1722288101.759] [55446:5430009] [TOO] CoolingSetpoint: 2500 - [1722288101.759] [55446:5430009] [TOO] HeatingSetpoint: 2600 - [1722288101.759] [55446:5430009] [TOO] BuiltIn: TRUE - [1722288101.759] [55446:5430009] [TOO] } - [1722288101.759] [55446:5430009] [TOO] [2]: { - [1722288101.759] [55446:5430009] [TOO] PresetHandle: 02 - [1722288101.759] [55446:5430009] [TOO] PresetScenario: 2 - [1722288101.759] [55446:5430009] [TOO] CoolingSetpoint: 2600 - [1722288101.759] [55446:5430009] [TOO] HeatingSetpoint: 2500 - [1722288101.759] [55446:5430009] [TOO] BuiltIn: TRUE - [1722288101.759] [55446:5430009] [TOO] } - [1722288101.759] [55446:5430009] [TOO] [3]: { - [1722288101.759] [55446:5430009] [TOO] PresetHandle: 03 - [1722288101.759] [55446:5430009] [TOO] PresetScenario: 3 - [1722288101.759] [55446:5430009] [TOO] Name: Sleep - [1722288101.759] [55446:5430009] [TOO] CoolingSetpoint: 2500 - [1722288101.759] [55446:5430009] [TOO] HeatingSetpoint: 2600 - [1722288101.759] [55446:5430009] [TOO] BuiltIn: FALSE - [1722288101.759] [55446:5430009] [TOO] } - [1722288101.759] [55446:5430009] [TOO] [4]: { - [1722288101.759] [55446:5430009] [TOO] PresetHandle: 04 - [1722288101.759] [55446:5430009] [TOO] PresetScenario: 4 - [1722288101.759] [55446:5430009] [TOO] Name: Wake - [1722288101.759] [55446:5430009] [TOO] CoolingSetpoint: 2200 - [1722288101.759] [55446:5430009] [TOO] HeatingSetpoint: 2900 - [1722288101.759] [55446:5430009] [TOO] BuiltIn: FALSE - [1722288101.759] [55446:5430009] [TOO] } - [1722288101.759] [55446:5430009] [TOO] [5]: { - [1722288101.759] [55446:5430009] [TOO] PresetHandle: 06 - [1722288101.759] [55446:5430009] [TOO] PresetScenario: 6 - [1722288101.759] [55446:5430009] [TOO] Name: GoingToSleep - [1722288101.759] [55446:5430009] [TOO] CoolingSetpoint: 2100 - [1722288101.759] [55446:5430009] [TOO] HeatingSetpoint: 2500 - [1722288101.759] [55446:5430009] [TOO] BuiltIn: FALSE - [1722288101.759] [55446:5430009] [TOO] } - [1722288101.759] [55446:5430009] [EM] <<< [E:64397i S:21821 M:262922240 (Ack:37271345)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722288101.760] [55446:5430009] [EM] Flushed pending ack for MessageCounter:37271345 on exchange 64397i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 4a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #4a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 4b: Test Harness writes to the Presets attribute with a - built-in preset having preset handle hex:01 removed" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #4b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722288460.741] [55752:5437815] [DMG] WriteClient moving to [ResponseRe] - [1722288460.741] [55752:5437815] [DMG] WriteResponseMessage = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] AttributeStatusIBs = - [1722288460.741] [55752:5437815] [DMG] [ - [1722288460.741] [55752:5437815] [DMG] AttributeStatusIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] AttributePathIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] Endpoint = 0x1, - [1722288460.741] [55752:5437815] [DMG] Cluster = 0x201, - [1722288460.741] [55752:5437815] [DMG] Attribute = 0x0000_0050, - [1722288460.741] [55752:5437815] [DMG] } - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] StatusIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] status = 0x00 (SUCCESS), - [1722288460.741] [55752:5437815] [DMG] }, - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] }, - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] AttributeStatusIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] AttributePathIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] Endpoint = 0x1, - [1722288460.741] [55752:5437815] [DMG] Cluster = 0x201, - [1722288460.741] [55752:5437815] [DMG] Attribute = 0x0000_0050, - [1722288460.741] [55752:5437815] [DMG] ListIndex = Null, - [1722288460.741] [55752:5437815] [DMG] } - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] StatusIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] status = 0x00 (SUCCESS), - [1722288460.741] [55752:5437815] [DMG] }, - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] }, - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] AttributeStatusIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] AttributePathIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] Endpoint = 0x1, - [1722288460.741] [55752:5437815] [DMG] Cluster = 0x201, - [1722288460.741] [55752:5437815] [DMG] Attribute = 0x0000_0050, - [1722288460.741] [55752:5437815] [DMG] ListIndex = Null, - [1722288460.741] [55752:5437815] [DMG] } - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] StatusIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] status = 0x00 (SUCCESS), - [1722288460.741] [55752:5437815] [DMG] }, - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] }, - [1722288460.741] [55752:5437815] [DMG] - [1722288460.741] [55752:5437815] [DMG] AttributeStatusIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.741] [55752:5437815] [DMG] AttributePathIB = - [1722288460.741] [55752:5437815] [DMG] { - [1722288460.742] [55752:5437815] [DMG] Endpoint = 0x1, - [1722288460.742] [55752:5437815] [DMG] Cluster = 0x201, - [1722288460.742] [55752:5437815] [DMG] Attribute = 0x0000_0050, - [1722288460.742] [55752:5437815] [DMG] ListIndex = Null, - [1722288460.742] [55752:5437815] [DMG] } - [1722288460.742] [55752:5437815] [DMG] - [1722288460.742] [55752:5437815] [DMG] StatusIB = - [1722288460.742] [55752:5437815] [DMG] { - [1722288460.742] [55752:5437815] [DMG] status = 0x00 (SUCCESS), - [1722288460.742] [55752:5437815] [DMG] }, - [1722288460.742] [55752:5437815] [DMG] - [1722288460.742] [55752:5437815] [DMG] }, - [1722288460.742] [55752:5437815] [DMG] - [1722288460.742] [55752:5437815] [DMG] AttributeStatusIB = - [1722288460.742] [55752:5437815] [DMG] { - [1722288460.742] [55752:5437815] [DMG] AttributePathIB = - [1722288460.742] [55752:5437815] [DMG] { - [1722288460.742] [55752:5437815] [DMG] Endpoint = 0x1, - [1722288460.742] [55752:5437815] [DMG] Cluster = 0x201, - [1722288460.742] [55752:5437815] [DMG] Attribute = 0x0000_0050, - [1722288460.742] [55752:5437815] [DMG] ListIndex = Null, - [1722288460.742] [55752:5437815] [DMG] } - [1722288460.742] [55752:5437815] [DMG] - [1722288460.742] [55752:5437815] [DMG] StatusIB = - [1722288460.742] [55752:5437815] [DMG] { - [1722288460.742] [55752:5437815] [DMG] status = 0x00 (SUCCESS), - [1722288460.742] [55752:5437815] [DMG] }, - [1722288460.742] [55752:5437815] [DMG] - [1722288460.742] [55752:5437815] [DMG] }, - [1722288460.742] [55752:5437815] [DMG] - [1722288460.742] [55752:5437815] [DMG] ], - [1722288460.742] [55752:5437815] [DMG] - [1722288460.742] [55752:5437815] [DMG] InteractionModelRevision = 11 - [1722288460.742] [55752:5437815] [DMG] } - [1722288460.742] [55752:5437815] [DMG] WriteClient moving to [AwaitingDe] - [1722288460.742] [55752:5437815] [EM] <<< [E:10991i S:19292 M:9249657 (Ack:153811994)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 4c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #4c Test Harness Client calls CommitPresetsSchedulesRequest command and gets UNSUPPORTED_ACCESS since a built-in preset was attempted to be removed. - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an UNSUPPORTED_ACCESS (0x7E) error - [1722288464.392] [55754:5437857] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x7e - [1722288464.392] [55754:5437857] [TOO] Error: IM Error 0x0000057E: General error: 0x7e (UNSUPPORTED_ACCESS) - [1722288464.392] [55754:5437857] [DMG] ICR moving to [AwaitingDe] - [1722288464.392] [55754:5437857] [EM] <<< [E:45905i S:14600 M:175519796 (Ack:248690311)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 5a: Test Harness calls the SetActivePresetRequest command to - set the active preset handle" - PICS: TSTAT.S.F08 && TSTAT.S.C06.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #5a Test Harness Client calls SetActivePresetRequest command to set the active preset handle - - ./chip-tool thermostat set-active-preset-request "hex:03" 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722292538.299] [58873:5523668] [TOO] Endpoint: 1 Cluster: 0x0000_0201 Attribute 0x0000_004E DataVersion: 3470253931 - [1722292538.300] [58873:5523668] [TOO] ActivePresetHandle: 03 - [1722292538.300] [58873:5523668] [EM] <<< [E:63772i S:58620 M:79797990 (Ack:248773669)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 5b: Test Harness reads the ActivePresetHandle attribute" - PICS: TSTAT.S.F08 && TSTAT.S.A004e - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #5b Test Harness Client reads ActivePresetHandle attribute - - ./chip-tool thermostat read active-preset-handle 0x12344321 1 - On TH(chip-tool) verify that DUT successfully read ActivePresetHandle - [1722299898.382] [62999:5632512] [TOO] Endpoint: 1 Cluster: 0x0000_0201 Attribute 0x0000_004E DataVersion: 3098962545 - [1722299898.382] [62999:5632512] [TOO] ActivePresetHandle: 03 - [1722299898.382] [62999:5632512] [EM] <<< [E:27648i S:55804 M:2686999 (Ack:191947351)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 5c: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #5b Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 5d: Test Harness writes to the Presets attribute without the - preset with handle hex:03 matching the ActivePresetHandle attribute - removed" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #5c Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets ./out/debug/chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 5e: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #5e Test Harness Client calls CommitPresetsSchedulesRequest command ans gets INVALID_IN_STATE since the preset with its handle matching the active preset handle was attempted to be removed. - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an INVALID_IN_STATE (0xCB) error - [1722293312.795] [59386:5538858] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0xcb - [1722293312.795] [59386:5538858] [TOO] Error: IM Error 0x000005CB: General error: 0xcb (INVALID_IN_STATE) - [1722293312.795] [59386:5538858] [DMG] ICR moving to [AwaitingDe] - [1722293312.795] [59386:5538858] [EM] <<< [E:4647i S:21966 M:58651952 (Ack:80870764)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 6a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #6a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 6b: Test Harness writes to the Presets attribute with a - built-in preset having preset handle hex:01 modified to be not - built-in." - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #6b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 6c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #6c Test Harness Client calls CommitPresetsSchedulesRequest command gets UNSUPPORTED_ACCESS since a built-in preset was attempted to be modified to a non built-in preset - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an UNSUPPORTED_ACCESS (0x7E) error - [1722289468.881] [56642:5458641] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x7e - [1722289468.881] [56642:5458641] [TOO] Error: IM Error 0x0000057E: General error: 0x7e (UNSUPPORTED_ACCESS) - [1722289468.881] [56642:5458641] [DMG] ICR moving to [AwaitingDe] - [1722289468.881] [56642:5458641] [EM] <<< [E:20464i S:35105 M:91065475 (Ack:114933900)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 7a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #6a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 7b: Test Harness writes to the Presets attribute with a new - preset having builtIn set to true" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #7b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": null, "name": "Vacation", "presetScenario": 5, "coolingSetpoint": 2900, "heatingSetpoint": 2000, "builtIn": true }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 7c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #6c Test Harness Client calls CommitPresetsSchedulesRequest command and gets CONSTRAINT_ERROR since a new preset was attempted to be added as a built-in preset. - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an CONSTRAINT_ERROR (0x87) error - [1722289998.305] [56996:5468872] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x87 - [1722289998.305] [56996:5468872] [TOO] Error: IM Error 0x00000587: General error: 0x87 (CONSTRAINT_ERROR) - [1722289998.305] [56996:5468872] [DMG] ICR moving to [AwaitingDe] - [1722289998.305] [56996:5468872] [EM] <<< [E:44500i S:62829 M:76436393 (Ack:145233702)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 8a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #8a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 8b: Test Harness writes to the Presets attribute with a preset - having preset handle hex:08 that doesn't exist in the Presets - attribute" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #8b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:08", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 8c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #8c Test Harness Client calls CommitPresetsSchedulesRequest command gets NOT_FOUND since an existing preset was attempted to be added with a preset handle that doesn't exist in the Presets attribute - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an NOT_FOUND (0x8B) error - [1722290436.980] [57434:5479429] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x8b - [1722290436.980] [57434:5479429] [TOO] Error: IM Error 0x0000058B: General error: 0x8b (NOT_FOUND) - [1722290436.980] [57434:5479429] [DMG] ICR moving to [AwaitingDe] - [1722290436.980] [57434:5479429] [EM] <<< [E:54210i S:10110 M:158287615 (Ack:73923062)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 9a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #9a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 9b: Test Harness writes to the Presets attribute" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #8b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 9c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #8c Test Harness Client calls CommitPresetsSchedulesRequest command gets CONSTRAINT_ERROR since preset with preset handle hex:03 is duplicated - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends a CONSTRAINT_ERROR (0x87) error - [1722302289.994] [63677:5670818] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x87 - [1722302289.994] [63677:5670818] [TOO] Error: IM Error 0x00000587: General error: 0x87 (CONSTRAINT_ERROR) - [1722302289.994] [63677:5670818] [DMG] ICR moving to [AwaitingDe] - [1722302289.994] [63677:5670818] [EM] <<< [E:25209i S:7768 M:264197735 (Ack:106550461)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 10a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #10a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 10b: Test Harness writes to the Presets attribute wherein a - built-in preset is modified to a non built-in preset" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #10b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 10c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #10c Test Harness Client calls CommitPresetsSchedulesRequest command gets UNSUPPORTED_ACCESS since built-in preset with handle hex:01 was attempted to be modified to a not built-in preset - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an UNSUPPORTED_ACCESS (0x7E) error - [1722289468.881] [56642:5458641] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x7e - [1722289468.881] [56642:5458641] [TOO] Error: IM Error 0x0000057E: General error: 0x7e (UNSUPPORTED_ACCESS) - [1722289468.881] [56642:5458641] [DMG] ICR moving to [AwaitingDe] - [1722289468.881] [56642:5458641] [EM] <<< [E:20464i S:35105 M:91065475 (Ack:114933900)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 11a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #11a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 11b: Test Harness writes to the Presets attribute wherein a non - built-in preset is modified to a built-in preset" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #11b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 11c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #11c Test Harness Client calls CommitPresetsSchedulesRequest command gets UNSUPPORTED_ACCESS since non built-in preset with handle hex:03 was attempted to be modified to be built-in - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an UNSUPPORTED_ACCESS (0x7E) error - [1722297542.066] [60654:5591651] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x7e - [1722297542.066] [60654:5591651] [TOO] Error: IM Error 0x0000057E: General error: 0x7e (UNSUPPORTED_ACCESS) - [1722297542.066] [60654:5591651] [DMG] ICR moving to [AwaitingDe] - [1722297542.066] [60654:5591651] [EM] <<< [E:11999i S:35595 M:148057801 (Ack:14642826)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 12a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #12a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 12b: Test Harness writes to the Presets attribute with a preset - that doesn't support names in the PresetTypeFeatures bitmap but has a - name" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #11b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "name": "Occupied", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "hex:03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }, {"presetHandle": "hex:06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 2100, "heatingSetpoint": 2500, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722289461.377] [56636:5458560] [EM] <<< [E:23635i S:58282 M:220756286 (Ack:5366080)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 12c: Test Harness calls the CommitPresetsSchedulesRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C09.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #11c Test Harness Client calls CommitPresetsSchedulesRequest command gets CONSTRAINT_ERROR since we attempted to add a name to a preset with handle hex:01 that doesn't support names. - - ./chip-tool thermostat commit-presets-schedules-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends an CONSTRAINT_ERROR (0x87) error - [1722298150.233] [60910:5602100] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x87 - [1722298150.233] [60910:5602100] [TOO] Error: IM Error 0x00000587: General error: 0x87 (CONSTRAINT_ERROR) - [1722298150.233] [60910:5602100] [DMG] ICR moving to [AwaitingDe] - [1722298150.233] [60910:5602100] [EM] <<< [E:44287i S:42687 M:5072557 (Ack:66989213)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - #TODO: Add tests for the total number of Presets exceeds the NumberOfPresets supported. Also Add tests for adding presets with preset scenario not present in PresetTypes. - - - label: - "Step 13a: Test Harness calls the StartPresetsSchedulesEditRequest - command to edit presets" - PICS: TSTAT.S.F08 && TSTAT.S.C07.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #13a Test Harness Client calls StartPresetsSchedulesEditRequest command - - ./chip-tool thermostat start-presets-schedules-edit-request 180 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722286001.805] [54149:5392862] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0007 Status=0x0 - [1722286001.805] [54149:5392862] [DMG] ICR moving to [AwaitingDe] - [1722286001.805] [54149:5392862] [EM] <<< [E:7545i S:16937 M:144975449 (Ack:93571372)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286001.806] [54149:5392862] [EM] Flushed pending ack for MessageCounter:93571372 on exchange 7545i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 13b: Test Harness writes to the Presets attribute but calls - CancelPresetsSchedulesEditRequest command to cancel the edit request" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #13b Test Harness Client attempts to write Presets and gets SUCCESS - - ./chip-tool thermostat write presets '[ {"presetHandle": "hex:01", "presetScenario": 1, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": true }, {"presetHandle": "hex:02", "presetScenario": 2, "coolingSetpoint": 2600, "heatingSetpoint": 2500, "builtIn": true }, {"presetHandle": "03", "name": "Sleep", "presetScenario": 3, "coolingSetpoint": 2500, "heatingSetpoint": 2600, "builtIn": false }, {"presetHandle": "04", "name": "Wake", "presetScenario": 4, "coolingSetpoint": 2200, "heatingSetpoint": 2900, "builtIn": false }, {"presetHandle": null, "name": "Vacation", "presetScenario": 5, "coolingSetpoint": 2900, "heatingSetpoint": 2000, "builtIn": false }, {"presetHandle": "06", "name": "GoingToSleep", "presetScenario": 6, "coolingSetpoint": 3000, "heatingSetpoint": 1900, "builtIn": false }]' 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722289461.376] [56636:5458560] [DMG] WriteClient moving to [ResponseRe] - [1722289461.376] [56636:5458560] [DMG] WriteResponseMessage = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIBs = - [1722289461.376] [56636:5458560] [DMG] [ - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.376] [56636:5458560] [DMG] } - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] StatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] }, - [1722289461.376] [56636:5458560] [DMG] - [1722289461.376] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] AttributePathIB = - [1722289461.376] [56636:5458560] [DMG] { - [1722289461.376] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.376] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.376] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.376] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] AttributeStatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] AttributePathIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] Endpoint = 0x1, - [1722289461.377] [56636:5458560] [DMG] Cluster = 0x201, - [1722289461.377] [56636:5458560] [DMG] Attribute = 0x0000_0050, - [1722289461.377] [56636:5458560] [DMG] ListIndex = Null, - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] StatusIB = - [1722289461.377] [56636:5458560] [DMG] { - [1722289461.377] [56636:5458560] [DMG] status = 0x00 (SUCCESS), - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] }, - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] ], - [1722289461.377] [56636:5458560] [DMG] - [1722289461.377] [56636:5458560] [DMG] InteractionModelRevision = 11 - [1722289461.377] [56636:5458560] [DMG] } - [1722289461.377] [56636:5458560] [DMG] WriteClient moving to [AwaitingDe] - [1722286250.504] [54321:5397545] [EM] <<< [E:14426i S:42250 M:116961408 (Ack:156984778)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - [1722286250.504] [54321:5397545] [EM] Flushed pending ack for MessageCounter:156984778 on exchange 14426i - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 13c: Test Harness calls the CancelPresetsSchedulesEditRequest - command" - PICS: TSTAT.S.F08 && TSTAT.S.C08.Rsp - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #13c Test Harness Client calls CancelPresetsSchedulesEditRequest command - - ./chip-tool thermostat cancel-presets-schedules-edit-request 0x12344321 1 - On TH(chip-tool) verify that DUT sends a success response - [1722287841.505] [55282:5425045] [DMG] Received Command Response Status for Endpoint=1 Cluster=0x0000_0201 Command=0x0000_0009 Status=0x0 - [1722287841.505] [55282:5425045] [DMG] ICR moving to [AwaitingDe] - [1722287841.505] [55282:5425045] [EM] <<< [E:46441i S:57071 M:61366563 (Ack:138534230)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 13d: Test Harness reads the Presets attribute after calling the - CancelPresetsSchedulesEditRequest command" - PICS: TSTAT.S.F08 && TSTAT.S.A0050 - verification: | - Optional Attribute - If it is supported, then in TH log it will results in displaying the value, else it will display UNSUPPORTED_ATTRIBUTE. Below is the log of RPI the result may be vary on the basis of dut implementation. - - #3c Test Harness Client reads Presets attribute - - ./chip-tool thermostat read presets 0x12344321 1 - On TH(chip-tool) verify that DUT successfully read Presets (but without the Vacation preset added) - [1722299465.497] [62905:5625656] [TOO] Endpoint: 1 Cluster: 0x0000_0201 Attribute 0x0000_0050 DataVersion: 3098962545 - [1722299465.497] [62905:5625656] [TOO] Presets: 5 entries - [1722299465.498] [62905:5625656] [TOO] [1]: { - [1722299465.498] [62905:5625656] [TOO] PresetHandle: 01 - [1722299465.498] [62905:5625656] [TOO] PresetScenario: 1 - [1722299465.498] [62905:5625656] [TOO] CoolingSetpoint: 2500 - [1722299465.498] [62905:5625656] [TOO] HeatingSetpoint: 2600 - [1722299465.498] [62905:5625656] [TOO] BuiltIn: TRUE - [1722299465.498] [62905:5625656] [TOO] } - [1722299465.498] [62905:5625656] [TOO] [2]: { - [1722299465.498] [62905:5625656] [TOO] PresetHandle: 02 - [1722299465.498] [62905:5625656] [TOO] PresetScenario: 2 - [1722299465.498] [62905:5625656] [TOO] CoolingSetpoint: 2600 - [1722299465.498] [62905:5625656] [TOO] HeatingSetpoint: 2500 - [1722299465.498] [62905:5625656] [TOO] BuiltIn: TRUE - [1722299465.498] [62905:5625656] [TOO] } - [1722299465.498] [62905:5625656] [TOO] [3]: { - [1722299465.498] [62905:5625656] [TOO] PresetHandle: 03 - [1722299465.498] [62905:5625656] [TOO] PresetScenario: 3 - [1722299465.498] [62905:5625656] [TOO] Name: Sleep - [1722299465.498] [62905:5625656] [TOO] CoolingSetpoint: 2500 - [1722299465.498] [62905:5625656] [TOO] HeatingSetpoint: 2600 - [1722299465.498] [62905:5625656] [TOO] BuiltIn: FALSE - [1722299465.498] [62905:5625656] [TOO] } - [1722299465.498] [62905:5625656] [TOO] [4]: { - [1722299465.498] [62905:5625656] [TOO] PresetHandle: 04 - [1722299465.498] [62905:5625656] [TOO] PresetScenario: 4 - [1722299465.498] [62905:5625656] [TOO] Name: Wake - [1722299465.498] [62905:5625656] [TOO] CoolingSetpoint: 2200 - [1722299465.498] [62905:5625656] [TOO] HeatingSetpoint: 2900 - [1722299465.498] [62905:5625656] [TOO] BuiltIn: FALSE - [1722299465.498] [62905:5625656] [TOO] } - [1722299465.498] [62905:5625656] [TOO] [5]: { - [1722299465.498] [62905:5625656] [TOO] PresetHandle: 06 - [1722299465.498] [62905:5625656] [TOO] PresetScenario: 6 - [1722299465.498] [62905:5625656] [TOO] Name: Vacationleep - [1722299465.498] [62905:5625656] [TOO] CoolingSetpoint: 2100 - [1722299465.498] [62905:5625656] [TOO] HeatingSetpoint: 2500 - [1722299465.498] [62905:5625656] [TOO] BuiltIn: FALSE - [1722299465.498] [62905:5625656] [TOO] } - [1722299465.498] [62905:5625656] [EM] <<< [E:53084i S:11903 M:249395534 (Ack:245071987)] (S) Msg TX to 1:000000000000006E [FEC4] [UDP:[fe80::1%lo0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34) - cluster: "LogCommands" - command: "UserPrompt" - arguments: - values: - - name: "message" - value: "Please enter 'y' after success" - - name: "expectedValue" - value: "y" From d7cadf9228f1c48674a3a31da0aab6e209ee1a94 Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Thu, 1 Aug 2024 09:28:53 +1200 Subject: [PATCH 40/63] Dump details about leaked ExchangeContexts before aborting (#34617) * Dump details about leaked ExchangeContexts before aborting This is implemented via a VerifyOrDieWithObject() variant of the existing VerifyOrDie() macro that calls a DumpToLog() method on the provided object if it exists (otherwise this is simply a no-op). If CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE is not enabled, VerifyOrDieWithObject() simply behaves like a plain VerifyOrDie(). DumpToLog() implementations can use ChipLogFormatRtti to log type information about an object (usually a delegate); if RTTI is disabled this simply outputs whether the object was null or not. * Address review comments * Make gcc happy and improve documentation * Remove unused include * Fix compile error without CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE * Avoid unused parameter warning --- src/lib/support/BUILD.gn | 6 ++- src/lib/support/CodeUtils.h | 16 +++++++ src/lib/support/Compiler.h | 24 ++++++++++ src/lib/support/ObjectDump.h | 57 +++++++++++++++++++++++ src/lib/support/Pool.h | 29 +++++++++++- src/lib/support/logging/TextOnlyLogging.h | 20 ++++++++ src/messaging/ExchangeContext.cpp | 8 ++-- src/messaging/ExchangeContext.h | 8 +++- src/messaging/tests/TestExchange.cpp | 12 +++++ 9 files changed, 172 insertions(+), 8 deletions(-) create mode 100644 src/lib/support/Compiler.h create mode 100644 src/lib/support/ObjectDump.h diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 27f52465858b1d..0b1d353821dabf 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -68,6 +68,7 @@ source_set("logging_constants") { source_set("attributes") { sources = [ + "Compiler.h", "DLLUtil.h", "EnforceFormat.h", ] @@ -132,7 +133,10 @@ source_set("text_only_logging") { } source_set("verifymacros") { - sources = [ "CodeUtils.h" ] + sources = [ + "CodeUtils.h", + "ObjectDump.h", + ] public_deps = [ ":attributes", diff --git a/src/lib/support/CodeUtils.h b/src/lib/support/CodeUtils.h index 800123aa456851..fb659c47939afd 100644 --- a/src/lib/support/CodeUtils.h +++ b/src/lib/support/CodeUtils.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -547,6 +548,21 @@ inline void chipDie(void) #define VerifyOrDie(aCondition) VerifyOrDieWithoutLogging(aCondition) #endif // CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE +/** + * @def VerifyOrDieWithObject(aCondition, aObject) + * + * Like VerifyOrDie(), but calls DumpObjectToLog() + * on the provided object on failure before aborting + * if CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE is enabled. + */ +#if CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE +#define VerifyOrDieWithObject(aCondition, aObject) \ + nlABORT_ACTION(aCondition, ::chip::DumpObjectToLog(aObject); \ + ChipLogError(Support, "VerifyOrDie failure at %s:%d: %s", __FILE__, __LINE__, #aCondition)) +#else // CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE +#define VerifyOrDieWithObject(aCondition, aObject) VerifyOrDieWithoutLogging(aCondition) +#endif // CHIP_CONFIG_VERBOSE_VERIFY_OR_DIE + /** * @def VerifyOrDieWithMsg(aCondition, aModule, aMessage, ...) * diff --git a/src/lib/support/Compiler.h b/src/lib/support/Compiler.h new file mode 100644 index 00000000000000..0c26e185a23349 --- /dev/null +++ b/src/lib/support/Compiler.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 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. + */ + +// CHIP_HAVE_RTTI: Is C++ RTTI enabled? +#if defined(__clang__) +#define CHIP_HAVE_RTTI __has_feature(cxx_rtti) +#elif defined(__GNUC__) && defined(__GXX_RTTI) +#define CHIP_HAVE_RTTI 1 +#else +#define CHIP_HAVE_RTTI 0 +#endif diff --git a/src/lib/support/ObjectDump.h b/src/lib/support/ObjectDump.h new file mode 100644 index 00000000000000..d297cd5b590141 --- /dev/null +++ b/src/lib/support/ObjectDump.h @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 2024 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 { + +/** + * A dumpable object that can log some useful state for debugging in fatal + * error scenarios by exposing a `void DumpToLog() const` method. The method + * should log key details about the state of object using ChipLogError(). + */ +template +struct IsDumpable : std::false_type +{ +}; +template +struct IsDumpable().DumpToLog())>> : std::true_type +{ +}; + +struct DumpableTypeExample +{ + void DumpToLog() const {}; +}; +static_assert(IsDumpable::value); + +/** + * Calls DumpToLog() on the object, if supported. + */ +template +void DumpObjectToLog([[maybe_unused]] const T * object) +{ + if constexpr (IsDumpable::value) + { + object->DumpToLog(); + } +} + +} // namespace chip diff --git a/src/lib/support/Pool.h b/src/lib/support/Pool.h index e4fb31769f4193..3ab4b8db6713ba 100644 --- a/src/lib/support/Pool.h +++ b/src/lib/support/Pool.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -263,7 +264,7 @@ class BitMapObjectPool : public internal::StaticAllocatorBitmap { public: BitMapObjectPool() : StaticAllocatorBitmap(mData.mMemory, mUsage, N, sizeof(T)) {} - ~BitMapObjectPool() { VerifyOrDie(Allocated() == 0); } + ~BitMapObjectPool() { VerifyOrDieWithObject(Allocated() == 0, this); } BitmapActiveObjectIterator begin() { return BitmapActiveObjectIterator(this, FirstActiveIndex()); } BitmapActiveObjectIterator end() { return BitmapActiveObjectIterator(this, N); } @@ -323,6 +324,18 @@ class BitMapObjectPool : public internal::StaticAllocatorBitmap return ForEachActiveObjectInner(&proxy, &internal::LambdaProxy::ConstCall); } + void DumpToLog() const + { + ChipLogError(Support, "BitMapObjectPool: %lu allocated", static_cast(Allocated())); + if constexpr (IsDumpable::value) + { + ForEachActiveObject([](const T * object) { + object->DumpToLog(); + return Loop::Continue; + }); + } + } + private: static Loop ReleaseObject(void * context, void * object) { @@ -389,7 +402,7 @@ class HeapObjectPool : public internal::Statistics, public HeapObjectPoolExitHan if (!sIgnoringLeaksOnExit) { // Verify that no live objects remain, to prevent potential use-after-free. - VerifyOrDie(Allocated() == 0); + VerifyOrDieWithObject(Allocated() == 0, this); } #endif // __SANITIZE_ADDRESS__ } @@ -570,6 +583,18 @@ class HeapObjectPool : public internal::Statistics, public HeapObjectPoolExitHan return mObjects.ForEachNode(&proxy, &internal::LambdaProxy::ConstCall); } + void DumpToLog() const + { + ChipLogError(Support, "HeapObjectPool: %lu allocated", static_cast(Allocated())); + if constexpr (IsDumpable::value) + { + ForEachActiveObject([](const T * object) { + object->DumpToLog(); + return Loop::Continue; + }); + } + } + private: static Loop ReleaseObject(void * context, void * object) { diff --git a/src/lib/support/logging/TextOnlyLogging.h b/src/lib/support/logging/TextOnlyLogging.h index dd9e73d0f5aeed..903624183a7d6c 100644 --- a/src/lib/support/logging/TextOnlyLogging.h +++ b/src/lib/support/logging/TextOnlyLogging.h @@ -36,6 +36,7 @@ #include +#include #include #include #include @@ -44,6 +45,7 @@ #include #include #include +#include #if CHIP_SYSTEM_CONFIG_PLATFORM_LOG && defined(CHIP_SYSTEM_CONFIG_PLATFORM_LOG_INCLUDE) #include CHIP_SYSTEM_CONFIG_PLATFORM_LOG_INCLUDE @@ -292,6 +294,24 @@ using LogRedirectCallback_t = void (*)(const char * module, uint8_t category, co #define ChipLogValueExchangeIdFromReceivedHeader(payloadHeader) \ ChipLogValueExchangeId((payloadHeader).GetExchangeID(), !(payloadHeader).IsInitiator()) +/** + * Logging helpers for logging the dynamic type of an object, if possible. + * + * Primarily useful when logging the type of delegates or similar objects when + * performing logging for a fatal error in DumpToLog(). + * + * Example: + * @code + * ChipLogError(Foo, "Delegate=" ChipLogFormatRtti, ChipLogValueRtti(mDelegate)); + * @endcode + */ +#define ChipLogFormatRtti "%s" +#if CHIP_HAVE_RTTI +#define ChipLogValueRtti(ptr) ((ptr) != nullptr ? typeid(*(ptr)).name() : "null") +#else +#define ChipLogValueRtti(ptr) ((ptr) != nullptr ? "?" : "null") +#endif + /** * Logging helpers for protocol ids. A protocol id is a (vendor-id, * protocol-id) pair. diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 554e5fbce9482d..62c5206f7b272e 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -294,7 +294,7 @@ ExchangeContext::ExchangeContext(ExchangeManager * em, uint16_t ExchangeId, cons mDispatch(GetMessageDispatch(isEphemeralExchange, delegate)), mSession(*this) { - VerifyOrDie(mExchangeMgr == nullptr); + VerifyOrDieWithObject(mExchangeMgr == nullptr, this); mExchangeMgr = em; mExchangeId = ExchangeId; @@ -334,12 +334,12 @@ ExchangeContext::ExchangeContext(ExchangeManager * em, uint16_t ExchangeId, cons ExchangeContext::~ExchangeContext() { - VerifyOrDie(mExchangeMgr != nullptr && GetReferenceCount() == 0); + VerifyOrDieWithObject(mExchangeMgr != nullptr && GetReferenceCount() == 0, this); // // Ensure that DoClose has been called by the time we get here. If not, we have a leak somewhere. // - VerifyOrDie(mFlags.Has(Flags::kFlagClosed)); + VerifyOrDieWithObject(mFlags.Has(Flags::kFlagClosed), this); #if CHIP_CONFIG_ENABLE_ICD_SERVER // TODO(#33075) : Add check for group context to not a req since it serves no purpose @@ -666,7 +666,7 @@ void ExchangeContext::AbortAllOtherCommunicationOnFabric() void ExchangeContext::ExchangeSessionHolder::GrabExpiredSession(const SessionHandle & session) { - VerifyOrDie(session->AsSecureSession()->IsPendingEviction()); + VerifyOrDieWithObject(session->AsSecureSession()->IsPendingEviction(), this); GrabUnchecked(session); } diff --git a/src/messaging/ExchangeContext.h b/src/messaging/ExchangeContext.h index 47cf0ddbef2783..e10ef84ce911be 100644 --- a/src/messaging/ExchangeContext.h +++ b/src/messaging/ExchangeContext.h @@ -158,7 +158,7 @@ class DLL_EXPORT ExchangeContext : public ReliableMessageContext, SessionHandle GetSessionHandle() const { - VerifyOrDie(mSession); + VerifyOrDieWithObject(mSession, this); auto sessionHandle = mSession.Get(); return std::move(sessionHandle.Value()); } @@ -238,6 +238,12 @@ class DLL_EXPORT ExchangeContext : public ReliableMessageContext, void ClearInjectedFailures() { mInjectedFailures.ClearAll(); } #endif + void DumpToLog() const + { + ChipLogError(ExchangeManager, "ExchangeContext: " ChipLogFormatExchangeId " delegate=" ChipLogFormatRtti, + ChipLogValueExchangeId(GetExchangeId(), IsInitiator()), ChipLogValueRtti(mDelegate)); + } + private: #if CONFIG_BUILD_FOR_HOST_UNIT_TEST BitFlags mInjectedFailures; diff --git a/src/messaging/tests/TestExchange.cpp b/src/messaging/tests/TestExchange.cpp index f221c999ac4e22..20df66f9d143d9 100644 --- a/src/messaging/tests/TestExchange.cpp +++ b/src/messaging/tests/TestExchange.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -219,4 +220,15 @@ TEST_F(TestExchange, CheckBasicExchangeMessageDispatch) }); } } + +// A crude test to exercise VerifyOrDieWithObject() in ObjectPool and +// the resulting DumpToLog() call on the ExchangeContext. +// TODO: Find a way to automate this test without killing the process. +// TEST_F(TestExchange, DumpExchangePoolToLog) +// { +// MockExchangeDelegate delegate; +// ObjectPool pool; +// pool.CreateObject(&GetExchangeManager(), static_cast(1234), GetSessionAliceToBob(), true, &delegate); +// } + } // namespace From 153c398551c91931f41039dcabeab5a7a5df8b2a Mon Sep 17 00:00:00 2001 From: Anu Biradar <104591549+abiradarti@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:21:21 -0500 Subject: [PATCH 41/63] [TI] CC13x4_26x4 build fixes (#34682) * lwip pbuf, map file, and hex creation when OTA is disabled * added cc13x4 family define around the non OTA hex creation * whitespace fix * reversed custom factoy data flash with cc13x4 check * more whitespace fixes --- examples/all-clusters-app/cc13x4_26x4/README.md | 2 +- .../all-clusters-app/cc13x4_26x4/main/AppTask.cpp | 8 +++++++- examples/lighting-app/cc13x4_26x4/README.md | 2 +- examples/lighting-app/cc13x4_26x4/src/AppTask.cpp | 8 +++++++- examples/lock-app/cc13x4_26x4/README.md | 2 +- examples/lock-app/cc13x4_26x4/src/AppTask.cpp | 11 ++++++++++- examples/pump-app/cc13x4_26x4/README.md | 2 +- examples/pump-app/cc13x4_26x4/main/AppTask.cpp | 10 +++++++++- examples/pump-controller-app/cc13x4_26x4/README.md | 2 +- .../pump-controller-app/cc13x4_26x4/main/AppTask.cpp | 11 ++++++++++- examples/shell/cc13x4_26x4/README.md | 2 +- src/lwip/cc13xx_26xx/lwipopts.h | 2 +- .../ti_simplelink_sdk/ti_simplelink_executable.gni | 3 +++ 13 files changed, 53 insertions(+), 12 deletions(-) diff --git a/examples/all-clusters-app/cc13x4_26x4/README.md b/examples/all-clusters-app/cc13x4_26x4/README.md index be6a38277edafc..b90e3933c351e5 100644 --- a/examples/all-clusters-app/cc13x4_26x4/README.md +++ b/examples/all-clusters-app/cc13x4_26x4/README.md @@ -109,7 +109,7 @@ Ninja to build the executable. to the GN call. ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"]" + gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"] chip_generate_link_map_file=true" ``` ## Programming diff --git a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp index 98926214c4cb36..88099f009f2dac 100644 --- a/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/all-clusters-app/cc13x4_26x4/main/AppTask.cpp @@ -76,8 +76,10 @@ AppTask AppTask::sAppTask; constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs); void CancelTimer(void); +#endif uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; @@ -100,9 +102,9 @@ void InitializeOTARequestor(void) sDownloader.SetImageProcessorDelegate(&sImageProcessor); sRequestorUser.Init(&sRequestorCore, &sImageProcessor); } -#endif TimerHandle_t sOTAInitTimer = 0; +#endif // The OTA Init Timer is only started upon the first Thread State Change // detected if the device is already on a Thread Network, or during the AppTask @@ -176,10 +178,12 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) #endif } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void OTAInitTimerEventHandler(TimerHandle_t xTimer) { InitializeOTARequestor(); } +#endif int AppTask::StartAppTask() { @@ -224,6 +228,7 @@ int AppTask::Init() ; } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Create FreeRTOS sw timer for OTA timer. sOTAInitTimer = xTimerCreate("OTAInitTmr", // Just a text name, not used by the RTOS kernel OTAREQUESTOR_INIT_TIMER_DELAY_MS, // timer period (mS) @@ -240,6 +245,7 @@ int AppTask::Init() { PLAT_LOG("sOTAInitTimer timer created successfully "); } +#endif ret = ThreadStackMgr().InitThreadStack(); if (ret != CHIP_NO_ERROR) diff --git a/examples/lighting-app/cc13x4_26x4/README.md b/examples/lighting-app/cc13x4_26x4/README.md index 73718a0bf76a86..5a6f6efb6a53ae 100644 --- a/examples/lighting-app/cc13x4_26x4/README.md +++ b/examples/lighting-app/cc13x4_26x4/README.md @@ -108,7 +108,7 @@ Ninja to build the executable. to the GN call. ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"]" + gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"] chip_generate_link_map_file=true" ``` ## Programming diff --git a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp index aa9bdbccefa3c3..6c4ffacdda2565 100644 --- a/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lighting-app/cc13x4_26x4/src/AppTask.cpp @@ -126,9 +126,9 @@ void InitializeOTARequestor(void) sDownloader.SetImageProcessorDelegate(&sImageProcessor); sRequestorUser.Init(&sRequestorCore, &sImageProcessor); } -#endif TimerHandle_t sOTAInitTimer = 0; +#endif // The OTA Init Timer is only started upon the first Thread State Change // detected if the device is already on a Thread Network, or during the AppTask @@ -215,10 +215,12 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void OTAInitTimerEventHandler(TimerHandle_t xTimer) { InitializeOTARequestor(); } +#endif int AppTask::Init() { @@ -239,6 +241,7 @@ int AppTask::Init() ; } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Create FreeRTOS sw timer for OTA timer. sOTAInitTimer = xTimerCreate("OTAInitTmr", // Just a text name, not used by the RTOS kernel OTAREQUESTOR_INIT_TIMER_DELAY_MS, // timer period (mS) @@ -255,6 +258,7 @@ int AppTask::Init() { PLAT_LOG("sOTAInitTimer timer created successfully "); } +#endif ret = ThreadStackMgr().InitThreadStack(); if (ret != CHIP_NO_ERROR) @@ -371,6 +375,7 @@ void AppTask::AppTaskMain(void * pvParameter) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs) { PLAT_LOG("Start OTA Init Timer") @@ -396,6 +401,7 @@ void CancelTimer(void) PLAT_LOG("sOTAInitTimer stop() failed"); } } +#endif void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) { diff --git a/examples/lock-app/cc13x4_26x4/README.md b/examples/lock-app/cc13x4_26x4/README.md index 7ff622a8e14f90..c7d15dcc8533fe 100644 --- a/examples/lock-app/cc13x4_26x4/README.md +++ b/examples/lock-app/cc13x4_26x4/README.md @@ -109,7 +109,7 @@ Ninja to build the executable. to the GN call. ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"]" + gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"] chip_generate_link_map_file=true" ``` ## Programming diff --git a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp index b26bd6ae43f8c1..f210aaf1a6e1de 100644 --- a/examples/lock-app/cc13x4_26x4/src/AppTask.cpp +++ b/examples/lock-app/cc13x4_26x4/src/AppTask.cpp @@ -94,8 +94,10 @@ void uiLocked(void); void uiUnlocking(void); void uiUnlocked(void); +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs); void CancelTimer(void); +#endif uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; @@ -118,10 +120,11 @@ void InitializeOTARequestor(void) sDownloader.SetImageProcessorDelegate(&sImageProcessor); sRequestorUser.Init(&sRequestorCore, &sImageProcessor); } -#endif TimerHandle_t sOTAInitTimer = 0; +#endif + // The OTA Init Timer is only started upon the first Thread State Change // detected if the device is already on a Thread Network, or during the AppTask // Init sequence if the device is not yet on a Thread Network. Once the timer @@ -207,10 +210,12 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void OTAInitTimerEventHandler(TimerHandle_t xTimer) { InitializeOTARequestor(); } +#endif int AppTask::Init() { @@ -230,6 +235,7 @@ int AppTask::Init() ; } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Create FreeRTOS sw timer for OTA timer. sOTAInitTimer = xTimerCreate("OTAInitTmr", // Just a text name, not used by the RTOS kernel OTAREQUESTOR_INIT_TIMER_DELAY_MS, // timer period (mS) @@ -246,6 +252,7 @@ int AppTask::Init() { PLAT_LOG("sOTAInitTimer timer created successfully "); } +#endif ret = ThreadStackMgr().InitThreadStack(); if (ret != CHIP_NO_ERROR) @@ -418,6 +425,7 @@ void AppTask::AppTaskMain(void * pvParameter) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs) { PLAT_LOG("Start OTA Init Timer") @@ -443,6 +451,7 @@ void CancelTimer(void) PLAT_LOG("sOTAInitTimer stop() failed"); } } +#endif void AppTask::ActionInitiated(LockManager::Action_t aAction) { diff --git a/examples/pump-app/cc13x4_26x4/README.md b/examples/pump-app/cc13x4_26x4/README.md index 1e7e0c33b2136a..5cd2e3c367be79 100644 --- a/examples/pump-app/cc13x4_26x4/README.md +++ b/examples/pump-app/cc13x4_26x4/README.md @@ -108,7 +108,7 @@ Ninja to build the executable. to the GN call. ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"]" + gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"] chip_generate_link_map_file=true" ``` ## Programming diff --git a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp index 9ec109313d3ad1..9c409b09256d8b 100644 --- a/examples/pump-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-app/cc13x4_26x4/main/AppTask.cpp @@ -96,8 +96,10 @@ AppTask AppTask::sAppTask; static DeviceCallbacks sDeviceCallbacks; +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs); void CancelTimer(void); +#endif uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; @@ -120,9 +122,9 @@ void InitializeOTARequestor(void) sDownloader.SetImageProcessorDelegate(&sImageProcessor); sRequestorUser.Init(&sRequestorCore, &sImageProcessor); } -#endif TimerHandle_t sOTAInitTimer = 0; +#endif // The OTA Init Timer is only started upon the first Thread State Change // detected if the device is already on a Thread Network, or during the AppTask @@ -171,10 +173,12 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void OTAInitTimerEventHandler(TimerHandle_t xTimer) { InitializeOTARequestor(); } +#endif int AppTask::StartAppTask() { @@ -217,6 +221,7 @@ int AppTask::Init() ; } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Create FreeRTOS sw timer for OTA timer. sOTAInitTimer = xTimerCreate("OTAInitTmr", // Just a text name, not used by the RTOS kernel OTAREQUESTOR_INIT_TIMER_DELAY_MS, // timer period (mS) @@ -233,6 +238,7 @@ int AppTask::Init() { PLAT_LOG("sOTAInitTimer timer created successfully "); } +#endif ret = ThreadStackMgr().InitThreadStack(); if (ret != CHIP_NO_ERROR) @@ -353,6 +359,7 @@ void AppTask::PostEvent(const AppEvent * aEvent) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs) { PLAT_LOG("Start OTA Init Timer") @@ -378,6 +385,7 @@ void CancelTimer(void) PLAT_LOG("sOTAInitTimer stop() failed"); } } +#endif void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) { diff --git a/examples/pump-controller-app/cc13x4_26x4/README.md b/examples/pump-controller-app/cc13x4_26x4/README.md index bd357fb25f2961..9b5eb0e693426d 100644 --- a/examples/pump-controller-app/cc13x4_26x4/README.md +++ b/examples/pump-controller-app/cc13x4_26x4/README.md @@ -110,7 +110,7 @@ Ninja to build the executable. to the GN call. ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"]" + gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"] chip_generate_link_map_file=true" ``` ## Programming diff --git a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp index a8d1e1d88f5cd3..d437da1c06d304 100644 --- a/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x4_26x4/main/AppTask.cpp @@ -83,8 +83,10 @@ static Button_Handle sAppRightHandle; AppTask AppTask::sAppTask; +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs); void CancelTimer(void); +#endif uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; @@ -107,10 +109,11 @@ void InitializeOTARequestor(void) sDownloader.SetImageProcessorDelegate(&sImageProcessor); sRequestorUser.Init(&sRequestorCore, &sImageProcessor); } -#endif TimerHandle_t sOTAInitTimer = 0; +#endif + // The OTA Init Timer is only started upon the first Thread State Change // detected if the device is already on a Thread Network, or during the AppTask // Init sequence if the device is not yet on a Thread Network. Once the timer @@ -199,10 +202,12 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void OTAInitTimerEventHandler(TimerHandle_t xTimer) { InitializeOTARequestor(); } +#endif int AppTask::Init() { @@ -222,6 +227,7 @@ int AppTask::Init() ; } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR // Create FreeRTOS sw timer for OTA timer. sOTAInitTimer = xTimerCreate("OTAInitTmr", // Just a text name, not used by the RTOS kernel OTAREQUESTOR_INIT_TIMER_DELAY_MS, // timer period (mS) @@ -238,6 +244,7 @@ int AppTask::Init() { PLAT_LOG("sOTAInitTimer timer created successfully "); } +#endif ret = ThreadStackMgr().InitThreadStack(); if (ret != CHIP_NO_ERROR) @@ -352,6 +359,7 @@ void AppTask::PostEvent(const AppEvent * aEvent) } } +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR void StartTimer(uint32_t aTimeoutMs) { PLAT_LOG("Start OTA Init Timer") @@ -377,6 +385,7 @@ void CancelTimer(void) PLAT_LOG("sOTAInitTimer stop() failed"); } } +#endif void AppTask::ActionInitiated(PumpManager::Action_t aAction, int32_t aActor) { diff --git a/examples/shell/cc13x4_26x4/README.md b/examples/shell/cc13x4_26x4/README.md index 3f1923f3db33af..2d5e53d5ec1b18 100644 --- a/examples/shell/cc13x4_26x4/README.md +++ b/examples/shell/cc13x4_26x4/README.md @@ -63,7 +63,7 @@ Ninja to build the executable. to the GN call. ``` - gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"]" + gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.18.1\" target_defines=[\"CC13X4_26X4_ATTESTATION_CREDENTIALS=1\"] chip_generate_link_map_file=true" ``` ## Programming diff --git a/src/lwip/cc13xx_26xx/lwipopts.h b/src/lwip/cc13xx_26xx/lwipopts.h index d89c33afb5ed84..26a1bb6641cb00 100644 --- a/src/lwip/cc13xx_26xx/lwipopts.h +++ b/src/lwip/cc13xx_26xx/lwipopts.h @@ -89,7 +89,7 @@ #define MEMP_SEPARATE_POOLS (1) #define LWIP_PBUF_FROM_CUSTOM_POOLS (0) #define MEMP_USE_CUSTOM_POOLS (0) -#define PBUF_POOL_SIZE (12) +#define PBUF_POOL_SIZE (18) #define PBUF_POOL_BUFSIZE (1280) #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni index 3df24854297f49..76a59df16bc370 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni @@ -484,6 +484,9 @@ template("ti_simplelink_executable") { } else { # The executable is the final target. data_deps = [ ":${simplelink_target_name}.out" ] + if (ti_simplelink_device_family == "cc13x4_26x4" && custom_factory_data) { + data_deps += [ ":${simplelink_target_name}-and-factory-data.hex" ] + } } if (defined(invoker.data_deps)) { From b2e22c7a0f15c09307d3a384dd8341c28a0b2004 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Wed, 31 Jul 2024 20:22:33 -0400 Subject: [PATCH 42/63] [ICD] Add missing polling function to NoWifi connectivity manager (#34684) * Add missing polling function to NoWifi connectivity manager * Update GenericConnectivityManagerImpl_NoWiFi.h Co-authored-by: Boris Zbarsky --------- Co-authored-by: Boris Zbarsky --- .../GenericConnectivityManagerImpl_NoWiFi.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h b/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h index e7d29ee4965a85..552603b492f115 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h @@ -78,6 +78,10 @@ class GenericConnectivityManagerImpl_NoWiFi static const char * _WiFiAPModeToStr(ConnectivityManager::WiFiAPMode mode); static const char * _WiFiStationStateToStr(ConnectivityManager::WiFiStationState state); static const char * _WiFiAPStateToStr(ConnectivityManager::WiFiAPState state); + // TODO ICD rework: ambiguous declaration of _SetPollingInterval when thread and no-wifi are both built together +#if CHIP_CONFIG_ENABLE_ICD_SERVER && !CHIP_DEVICE_CONFIG_ENABLE_THREAD + CHIP_ERROR _SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); +#endif private: ImplClass * Impl() { return static_cast(this); } @@ -221,6 +225,15 @@ inline const char * GenericConnectivityManagerImpl_NoWiFi::_WiFiAPSta return nullptr; } +#if CHIP_CONFIG_ENABLE_ICD_SERVER && !CHIP_DEVICE_CONFIG_ENABLE_THREAD +template +inline CHIP_ERROR +GenericConnectivityManagerImpl_NoWiFi::_SetPollingInterval(System::Clock::Milliseconds32 pollingInterval) +{ + return CHIP_ERROR_NOT_IMPLEMENTED; +} +#endif + } // namespace Internal } // namespace DeviceLayer } // namespace chip From 12d012366160ac8db7c377b4123d6fe89a409c39 Mon Sep 17 00:00:00 2001 From: Rob Bultman Date: Wed, 31 Jul 2024 21:03:32 -0400 Subject: [PATCH 43/63] [OPSTATE] Add Q test script for CountdownTime (#34632) * Add Q test * Added test to test set * Remove unused var * Restyled by autopep8 * Restyled by isort * Fix name * Use pics over other method * Removed unused stuff * Added pipe commands * Fix reset * Get example to report appropriate changes. * WiP * Added some comments * Changes to make things work * Removed dev msgs * Missed some * Removed dev msgs * Straggler * Restyled by clang-format * Restyled by autopep8 * Restyled by isort * Commented unused var * Update examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp * Fix bug --------- Co-authored-by: Restyled.io --- .github/workflows/tests.yaml | 1 + .../include/operational-state-delegate-impl.h | 1 + .../src/operational-state-delegate-impl.cpp | 15 +++ .../linux/AllClustersCommandDelegate.cpp | 50 +++++++- .../linux/AllClustersCommandDelegate.h | 10 ++ src/python_testing/TC_OPSTATE_2_6.py | 62 ++++++++++ src/python_testing/TC_OpstateCommon.py | 112 +++++++++++++++++- 7 files changed, 247 insertions(+), 4 deletions(-) create mode 100644 src/python_testing/TC_OPSTATE_2_6.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b9b8289c270935..89b5d57db9f70d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -580,6 +580,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPSTATE_2_3.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPSTATE_2_4.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPSTATE_2_5.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OPSTATE_2_6.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OVENOPSTATE_2_1.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OVENOPSTATE_2_2.py' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_OVENOPSTATE_2_3.py' diff --git a/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h b/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h index 60b6b09e9b6511..badadd68cd30a9 100644 --- a/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h +++ b/examples/all-clusters-app/all-clusters-common/include/operational-state-delegate-impl.h @@ -138,6 +138,7 @@ class OperationalStateDelegate : public GenericOperationalStateDelegateImpl }; Instance * GetOperationalStateInstance(); +OperationalStateDelegate * GetOperationalStateDelegate(); void Shutdown(); diff --git a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp index d258b8261a1aed..d4a91cf259a2a7 100644 --- a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp @@ -59,6 +59,7 @@ void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperat auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)); if (error == CHIP_NO_ERROR) { + GetInstance()->UpdateCountdownTimeFromDelegate(); err.Set(to_underlying(ErrorStateEnum::kNoError)); } else @@ -73,6 +74,7 @@ void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOpera auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) { + GetInstance()->UpdateCountdownTimeFromDelegate(); err.Set(to_underlying(ErrorStateEnum::kNoError)); } else @@ -96,6 +98,7 @@ void GenericOperationalStateDelegateImpl::HandleStartStateCallback(GenericOperat auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) { + GetInstance()->UpdateCountdownTimeFromDelegate(); (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onOperationalStateTimerTick, this); err.Set(to_underlying(ErrorStateEnum::kNoError)); } @@ -113,6 +116,8 @@ void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperati { (void) DeviceLayer::SystemLayer().CancelTimer(onOperationalStateTimerTick, this); + GetInstance()->UpdateCountdownTimeFromDelegate(); + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); GetInstance()->GetCurrentOperationalError(current_err); @@ -152,6 +157,11 @@ static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data delegate->mPausedTime++; } } + else if (!countdown_time.IsNull() && countdown_time.Value() <= 0) + { + OperationalState::GenericOperationalError noError(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + delegate->HandleStopStateCallback(noError); + } if (state == OperationalState::OperationalStateEnum::kRunning || state == OperationalState::OperationalStateEnum::kPaused) { @@ -173,6 +183,11 @@ OperationalState::Instance * OperationalState::GetOperationalStateInstance() return gOperationalStateInstance; } +OperationalStateDelegate * OperationalState::GetOperationalStateDelegate() +{ + return gOperationalStateDelegate; +} + void OperationalState::Shutdown() { if (gOperationalStateInstance != nullptr) diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp index d620731e93dc5c..6c1467fc62a145 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp @@ -667,21 +667,65 @@ void AllClustersAppCommandHandler::OnModeChangeHandler(std::string device, std:: void AllClustersAppCommandHandler::OnOperationalStateChange(std::string device, std::string operation, Json::Value param) { - OperationalState::Instance * operationalStateInstance = nullptr; if (device == "Generic") { - operationalStateInstance = OperationalState::GetOperationalStateInstance(); + OnGenericOperationalStateChange(device, operation, param); } else if (device == "Oven") { - operationalStateInstance = OvenCavityOperationalState::GetOperationalStateInstance(); + OnOvenOperationalStateChange(device, operation, param); } else { ChipLogDetail(NotSpecified, "Invalid device type : %s", device.c_str()); return; } +} + +void AllClustersAppCommandHandler::OnGenericOperationalStateChange(std::string device, std::string operation, Json::Value param) +{ + OperationalState::Instance * operationalStateInstance = OperationalState::GetOperationalStateInstance(); + OperationalState::OperationalStateDelegate * operationalStateDelegate = OperationalState::GetOperationalStateDelegate(); + OperationalState::GenericOperationalError noError(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + OperationalState::OperationalStateEnum state = + static_cast(operationalStateInstance->GetCurrentOperationalState()); + if (operation == "Start") + { + operationalStateDelegate->HandleStartStateCallback(noError); + } + else if (operation == "Resume") + { + operationalStateDelegate->HandleResumeStateCallback(noError); + } + else if (operation == "Pause") + { + operationalStateDelegate->HandlePauseStateCallback(noError); + } + else if (operation == "Stop" && state == OperationalState::OperationalStateEnum::kRunning) + { + operationalStateDelegate->HandleStopStateCallback(noError); + } + else if (operation == "OnFault") + { + uint8_t event_id = to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation); + if (!param.isNull()) + { + event_id = to_underlying(static_cast(param.asUInt())); + } + OperationalState::GenericOperationalError err(event_id); + operationalStateInstance->OnOperationalErrorDetected(err); + } + else + { + ChipLogDetail(NotSpecified, "Invalid operation : %s", operation.c_str()); + return; + } +} + +void AllClustersAppCommandHandler::OnOvenOperationalStateChange(std::string device, std::string operation, Json::Value param) +{ + OperationalState::Instance * operationalStateInstance = OvenCavityOperationalState::GetOperationalStateInstance(); if (operation == "Start" || operation == "Resume") { operationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); diff --git a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h index f097c539b54fb6..f1b873fc0d69c4 100644 --- a/examples/all-clusters-app/linux/AllClustersCommandDelegate.h +++ b/examples/all-clusters-app/linux/AllClustersCommandDelegate.h @@ -105,6 +105,16 @@ class AllClustersAppCommandHandler * Should be called when it is necessary to change the operational state as a manual operation. */ void OnOperationalStateChange(std::string device, std::string operation, Json::Value param); + + /** + * Should be called when it is necessary to change the operational state as a manual operation. + */ + void OnGenericOperationalStateChange(std::string device, std::string operation, Json::Value param); + + /** + * Should be called when it is necessary to change the operational state as a manual operation. + */ + void OnOvenOperationalStateChange(std::string device, std::string operation, Json::Value param); }; class AllClustersCommandDelegate : public NamedPipeCommandDelegate diff --git a/src/python_testing/TC_OPSTATE_2_6.py b/src/python_testing/TC_OPSTATE_2_6.py new file mode 100644 index 00000000000000..8560452b327712 --- /dev/null +++ b/src/python_testing/TC_OPSTATE_2_6.py @@ -0,0 +1,62 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_OpstateCommon import TC_OPSTATE_BASE, TestInfo + + +class TC_OPSTATE_2_6(MatterBaseTest, TC_OPSTATE_BASE): + def __init__(self, *args): + super().__init__(*args) + + test_info = TestInfo( + pics_code="OPSTATE", + cluster=Clusters.OperationalState + ) + + super().setup_base(test_info=test_info) + + def steps_TC_OPSTATE_2_6(self) -> list[TestStep]: + return self.steps_TC_OPSTATE_BASE_2_6() + + def pics_TC_OPSTATE_2_6(self) -> list[str]: + return ["OPSTATE.S", "OPSTATE.S.A0002"] + + @async_test_body + async def test_TC_OPSTATE_2_6(self): + # endpoint = self.matter_test_config.endpoint + + # await self.TEST_TC_OPSTATE_BASE_2_6(endpoint=endpoint) + await self.TEST_TC_OPSTATE_BASE_2_6(endpoint=1) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_OpstateCommon.py b/src/python_testing/TC_OpstateCommon.py index 09dc73e3344c1f..ece50ac90c65b6 100644 --- a/src/python_testing/TC_OpstateCommon.py +++ b/src/python_testing/TC_OpstateCommon.py @@ -28,7 +28,7 @@ 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 EventChangeCallback, TestStep +from matter_testing_support import ClusterAttributeChangeAccumulator, EventChangeCallback, TestStep from mobly import asserts @@ -1082,6 +1082,7 @@ async def TEST_TC_OPSTATE_BASE_2_5(self, endpoint=1): # STEP 7: TH waits for initial-countdown-time self.step(7) + logging.info(f'Sleeping for {initial_countdown_time:.1f} seconds.') time.sleep(initial_countdown_time) # STEP 8: TH sends Stop command to the DUT @@ -1221,3 +1222,112 @@ async def TEST_TC_OPSTATE_BASE_2_5(self, endpoint=1): self.skip_step(20) self.skip_step(21) self.skip_step(22) + + ############################ + # TEST CASE 2.6 - Optional Reports with DUT as Server + ############################ + def steps_TC_OPSTATE_BASE_2_6(self) -> list[TestStep]: + steps = [TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "Subscribe to CountdownTime attribute"), + TestStep(3, "Manually put the DUT into a state where it will use the CountdownTime attribute, " + "the initial value of the CountdownTime is greater than 30, " + "and it will begin counting down the CountdownTime attribute."), + TestStep(4, "Over a period of 30 seconds, TH counts all report transactions with an attribute " + "report for the CountdownTime attribute in numberOfReportsReceived"), + TestStep(5, "Until the current operation finishes, TH counts all report transactions with " + "an attribute report for the CountdownTime attribute in numberOfReportsReceived and saves up to 5 such reports."), + TestStep(6, "Manually put the DUT into a state where it will use the CountdownTime attribute, " + "the initial value of the CountdownTime is greater than 30, and it will begin counting down the CountdownTime attribute."), + TestStep(7, "TH reads from the DUT the OperationalState attribute"), + TestStep(8, "Manually put the device in the Paused(0x02) operational state") + ] + return steps + + async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1): + cluster = self.test_info.cluster + attributes = cluster.Attributes + + self.init_test() + + # commission + self.step(1) + + # Note that this does a subscribe-all instead of subscribing only to the CountdownTime attribute. + # To-Do: Update the TP to subscribe-all. + self.step(2) + sub_handler = ClusterAttributeChangeAccumulator(cluster) + await sub_handler.start(self.default_controller, self.dut_node_id, endpoint) + + self.step(3) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_RUNNING")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Start") + time.sleep(1) + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + count = sub_handler.attribute_report_counts[attributes.CountdownTime] + asserts.assert_greater(count, 0, "Did not receive any reports for CountdownTime") + else: + self.skip_step(3) + + sub_handler.reset() + self.step(4) + logging.info('Test will now collect data for 30 seconds') + time.sleep(30) + + count = sub_handler.attribute_report_counts[attributes.CountdownTime] + sub_handler.reset() + asserts.assert_less_equal(count, 5, "Received more than 5 reports for CountdownTime") + asserts.assert_greater_equal(count, 0, "Did not receive any reports for CountdownTime") + + attr_value = await self.read_expect_success( + endpoint=endpoint, + attribute=attributes.OperationalState) + if attr_value == cluster.Enums.OperationalStateEnum.kRunning: + self.step(5) + wait_count = 0 + while (attr_value != cluster.Enums.OperationalStateEnum.kStopped) and (wait_count < 20): + time.sleep(1) + wait_count = wait_count + 1 + attr_value = await self.read_expect_success( + endpoint=endpoint, + attribute=attributes.OperationalState) + count = sub_handler.attribute_report_counts[attributes.CountdownTime] + asserts.assert_less_equal(count, 5, "Received more than 5 reports for CountdownTime") + asserts.assert_greater(count, 0, "Did not receive any reports for CountdownTime") + else: + self.skip_step(5) + + sub_handler.reset() + self.step(6) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_RUNNING")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Start") + time.sleep(1) + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + count = sub_handler.attribute_report_counts[attributes.CountdownTime] + asserts.assert_greater(count, 0, "Did not receive any reports for CountdownTime") + else: + self.skip_step(6) + + self.step(7) + await self.read_and_expect_value(endpoint=endpoint, + attribute=attributes.OperationalState, + expected_value=cluster.Enums.OperationalStateEnum.kRunning) + + sub_handler.reset() + self.step(8) + if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_PAUSED")): + self.send_manual_or_pipe_command(name="OperationalStateChange", + device=self.device, + operation="Pause") + time.sleep(1) + count = sub_handler.attribute_report_counts[attributes.CountdownTime] + asserts.assert_greater(count, 0, "Did not receive any reports for CountdownTime") + else: + self.skip_step(8) From 9351279df41162efd32805008bbd2955a19ce2d9 Mon Sep 17 00:00:00 2001 From: Douglas Rocha Ferraz Date: Wed, 31 Jul 2024 21:09:23 -0400 Subject: [PATCH 44/63] YAML update to BRBINFO, ProductId (#34513) * Bridged Device Information Cluster, Attribute ProductID test reflects marking as O, not X * Update src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml Co-authored-by: Terence Hampson * corrected pics * corrected pics * WIP Bridged ICD, commissioning to both fabrics * wip testing sending KeepActive * update to bridged-device-basic-information.xml and zap generated files * removed unrelated file --------- Co-authored-by: Terence Hampson Co-authored-by: Andrei Litvin --- .../placeholder/linux/apps/app1/config.matter | 1 + .../placeholder/linux/apps/app2/config.matter | 1 + .../certification/Test_TC_BRBINFO_2_1.yaml | 22 ++--- .../chip/bridged-device-basic-information.xml | 1 + .../data_model/controller-clusters.matter | 1 + .../chip/devicecontroller/ChipClusters.java | 27 ++++++ .../devicecontroller/ClusterIDMapping.java | 1 + .../devicecontroller/ClusterReadMapping.java | 11 +++ .../BridgedDeviceBasicInformationCluster.kt | 91 +++++++++++++++++++ .../CHIPAttributeTLVValueDecoder.cpp | 16 ++++ .../python/chip/clusters/CHIPClusters.py | 6 ++ .../python/chip/clusters/Objects.py | 18 ++++ .../MTRAttributeSpecifiedCheck.mm | 3 + .../MTRAttributeTLVValueDecoder.mm | 11 +++ .../CHIP/zap-generated/MTRBaseClusters.h | 6 ++ .../CHIP/zap-generated/MTRBaseClusters.mm | 36 ++++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 1 + .../CHIP/zap-generated/MTRClusterNames.mm | 4 + .../CHIP/zap-generated/MTRClusters.h | 2 + .../CHIP/zap-generated/MTRClusters.mm | 5 + .../zap-generated/attributes/Accessors.cpp | 47 ++++++++++ .../zap-generated/attributes/Accessors.h | 6 ++ .../zap-generated/cluster-objects.cpp | 2 + .../zap-generated/cluster-objects.h | 13 +++ .../app-common/zap-generated/ids/Attributes.h | 4 + .../zap-generated/cluster/Commands.h | 5 + .../cluster/logging/DataModelLogger.cpp | 5 + .../zap-generated/cluster/Commands.h | 91 +++++++++++++++++++ 28 files changed, 423 insertions(+), 14 deletions(-) diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 3e7fcf78a9ed7e..47e9c038ee4b88 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -2476,6 +2476,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<32> vendorName = 1; readonly attribute optional vendor_id vendorID = 2; readonly attribute optional char_string<32> productName = 3; + readonly attribute optional int16u productID = 4; attribute optional char_string<32> nodeLabel = 5; readonly attribute optional int16u hardwareVersion = 7; readonly attribute optional char_string<64> hardwareVersionString = 8; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index ba2240fb33f38d..5c56ce1e4f72e0 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -2433,6 +2433,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<32> vendorName = 1; readonly attribute optional vendor_id vendorID = 2; readonly attribute optional char_string<32> productName = 3; + readonly attribute optional int16u productID = 4; attribute optional char_string<32> nodeLabel = 5; readonly attribute optional int16u hardwareVersion = 7; readonly attribute optional char_string<64> hardwareVersionString = 8; diff --git a/src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml b/src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml index a0b87e6c3897b9..b869f2d99ee8f0 100644 --- a/src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_BRBINFO_2_1.yaml @@ -140,21 +140,15 @@ tests: response: value: ProductNameValue - - label: - "Step 14: TH reads attribute ID 4 from the DUT (matches in ID to - ProductID in the parent cluster, but is absent on the - BridgedDeviceBasicInformation cluster)." - PICS: BRBINFO.S - cluster: "AnyCommands" - command: "ReadById" - arguments: - values: - - name: "ClusterId" - value: BRBINFO.ClusterId - - name: "AttributeId" - value: 0x0004 + - label: "Step 14: TH reads ProductID from the DUT" + PICS: BRBINFO.S.A0004 + command: "readAttribute" + attribute: "ProductID" response: - error: UNSUPPORTED_ATTRIBUTE + constraints: + type: int16u + minValue: 1 + maxValue: 65534 - label: "Step 17: TH reads NodeLabel from the DUT" PICS: BRBINFO.S.A0005 diff --git a/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml b/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml index 74f88bea39e623..b33ccb740f9a54 100644 --- a/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml +++ b/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml @@ -80,6 +80,7 @@ limitations under the License. VendorName VendorID ProductName + ProductID NodeLabel HardwareVersion HardwareVersionString diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 65158fb239c9b4..b2e8b2cc7836c1 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2359,6 +2359,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<32> vendorName = 1; readonly attribute optional vendor_id vendorID = 2; readonly attribute optional char_string<32> productName = 3; + readonly attribute optional int16u productID = 4; attribute optional char_string<32> nodeLabel = 5; readonly attribute optional int16u hardwareVersion = 7; readonly attribute optional char_string<64> hardwareVersionString = 8; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 1c299b84cc028d..6cb7e845025f7b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -15166,6 +15166,7 @@ public static class BridgedDeviceBasicInformationCluster extends BaseChipCluster private static final long VENDOR_NAME_ATTRIBUTE_ID = 1L; private static final long VENDOR_I_D_ATTRIBUTE_ID = 2L; private static final long PRODUCT_NAME_ATTRIBUTE_ID = 3L; + private static final long PRODUCT_I_D_ATTRIBUTE_ID = 4L; private static final long NODE_LABEL_ATTRIBUTE_ID = 5L; private static final long HARDWARE_VERSION_ATTRIBUTE_ID = 7L; private static final long HARDWARE_VERSION_STRING_ATTRIBUTE_ID = 8L; @@ -15314,6 +15315,32 @@ public void onSuccess(byte[] tlv) { }, PRODUCT_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readProductIDAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PRODUCT_I_D_ATTRIBUTE_ID, true); + } + + public void subscribeProductIDAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readNodeLabelAttribute( CharStringAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NODE_LABEL_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 43818c8900be84..e073912517d978 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -4460,6 +4460,7 @@ public enum Attribute { VendorName(1L), VendorID(2L), ProductName(3L), + ProductID(4L), NodeLabel(5L), HardwareVersion(7L), HardwareVersionString(8L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index d876ecfa018fc3..787ae03471e1eb 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -4659,6 +4659,17 @@ private static Map readBridgedDeviceBasicInformationInt readBridgedDeviceBasicInformationProductNameCommandParams ); result.put("readProductNameAttribute", readBridgedDeviceBasicInformationProductNameAttributeInteractionInfo); + Map readBridgedDeviceBasicInformationProductIDCommandParams = new LinkedHashMap(); + InteractionInfo readBridgedDeviceBasicInformationProductIDAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.BridgedDeviceBasicInformationCluster) cluster).readProductIDAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readBridgedDeviceBasicInformationProductIDCommandParams + ); + result.put("readProductIDAttribute", readBridgedDeviceBasicInformationProductIDAttributeInteractionInfo); Map readBridgedDeviceBasicInformationNodeLabelCommandParams = new LinkedHashMap(); InteractionInfo readBridgedDeviceBasicInformationNodeLabelAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt index 64742323eec50c..8e56362d8da349 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt @@ -395,6 +395,97 @@ class BridgedDeviceBasicInformationCluster( } } + suspend fun readProductIDAttribute(): UShort? { + val ATTRIBUTE_ID: UInt = 4u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Productid attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun subscribeProductIDAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 4u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Productid attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UShortSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readNodeLabelAttribute(): String? { val ATTRIBUTE_ID: UInt = 5u diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index dfa938c8fd7be5..7fdd6114e99148 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -10140,6 +10140,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(cppValue, value)); return value; } + case Attributes::ProductID::Id: { + using TypeInfo = Attributes::ProductID::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::NodeLabel::Id: { using TypeInfo = Attributes::NodeLabel::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 2df7a4e29a11ed..44c78c0fd0e7f3 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -3324,6 +3324,12 @@ class ChipClusters: "type": "str", "reportable": True, }, + 0x00000004: { + "attributeName": "ProductID", + "attributeId": 0x00000004, + "type": "int", + "reportable": True, + }, 0x00000005: { "attributeName": "NodeLabel", "attributeId": 0x00000005, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index c800ab739d7da0..c72db3785ac03b 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -11683,6 +11683,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="vendorName", Tag=0x00000001, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="vendorID", Tag=0x00000002, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="productName", Tag=0x00000003, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="productID", Tag=0x00000004, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="nodeLabel", Tag=0x00000005, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="hardwareVersion", Tag=0x00000007, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="hardwareVersionString", Tag=0x00000008, Type=typing.Optional[str]), @@ -11707,6 +11708,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: vendorName: 'typing.Optional[str]' = None vendorID: 'typing.Optional[uint]' = None productName: 'typing.Optional[str]' = None + productID: 'typing.Optional[uint]' = None nodeLabel: 'typing.Optional[str]' = None hardwareVersion: 'typing.Optional[uint]' = None hardwareVersionString: 'typing.Optional[str]' = None @@ -11853,6 +11855,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[str]' = None + @dataclass + class ProductID(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000039 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + @dataclass class NodeLabel(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index a3de4ef1109c5b..2352e4f70941fe 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -1530,6 +1530,9 @@ static BOOL AttributeIsSpecifiedInBridgedDeviceBasicInformationCluster(Attribute case Attributes::ProductName::Id: { return YES; } + case Attributes::ProductID::Id: { + return YES; + } case Attributes::NodeLabel::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 5cb0dbe4ee0500..0187c598f9ffab 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -4450,6 +4450,17 @@ static id _Nullable DecodeAttributeValueForBridgedDeviceBasicInformationCluster( } return value; } + case Attributes::ProductID::Id: { + using TypeInfo = Attributes::ProductID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } case Attributes::NodeLabel::Id: { using TypeInfo = Attributes::NodeLabel::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 51ca35306f057d..e5e21cc992188f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -3744,6 +3744,12 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeProductNameWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)readAttributeProductIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeProductIDWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeProductIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeNodeLabelWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeNodeLabelWithValue:(NSString * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeNodeLabelWithValue:(NSString * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 399f6b3eb1dc78..c7a41dfa237381 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -31056,6 +31056,42 @@ + (void)readAttributeProductNameWithClusterStateCache:(MTRClusterStateCacheConta completion:completion]; } +- (void)readAttributeProductIDWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = BridgedDeviceBasicInformation::Attributes::ProductID::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeProductIDWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = BridgedDeviceBasicInformation::Attributes::ProductID::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeProductIDWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = BridgedDeviceBasicInformation::Attributes::ProductID::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + - (void)readAttributeNodeLabelWithCompletion:(void (^)(NSString * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = BridgedDeviceBasicInformation::Attributes::NodeLabel::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 295812a73af9ff..e2b7de84eda696 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -1945,6 +1945,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeVendorNameID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000001, MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeVendorIDID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000002, MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeProductNameID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000003, + MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeProductIDID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeNodeLabelID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000005, MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeHardwareVersionID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000007, MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeHardwareVersionStringID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000008, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 2e1ec4eb7954a4..81911e1c559358 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -2391,6 +2391,10 @@ result = @"ProductName"; break; + case MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeProductIDID: + result = @"ProductID"; + break; + case MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeNodeLabelID: result = @"NodeLabel"; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 1a29479ff91364..bf694242a5885f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -1722,6 +1722,8 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - (NSDictionary * _Nullable)readAttributeProductNameWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (NSDictionary * _Nullable)readAttributeProductIDWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeNodeLabelWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeNodeLabelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeNodeLabelWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index f2e26ddeb37057..a3a608cb8a6cb4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -5070,6 +5070,11 @@ - (void)keepActiveWithParams:(MTRBridgedDeviceBasicInformationClusterKeepActiveP return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeBridgedDeviceBasicInformationID) attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeProductNameID) params:params]; } +- (NSDictionary * _Nullable)readAttributeProductIDWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeBridgedDeviceBasicInformationID) attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeProductIDID) params:params]; +} + - (NSDictionary * _Nullable)readAttributeNodeLabelWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeBridgedDeviceBasicInformationID) attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicInformationAttributeNodeLabelID) params:params]; 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 8bbd0e88106dfa..f1bcd8c528be3f 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 @@ -7697,6 +7697,53 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpa } // namespace ProductName +namespace ProductID { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::BridgedDeviceBasicInformation::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::BridgedDeviceBasicInformation::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, + markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::BridgedDeviceBasicInformation::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ProductID + namespace NodeLabel { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & 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 1e8578b26b2871..51c89921d13cdf 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 @@ -1225,6 +1225,12 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpa Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan value, MarkAttributeDirty markDirty); } // namespace ProductName +namespace ProductID { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace ProductID + namespace NodeLabel { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::MutableCharSpan & value); // char_string Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::CharSpan 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 f3b35e71306a94..b8a0234a172d59 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 @@ -8269,6 +8269,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, vendorID); case Attributes::ProductName::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, productName); + case Attributes::ProductID::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, productID); case Attributes::NodeLabel::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, nodeLabel); case Attributes::HardwareVersion::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 58b2630314540d..27a51680533443 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 @@ -11158,6 +11158,18 @@ struct TypeInfo static constexpr size_t MaxLength() { return 32; } }; } // namespace ProductName +namespace ProductID { +struct TypeInfo +{ + using Type = uint16_t; + using DecodableType = uint16_t; + using DecodableArgType = uint16_t; + + static constexpr ClusterId GetClusterId() { return Clusters::BridgedDeviceBasicInformation::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ProductID::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ProductID namespace NodeLabel { struct TypeInfo { @@ -11372,6 +11384,7 @@ struct TypeInfo Attributes::VendorName::TypeInfo::DecodableType vendorName; Attributes::VendorID::TypeInfo::DecodableType vendorID = static_cast(0); Attributes::ProductName::TypeInfo::DecodableType productName; + Attributes::ProductID::TypeInfo::DecodableType productID = static_cast(0); Attributes::NodeLabel::TypeInfo::DecodableType nodeLabel; Attributes::HardwareVersion::TypeInfo::DecodableType hardwareVersion = static_cast(0); Attributes::HardwareVersionString::TypeInfo::DecodableType hardwareVersionString; 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 ad2661c8adfe13..d825736f7a45c6 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 @@ -1894,6 +1894,10 @@ namespace ProductName { static constexpr AttributeId Id = 0x00000003; } // namespace ProductName +namespace ProductID { +static constexpr AttributeId Id = 0x00000004; +} // namespace ProductID + namespace NodeLabel { static constexpr AttributeId Id = 0x00000005; } // namespace NodeLabel diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index fcf4ab45d12d66..8857ad9aaa82d3 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -3489,6 +3489,7 @@ class TimeSynchronizationSetDefaultNTP : public ClusterCommand | * VendorName | 0x0001 | | * VendorID | 0x0002 | | * ProductName | 0x0003 | +| * ProductID | 0x0004 | | * NodeLabel | 0x0005 | | * HardwareVersion | 0x0007 | | * HardwareVersionString | 0x0008 | @@ -18200,6 +18201,7 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands, Credentia make_unique(Id, "vendor-name", Attributes::VendorName::Id, credsIssuerConfig), // make_unique(Id, "vendor-id", Attributes::VendorID::Id, credsIssuerConfig), // make_unique(Id, "product-name", Attributes::ProductName::Id, credsIssuerConfig), // + make_unique(Id, "product-id", Attributes::ProductID::Id, credsIssuerConfig), // make_unique(Id, "node-label", Attributes::NodeLabel::Id, credsIssuerConfig), // make_unique(Id, "hardware-version", Attributes::HardwareVersion::Id, credsIssuerConfig), // make_unique(Id, "hardware-version-string", Attributes::HardwareVersionString::Id, credsIssuerConfig), // @@ -18226,6 +18228,8 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands, Credentia WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "product-name", Attributes::ProductName::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "product-id", 0, UINT16_MAX, Attributes::ProductID::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "node-label", Attributes::NodeLabel::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "hardware-version", 0, UINT16_MAX, Attributes::HardwareVersion::Id, @@ -18270,6 +18274,7 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands, Credentia make_unique(Id, "vendor-name", Attributes::VendorName::Id, credsIssuerConfig), // make_unique(Id, "vendor-id", Attributes::VendorID::Id, credsIssuerConfig), // make_unique(Id, "product-name", Attributes::ProductName::Id, credsIssuerConfig), // + make_unique(Id, "product-id", Attributes::ProductID::Id, credsIssuerConfig), // make_unique(Id, "node-label", Attributes::NodeLabel::Id, credsIssuerConfig), // make_unique(Id, "hardware-version", Attributes::HardwareVersion::Id, credsIssuerConfig), // make_unique(Id, "hardware-version-string", Attributes::HardwareVersionString::Id, credsIssuerConfig), // 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 27c1e8f4776d5c..57860663e7d2e8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -11102,6 +11102,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("ProductName", 1, value); } + case BridgedDeviceBasicInformation::Attributes::ProductID::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ProductID", 1, value); + } case BridgedDeviceBasicInformation::Attributes::NodeLabel::Id: { chip::CharSpan value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, 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 841ed9eb772990..1d35688254998d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -40149,6 +40149,7 @@ class SubscribeAttributeTimeSynchronizationClusterRevision : public SubscribeAtt | * VendorName | 0x0001 | | * VendorID | 0x0002 | | * ProductName | 0x0003 | +| * ProductID | 0x0004 | | * NodeLabel | 0x0005 | | * HardwareVersion | 0x0007 | | * HardwareVersionString | 0x0008 | @@ -40477,6 +40478,92 @@ class SubscribeAttributeBridgedDeviceBasicInformationProductName : public Subscr } }; +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ProductID + */ +class ReadBridgedDeviceBasicInformationProductID : public ReadAttribute { +public: + ReadBridgedDeviceBasicInformationProductID() + : ReadAttribute("product-id") + { + } + + ~ReadBridgedDeviceBasicInformationProductID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductID::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 = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeProductIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"BridgedDeviceBasicInformation.ProductID response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("BridgedDeviceBasicInformation ProductID read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeBridgedDeviceBasicInformationProductID : public SubscribeAttribute { +public: + SubscribeAttributeBridgedDeviceBasicInformationProductID() + : SubscribeAttribute("product-id") + { + } + + ~SubscribeAttributeBridgedDeviceBasicInformationProductID() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductID::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 = [[MTRBaseClusterBridgedDeviceBasicInformation 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 subscribeAttributeProductIDWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"BridgedDeviceBasicInformation.ProductID 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 + /* * Attribute NodeLabel */ @@ -192255,6 +192342,10 @@ void registerClusterBridgedDeviceBasicInformation(Commands & commands) make_unique(), // make_unique(), // make_unique(), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // From 08cb38b3696221f6137dc09f85e86c319638f6f0 Mon Sep 17 00:00:00 2001 From: Shao Ling Tan <161761051+shaoltan-amazon@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:25:28 -0700 Subject: [PATCH 45/63] Fix simplified Linux tv-casting-app gn build error. (#34692) --- examples/tv-casting-app/linux/BUILD.gn | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/tv-casting-app/linux/BUILD.gn b/examples/tv-casting-app/linux/BUILD.gn index 0e4b9820538412..3a6cfb1e6f82f6 100644 --- a/examples/tv-casting-app/linux/BUILD.gn +++ b/examples/tv-casting-app/linux/BUILD.gn @@ -58,10 +58,12 @@ executable("chip-tv-casting-app") { if (chip_build_libshell) { defines += [ "ENABLE_CHIP_SHELL" ] - sources += [ - "CastingShellCommands.cpp", - "CastingShellCommands.h", - ] + if (!chip_casting_simplified) { + sources += [ + "CastingShellCommands.cpp", + "CastingShellCommands.h", + ] + } } output_dir = root_out_dir From ee27016a3f235cc16fd22ef1900f61f349deab29 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Thu, 1 Aug 2024 04:27:52 +0200 Subject: [PATCH 46/63] adding parallel execution to restyle-diff (#34663) * adding parallel execution to restyle-diff * using xargs to call restyle-paths * fixing Copyright year * restyle the restyler --- scripts/helpers/restyle-diff.sh | 66 +++++++++++++++++---------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/scripts/helpers/restyle-diff.sh b/scripts/helpers/restyle-diff.sh index 5cc9ffa6b081fc..5f37c69762e281 100755 --- a/scripts/helpers/restyle-diff.sh +++ b/scripts/helpers/restyle-diff.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # -# Copyright (c) 2020 Project CHIP Authors +# Copyright (c) 2020-2024 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. @@ -21,57 +21,54 @@ # you've written is kosher to CI # # Usage: -# restyle-diff.sh [-d] [ref] +# restyle-diff.sh [-d] [-p] [ref] # # if unspecified, ref defaults to upstream/master (or master) # -d sets container's log level to DEBUG, if unspecified the default log level will remain (info level) +# -p pulls the Docker image before running the restyle paths # here=${0%/*} set -e +MAX_ARGS=256 +pull_image=0 + CHIP_ROOT=$(cd "$here/../.." && pwd) cd "$CHIP_ROOT" -docker_run() { - if [ -t 0 ]; then - exec docker run --tty "$@" - - else - exec docker run "$@" - - fi -} - restyle-paths() { - image=restyled/restyler:edge - for path in "$@"; do - ( - docker_run --tty --interactive --rm \ - --env LOG_LEVEL \ - --env LOG_DESTINATION \ - --env LOG_FORMAT \ - --env LOG_COLOR \ - --env HOST_DIRECTORY="$PWD" \ - --env UNRESTRICTED=1 \ - --volume "$PWD":/code \ - --volume /tmp:/tmp \ - --volume /var/run/docker.sock:/var/run/docker.sock \ - --entrypoint restyle-path \ - "$image" "$path" - ) - done + docker run \ + --env LOG_LEVEL \ + --env LOG_DESTINATION \ + --env LOG_FORMAT \ + --env LOG_COLOR \ + --env HOST_DIRECTORY="$PWD" \ + --env UNRESTRICTED=1 \ + --volume "$PWD":/code \ + --volume /tmp:/tmp \ + --volume /var/run/docker.sock:/var/run/docker.sock \ + --entrypoint restyle-path \ + "$image" "$@" + } +#This was added to be able to use xargs to call the function restyle-paths +export -f restyle-paths + while [[ $# -gt 0 ]]; do case "$1" in -d) export LOG_LEVEL="DEBUG" shift ;; + -p) + pull_image=1 + shift + ;; *) ref="$1" shift @@ -81,8 +78,13 @@ done if [[ -z "$ref" ]]; then ref="master" - git remote | grep -qxF upstream && ref="upstream/master" + git remote | grep -qxF upstream && ref="upstream/master" && git fetch upstream fi -mapfile -t paths < <(git diff --ignore-submodules --name-only --merge-base "$ref") -restyle-paths "${paths[@]}" +if [[ $pull_image -eq 1 ]]; then + docker pull restyled/restyler:edge +fi + +paths=$(git diff --ignore-submodules --name-only --merge-base "$ref") + +echo "$paths" | xargs -n "$MAX_ARGS" bash -c 'restyle-paths "$@"' From aebaedbb437e253fb8c1d70e4d50f512a7e0c01c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 31 Jul 2024 22:29:18 -0400 Subject: [PATCH 47/63] Add some bits to exercise global structs/enums to Unit Testing cluster. (#34540) * Adds things to the Unit Testing cluster XML. * This requires those things to be enabled in all-clusters-app, all-clusters-minimal-app, and one of the chef contact sensors to pass CI. * That requires an implementation in test-cluster-server * At which point might as well add a YAML test to exercise it all. --- .../all-clusters-app.matter | 25 + .../all-clusters-common/all-clusters-app.zap | 80 ++ .../all-clusters-minimal-app.matter | 25 + .../all-clusters-minimal-app.zap | 80 ++ .../rootnode_contactsensor_27f76aeaf5.matter | 25 + .../rootnode_contactsensor_27f76aeaf5.zap | 80 ++ .../test-cluster-server.cpp | 66 ++ src/app/tests/suites/TestCluster.yaml | 75 +- .../zcl/data-model/chip/test-cluster.xml | 29 + .../zcl/zcl-with-test-extensions.json | 4 +- src/app/zap-templates/zcl/zcl.json | 4 +- .../data_model/controller-clusters.matter | 19 + .../chip/devicecontroller/ChipClusters.java | 201 ++++ .../chip/devicecontroller/ChipStructs.java | 114 ++- .../devicecontroller/ClusterIDMapping.java | 22 + .../devicecontroller/ClusterInfoMapping.java | 109 +++ .../devicecontroller/ClusterReadMapping.java | 22 + .../devicecontroller/ClusterWriteMapping.java | 44 + .../chip/devicecontroller/cluster/files.gni | 1 + .../structs/UnitTestingClusterNestedStruct.kt | 18 +- .../structs/UnitTestingClusterSimpleStruct.kt | 16 +- .../UnitTestingClusterTestGlobalStruct.kt | 92 ++ .../cluster/clusters/UnitTestingCluster.kt | 866 +++++++++++++++--- .../java/matter/controller/cluster/files.gni | 1 + .../structs/UnitTestingClusterNestedStruct.kt | 18 +- .../structs/UnitTestingClusterSimpleStruct.kt | 16 +- .../UnitTestingClusterTestGlobalStruct.kt | 92 ++ .../cluster/ChipClusterEventStructTest.kt | 25 +- .../cluster/ChipClusterStructTest.kt | 120 ++- .../CHIPAttributeTLVValueDecoder.cpp | 336 ++++++- .../CHIPEventTLVValueDecoder.cpp | 47 +- .../python/chip/clusters/CHIPClusters.py | 36 + .../python/chip/clusters/Objects.py | 112 +++ .../CHIP/templates/availability.yaml | 37 +- .../MTRAttributeSpecifiedCheck.mm | 12 + .../MTRAttributeTLVValueDecoder.mm | 122 +++ .../CHIP/zap-generated/MTRBaseClusters.h | 39 + .../CHIP/zap-generated/MTRBaseClusters.mm | 344 +++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 6 + .../CHIP/zap-generated/MTRClusterNames.mm | 16 + .../CHIP/zap-generated/MTRClusters.h | 17 + .../CHIP/zap-generated/MTRClusters.mm | 91 ++ .../zap-generated/MTRCommandPayloadsObjc.h | 53 ++ .../zap-generated/MTRCommandPayloadsObjc.mm | 314 +++++++ .../MTRCommandPayloads_Internal.h | 12 + .../zap-generated/MTREventTLVValueDecoder.mm | 10 + .../CHIP/zap-generated/MTRStructsObjc.h | 2 + .../CHIP/zap-generated/MTRStructsObjc.mm | 10 +- .../zap-generated/attributes/Accessors.cpp | 139 +++ .../zap-generated/attributes/Accessors.h | 23 + .../app-common/zap-generated/callback.h | 6 + .../zap-generated/cluster-objects.cpp | 96 ++ .../zap-generated/cluster-objects.h | 139 ++- .../app-common/zap-generated/ids/Attributes.h | 16 + .../app-common/zap-generated/ids/Commands.h | 8 + .../zap-generated/cluster/Commands.h | 64 ++ .../cluster/ComplexArgumentParser.cpp | 92 +- .../cluster/ComplexArgumentParser.h | 10 +- .../cluster/logging/DataModelLogger.cpp | 116 ++- .../cluster/logging/DataModelLogger.h | 8 +- .../zap-generated/cluster/Commands.h | 815 +++++++++++++++- 61 files changed, 5155 insertions(+), 282 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt 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 15e3cfc7e13d29..0897a733c96c29 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 @@ -6965,6 +6965,7 @@ internal cluster UnitTesting = 4294048773 { SimpleBitmap f = 5; single g = 6; double h = 7; + optional TestGlobalEnum i = 8; } fabric_scoped struct TestFabricScoped { @@ -6997,6 +6998,7 @@ internal cluster UnitTesting = 4294048773 { int8u a = 0; boolean b = 1; SimpleStruct c = 2; + optional TestGlobalStruct d = 3; } struct NestedStructList { @@ -7082,6 +7084,8 @@ internal cluster UnitTesting = 4294048773 { timedwrite attribute boolean timedWriteBoolean = 48; attribute boolean generalErrorBoolean = 49; attribute boolean clusterErrorBoolean = 50; + attribute TestGlobalEnum globalEnum = 51; + attribute TestGlobalStruct globalStruct = 52; attribute optional boolean unsupported = 255; attribute nullable boolean nullableBoolean = 16384; attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385; @@ -7117,6 +7121,8 @@ internal cluster UnitTesting = 4294048773 { attribute nullable int16u nullableRangeRestrictedInt16u = 16424; attribute nullable int16s nullableRangeRestrictedInt16s = 16425; attribute optional int8u writeOnlyInt8u = 16426; + attribute nullable TestGlobalEnum nullableGlobalEnum = 16435; + attribute nullable TestGlobalStruct nullableGlobalStruct = 16436; attribute int8u meiInt8u = 4294070017; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -7268,6 +7274,11 @@ internal cluster UnitTesting = 4294048773 { SimpleEnum arg2 = 1; } + response struct GlobalEchoResponse = 14 { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestNullableOptionalRequestRequest { optional nullable int8u arg1 = 0; } @@ -7321,6 +7332,11 @@ internal cluster UnitTesting = 4294048773 { octet_string payload = 0; } + request struct GlobalEchoRequestRequest { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestDifferentVendorMeiRequestRequest { int8u arg1 = 0; } @@ -7404,6 +7420,9 @@ internal cluster UnitTesting = 4294048773 { the string back. If the string is large then it would require a session that supports large payloads. */ command StringEchoRequest(StringEchoRequestRequest): StringEchoResponse = 24; + /** Command that takes arguments that are global structs/enums and the + response just echoes them back. */ + command GlobalEchoRequest(GlobalEchoRequestRequest): GlobalEchoResponse = 25; /** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */ command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962; } @@ -9302,6 +9321,8 @@ endpoint 1 { ram attribute timedWriteBoolean; callback attribute generalErrorBoolean; callback attribute clusterErrorBoolean; + ram attribute globalEnum; + callback attribute globalStruct; ram attribute nullableBoolean default = false; ram attribute nullableBitmap8 default = 0; ram attribute nullableBitmap16 default = 0; @@ -9336,6 +9357,8 @@ endpoint 1 { ram attribute nullableRangeRestrictedInt16u default = 200; ram attribute nullableRangeRestrictedInt16s default = -100; callback attribute writeOnlyInt8u default = 0; + ram attribute nullableGlobalEnum; + callback attribute nullableGlobalStruct; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; ram attribute meiInt8u default = 0; @@ -9361,6 +9384,7 @@ endpoint 1 { handle command TestListInt8UReverseRequest; handle command StringEchoResponse; handle command TestEnumsRequest; + handle command GlobalEchoResponse; handle command TestNullableOptionalRequest; handle command SimpleStructEchoRequest; handle command TimedInvokeRequest; @@ -9370,6 +9394,7 @@ endpoint 1 { handle command TestBatchHelperRequest; handle command TestSecondBatchHelperRequest; handle command StringEchoRequest; + handle command GlobalEchoRequest; handle command TestDifferentVendorMeiRequest; handle command TestDifferentVendorMeiResponse; } 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 5b19a9cfa6d93a..71fc9bab37113e 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 @@ -22405,6 +22405,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "GlobalEchoResponse", + "code": 14, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, { "name": "TestNullableOptionalRequest", "code": 15, @@ -22477,6 +22485,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "GlobalEchoRequest", + "code": 25, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, { "name": "TestDifferentVendorMeiRequest", "code": 4294049962, @@ -23247,6 +23263,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "global_enum", + "code": 51, + "mfgCode": null, + "side": "server", + "type": "TestGlobalEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "global_struct", + "code": 52, + "mfgCode": null, + "side": "server", + "type": "TestGlobalStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "nullable_boolean", "code": 16384, @@ -23791,6 +23839,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "nullable_global_enum", + "code": 16435, + "mfgCode": null, + "side": "server", + "type": "TestGlobalEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_global_struct", + "code": 16436, + "mfgCode": null, + "side": "server", + "type": "TestGlobalStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 0a4bf870ed1825..7a01c92f8efc4b 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -5556,6 +5556,7 @@ internal cluster UnitTesting = 4294048773 { SimpleBitmap f = 5; single g = 6; double h = 7; + optional TestGlobalEnum i = 8; } fabric_scoped struct TestFabricScoped { @@ -5588,6 +5589,7 @@ internal cluster UnitTesting = 4294048773 { int8u a = 0; boolean b = 1; SimpleStruct c = 2; + optional TestGlobalStruct d = 3; } struct NestedStructList { @@ -5673,6 +5675,8 @@ internal cluster UnitTesting = 4294048773 { timedwrite attribute boolean timedWriteBoolean = 48; attribute boolean generalErrorBoolean = 49; attribute boolean clusterErrorBoolean = 50; + attribute TestGlobalEnum globalEnum = 51; + attribute TestGlobalStruct globalStruct = 52; attribute optional boolean unsupported = 255; attribute nullable boolean nullableBoolean = 16384; attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385; @@ -5708,6 +5712,8 @@ internal cluster UnitTesting = 4294048773 { attribute nullable int16u nullableRangeRestrictedInt16u = 16424; attribute nullable int16s nullableRangeRestrictedInt16s = 16425; attribute optional int8u writeOnlyInt8u = 16426; + attribute nullable TestGlobalEnum nullableGlobalEnum = 16435; + attribute nullable TestGlobalStruct nullableGlobalStruct = 16436; attribute int8u meiInt8u = 4294070017; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -5859,6 +5865,11 @@ internal cluster UnitTesting = 4294048773 { SimpleEnum arg2 = 1; } + response struct GlobalEchoResponse = 14 { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestNullableOptionalRequestRequest { optional nullable int8u arg1 = 0; } @@ -5912,6 +5923,11 @@ internal cluster UnitTesting = 4294048773 { octet_string payload = 0; } + request struct GlobalEchoRequestRequest { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestDifferentVendorMeiRequestRequest { int8u arg1 = 0; } @@ -5995,6 +6011,9 @@ internal cluster UnitTesting = 4294048773 { the string back. If the string is large then it would require a session that supports large payloads. */ command StringEchoRequest(StringEchoRequestRequest): StringEchoResponse = 24; + /** Command that takes arguments that are global structs/enums and the + response just echoes them back. */ + command GlobalEchoRequest(GlobalEchoRequestRequest): GlobalEchoResponse = 25; /** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */ command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962; } @@ -6856,6 +6875,8 @@ endpoint 1 { ram attribute timedWriteBoolean; callback attribute generalErrorBoolean; callback attribute clusterErrorBoolean; + ram attribute globalEnum; + callback attribute globalStruct; ram attribute nullableBoolean default = false; ram attribute nullableBitmap8 default = 0; ram attribute nullableBitmap16 default = 0; @@ -6890,6 +6911,8 @@ endpoint 1 { ram attribute nullableRangeRestrictedInt16u default = 200; ram attribute nullableRangeRestrictedInt16s default = -100; callback attribute writeOnlyInt8u default = 0; + ram attribute nullableGlobalEnum; + callback attribute nullableGlobalStruct; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; ram attribute meiInt8u default = 0; @@ -6915,6 +6938,7 @@ endpoint 1 { handle command TestListInt8UReverseRequest; handle command StringEchoResponse; handle command TestEnumsRequest; + handle command GlobalEchoResponse; handle command TestNullableOptionalRequest; handle command SimpleStructEchoRequest; handle command TimedInvokeRequest; @@ -6924,6 +6948,7 @@ endpoint 1 { handle command TestBatchHelperRequest; handle command TestSecondBatchHelperRequest; handle command StringEchoRequest; + handle command GlobalEchoRequest; handle command TestDifferentVendorMeiRequest; handle command TestDifferentVendorMeiResponse; } diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 57f2c0412fca55..560e95a7ec180a 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -9081,6 +9081,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "GlobalEchoResponse", + "code": 14, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, { "name": "TestNullableOptionalRequest", "code": 15, @@ -9153,6 +9161,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "GlobalEchoRequest", + "code": 25, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, { "name": "TestDifferentVendorMeiRequest", "code": 4294049962, @@ -9923,6 +9939,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "global_enum", + "code": 51, + "mfgCode": null, + "side": "server", + "type": "TestGlobalEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "global_struct", + "code": 52, + "mfgCode": null, + "side": "server", + "type": "TestGlobalStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "nullable_boolean", "code": 16384, @@ -10467,6 +10515,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "nullable_global_enum", + "code": 16435, + "mfgCode": null, + "side": "server", + "type": "TestGlobalEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_global_struct", + "code": 16436, + "mfgCode": null, + "side": "server", + "type": "TestGlobalStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter index e0108d7d0a4052..e3766b6de9bfbc 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter @@ -1581,6 +1581,7 @@ internal cluster UnitTesting = 4294048773 { SimpleBitmap f = 5; single g = 6; double h = 7; + optional TestGlobalEnum i = 8; } fabric_scoped struct TestFabricScoped { @@ -1613,6 +1614,7 @@ internal cluster UnitTesting = 4294048773 { int8u a = 0; boolean b = 1; SimpleStruct c = 2; + optional TestGlobalStruct d = 3; } struct NestedStructList { @@ -1698,6 +1700,8 @@ internal cluster UnitTesting = 4294048773 { timedwrite attribute boolean timedWriteBoolean = 48; attribute boolean generalErrorBoolean = 49; attribute boolean clusterErrorBoolean = 50; + attribute TestGlobalEnum globalEnum = 51; + attribute TestGlobalStruct globalStruct = 52; attribute optional boolean unsupported = 255; attribute nullable boolean nullableBoolean = 16384; attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385; @@ -1733,6 +1737,8 @@ internal cluster UnitTesting = 4294048773 { attribute nullable int16u nullableRangeRestrictedInt16u = 16424; attribute nullable int16s nullableRangeRestrictedInt16s = 16425; attribute optional int8u writeOnlyInt8u = 16426; + attribute nullable TestGlobalEnum nullableGlobalEnum = 16435; + attribute nullable TestGlobalStruct nullableGlobalStruct = 16436; attribute int8u meiInt8u = 4294070017; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -1884,6 +1890,11 @@ internal cluster UnitTesting = 4294048773 { SimpleEnum arg2 = 1; } + response struct GlobalEchoResponse = 14 { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestNullableOptionalRequestRequest { optional nullable int8u arg1 = 0; } @@ -1937,6 +1948,11 @@ internal cluster UnitTesting = 4294048773 { octet_string payload = 0; } + request struct GlobalEchoRequestRequest { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestDifferentVendorMeiRequestRequest { int8u arg1 = 0; } @@ -2020,6 +2036,9 @@ internal cluster UnitTesting = 4294048773 { the string back. If the string is large then it would require a session that supports large payloads. */ command StringEchoRequest(StringEchoRequestRequest): StringEchoResponse = 24; + /** Command that takes arguments that are global structs/enums and the + response just echoes them back. */ + command GlobalEchoRequest(GlobalEchoRequestRequest): GlobalEchoResponse = 25; /** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */ command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962; } @@ -2343,6 +2362,8 @@ endpoint 1 { ram attribute timedWriteBoolean; callback attribute generalErrorBoolean; callback attribute clusterErrorBoolean; + ram attribute globalEnum; + callback attribute globalStruct; ram attribute nullableBoolean default = false; ram attribute nullableBitmap8 default = 0; ram attribute nullableBitmap16 default = 0; @@ -2377,6 +2398,8 @@ endpoint 1 { ram attribute nullableRangeRestrictedInt16u default = 200; ram attribute nullableRangeRestrictedInt16s default = -100; callback attribute writeOnlyInt8u default = 0; + ram attribute nullableGlobalEnum; + callback attribute nullableGlobalStruct; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; ram attribute meiInt8u default = 0; @@ -2401,6 +2424,7 @@ endpoint 1 { handle command TestListNestedStructListArgumentRequest; handle command TestListInt8UReverseRequest; handle command TestEnumsRequest; + handle command GlobalEchoResponse; handle command TestNullableOptionalRequest; handle command SimpleStructEchoRequest; handle command TimedInvokeRequest; @@ -2409,6 +2433,7 @@ endpoint 1 { handle command TestEmitTestFabricScopedEventRequest; handle command TestBatchHelperRequest; handle command TestSecondBatchHelperRequest; + handle command GlobalEchoRequest; handle command TestDifferentVendorMeiRequest; handle command TestDifferentVendorMeiResponse; } diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap index 590dea9f9f3c8e..02a553e03f9cd1 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.zap @@ -3252,6 +3252,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "GlobalEchoResponse", + "code": 14, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, { "name": "TestNullableOptionalRequest", "code": 15, @@ -3316,6 +3324,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "GlobalEchoRequest", + "code": 25, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, { "name": "TestDifferentVendorMeiRequest", "code": 4294049962, @@ -4086,6 +4102,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "global_enum", + "code": 51, + "mfgCode": null, + "side": "server", + "type": "TestGlobalEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "global_struct", + "code": 52, + "mfgCode": null, + "side": "server", + "type": "TestGlobalStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "nullable_boolean", "code": 16384, @@ -4630,6 +4678,38 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "nullable_global_enum", + "code": 16435, + "mfgCode": null, + "side": "server", + "type": "TestGlobalEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "nullable_global_struct", + "code": 16436, + "mfgCode": null, + "side": "server", + "type": "TestGlobalStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, diff --git a/src/app/clusters/test-cluster-server/test-cluster-server.cpp b/src/app/clusters/test-cluster-server/test-cluster-server.cpp index 4b6fc979336ab3..9bd925780524eb 100644 --- a/src/app/clusters/test-cluster-server/test-cluster-server.cpp +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -101,8 +101,12 @@ class TestAttrAccess : public AttributeAccessInterface AttributeValueDecoder & aDecoder); CHIP_ERROR ReadStructAttribute(AttributeValueEncoder & aEncoder); CHIP_ERROR WriteStructAttribute(AttributeValueDecoder & aDecoder); + CHIP_ERROR ReadGlobalStruct(AttributeValueEncoder & aEncoder); + CHIP_ERROR WriteGlobalStruct(AttributeValueDecoder & aDecoder); CHIP_ERROR ReadNullableStruct(AttributeValueEncoder & aEncoder); CHIP_ERROR WriteNullableStruct(AttributeValueDecoder & aDecoder); + CHIP_ERROR ReadNullableGlobalStruct(AttributeValueEncoder & aEncoder); + CHIP_ERROR WriteNullableGlobalStruct(AttributeValueDecoder & aDecoder); CHIP_ERROR ReadListFabricScopedAttribute(AttributeValueEncoder & aEncoder); CHIP_ERROR WriteListFabricScopedAttribute(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder); }; @@ -126,7 +130,9 @@ size_t gListLongOctetStringLen = kAttributeListLength; Structs::TestListStructOctet::Type listStructOctetStringData[kAttributeListLength]; OctetStringData gStructAttributeByteSpanData; Structs::SimpleStruct::Type gStructAttributeValue; +Globals::Structs::TestGlobalStruct::Type gGlobalStructAttributeValue; NullableStruct::TypeInfo::Type gNullableStructAttributeValue; +DataModel::Nullable gNullableGlobalStructAttributeValue; chip::app::Clusters::UnitTesting::Structs::TestFabricScoped::Type gListFabricScopedAttributeValue[kAttributeListLength]; uint8_t gListFabricScoped_fabricSensitiveInt8uList[kAttributeListLength][kFabricSensitiveIntListLength]; @@ -198,6 +204,9 @@ CHIP_ERROR TestAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attribu case StructAttr::Id: { return ReadStructAttribute(aEncoder); } + case GlobalStruct::Id: { + return ReadGlobalStruct(aEncoder); + } case ListLongOctetString::Id: { return ReadListLongOctetStringAttribute(aEncoder); } @@ -207,6 +216,9 @@ CHIP_ERROR TestAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attribu case NullableStruct::Id: { return ReadNullableStruct(aEncoder); } + case NullableGlobalStruct::Id: { + return ReadNullableGlobalStruct(aEncoder); + } case GeneralErrorBoolean::Id: { return StatusIB(Protocols::InteractionModel::Status::InvalidDataType).ToChipError(); } @@ -249,9 +261,15 @@ CHIP_ERROR TestAttrAccess::Write(const ConcreteDataAttributePath & aPath, Attrib case StructAttr::Id: { return WriteStructAttribute(aDecoder); } + case GlobalStruct::Id: { + return WriteGlobalStruct(aDecoder); + } case NullableStruct::Id: { return WriteNullableStruct(aDecoder); } + case NullableGlobalStruct::Id: { + return WriteNullableGlobalStruct(aDecoder); + } case GeneralErrorBoolean::Id: { return StatusIB(Protocols::InteractionModel::Status::InvalidDataType).ToChipError(); } @@ -276,6 +294,26 @@ CHIP_ERROR TestAttrAccess::WriteNullableStruct(AttributeValueDecoder & aDecoder) return aDecoder.Decode(gNullableStructAttributeValue); } +CHIP_ERROR TestAttrAccess::ReadNullableGlobalStruct(AttributeValueEncoder & aEncoder) +{ + return aEncoder.Encode(gNullableGlobalStructAttributeValue); +} + +CHIP_ERROR TestAttrAccess::WriteNullableGlobalStruct(AttributeValueDecoder & aDecoder) +{ + Attributes::NullableGlobalStruct::TypeInfo::DecodableType temp; + ReturnErrorOnFailure(aDecoder.Decode(temp)); + + if (!temp.IsNull()) + { + // We don't support a nonempty charspan here for now. + VerifyOrReturnError(temp.Value().name.empty(), CHIP_ERROR_BUFFER_TOO_SMALL); + } + + gNullableGlobalStructAttributeValue = temp; + return CHIP_NO_ERROR; +} + CHIP_ERROR TestAttrAccess::ReadListInt8uAttribute(AttributeValueEncoder & aEncoder) { return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { @@ -588,6 +626,23 @@ CHIP_ERROR TestAttrAccess::WriteStructAttribute(AttributeValueDecoder & aDecoder return CHIP_NO_ERROR; } +CHIP_ERROR TestAttrAccess::ReadGlobalStruct(AttributeValueEncoder & aEncoder) +{ + return aEncoder.Encode(gGlobalStructAttributeValue); +} + +CHIP_ERROR TestAttrAccess::WriteGlobalStruct(AttributeValueDecoder & aDecoder) +{ + // We don't support a nonempty charspan here for now. + Attributes::GlobalStruct::TypeInfo::DecodableType temp; + ReturnErrorOnFailure(aDecoder.Decode(temp)); + + VerifyOrReturnError(temp.name.empty(), CHIP_ERROR_BUFFER_TOO_SMALL); + + gGlobalStructAttributeValue = temp; + return CHIP_NO_ERROR; +} + CHIP_ERROR TestAttrAccess::ReadListFabricScopedAttribute(AttributeValueEncoder & aEncoder) { return aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { @@ -1114,6 +1169,17 @@ bool emberAfUnitTestingClusterTestSecondBatchHelperRequestCallback( commandData.fillCharacter); } +bool emberAfUnitTestingClusterGlobalEchoRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::GlobalEchoRequest::DecodableType & commandData) +{ + Commands::GlobalEchoResponse::Type response; + response.field1 = commandData.field1; + response.field2 = commandData.field2; + + commandObj->AddResponse(commandPath, response); + return true; +} + // ----------------------------------------------------------------------------- // Plugin initialization diff --git a/src/app/tests/suites/TestCluster.yaml b/src/app/tests/suites/TestCluster.yaml index 308240a0dd537d..d2ff0cb2d0f27e 100644 --- a/src/app/tests/suites/TestCluster.yaml +++ b/src/app/tests/suites/TestCluster.yaml @@ -3912,6 +3912,7 @@ tests: 22, 23, 24, + 25, 4294049962, ] @@ -3919,7 +3920,7 @@ tests: command: "readAttribute" attribute: "GeneratedCommandList" response: - value: [0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 4294049979] + value: [0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 4294049979] - label: "Validate presence of MEI attribute" command: "readAttribute" @@ -3960,3 +3961,75 @@ tests: g: 1.5, h: 3.14159265358979, } + + # Globals testing + - label: "Write global-struct-typed attribute" + command: "writeAttribute" + attribute: "global_struct" + arguments: + value: + { + Name: "", + MyBitmap: 0x02, + MyEnum: TestGlobalEnum.SomeOtherValue, + } + + - label: "Read global-struct-typed attribute" + command: "readAttribute" + attribute: "global_struct" + response: + value: { + # Purposefully using non-symbolic values to make sure things work right. + Name: "", + MyBitmap: 0x02, + MyEnum: 1, + } + + - label: "Write nullable global-struct-typed attribute" + command: "writeAttribute" + attribute: "nullable_global_struct" + arguments: + value: { Name: "", MyBitmap: 0x01, MyEnum: TestGlobalEnum.SomeValue } + + - label: "Read nullable global-struct-typed attribute" + command: "readAttribute" + attribute: "nullable_global_struct" + response: + value: { Name: "", MyBitmap: 0x01, MyEnum: 0 } + + - label: "Write nullable global-struct-typed attribute as null" + command: "writeAttribute" + attribute: "nullable_global_struct" + arguments: + value: null + + - label: "Read nullable global-struct-typed attribute a second time" + command: "readAttribute" + attribute: "nullable_global_struct" + response: + value: null + + - label: "Send a command with global types" + command: "GlobalEchoRequest" + arguments: + values: + - name: "field1" + value: + { + Name: "", + MyBitmap: 0x02, + MyEnum: TestGlobalEnum.FinalValue, + } + - name: "field2" + value: TestGlobalEnum.SomeOtherValue + response: + values: + - name: "field1" + value: + { + Name: "", + MyBitmap: 0x02, + MyEnum: TestGlobalEnum.FinalValue, + } + - name: "field2" + value: TestGlobalEnum.SomeOtherValue diff --git a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml index f010838f933b03..c289ee9f1c4338 100644 --- a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml @@ -58,6 +58,7 @@ limitations under the License. + @@ -65,6 +66,7 @@ limitations under the License. + @@ -198,6 +200,9 @@ limitations under the License. cluster_error_boolean + global_enum + global_struct + nullable_boolean nullable_bitmap8 nullable_bitmap16 @@ -232,8 +237,14 @@ limitations under the License. nullable_range_restricted_int16u nullable_range_restricted_int16s + write_only_int8u + nullable_global_enum + nullable_global_struct + mei_int8u @@ -474,6 +485,16 @@ limitations under the License. + + + Command that takes arguments that are global structs/enums and the + response just echoes them back. + + + + + @@ -622,6 +643,14 @@ limitations under the License. + + + Response to GlobalEchoRequest. + + + + + Response to TestDifferentVendorMeiRequest, which is a command having a different MEI vendor ID than the 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 5c8508f2e2f5ac..664cab6d944ad7 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -301,7 +301,9 @@ "struct_attr", "nullable_struct", "general_error_boolean", - "cluster_error_boolean" + "cluster_error_boolean", + "global_struct", + "nullable_global_struct" ], "Thread Border Router Management": [ "BorderRouterName", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index a3434e49137e80..0e15eb8be7f944 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -299,7 +299,9 @@ "struct_attr", "nullable_struct", "general_error_boolean", - "cluster_error_boolean" + "cluster_error_boolean", + "global_struct", + "nullable_global_struct" ], "Thread Border Router Management": [ "BorderRouterName", diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index b2e8b2cc7836c1..d973f74d26c6b7 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -9763,6 +9763,7 @@ internal cluster UnitTesting = 4294048773 { SimpleBitmap f = 5; single g = 6; double h = 7; + optional TestGlobalEnum i = 8; } fabric_scoped struct TestFabricScoped { @@ -9795,6 +9796,7 @@ internal cluster UnitTesting = 4294048773 { int8u a = 0; boolean b = 1; SimpleStruct c = 2; + optional TestGlobalStruct d = 3; } struct NestedStructList { @@ -9880,6 +9882,8 @@ internal cluster UnitTesting = 4294048773 { timedwrite attribute boolean timedWriteBoolean = 48; attribute boolean generalErrorBoolean = 49; attribute boolean clusterErrorBoolean = 50; + attribute TestGlobalEnum globalEnum = 51; + attribute TestGlobalStruct globalStruct = 52; attribute optional boolean unsupported = 255; attribute nullable boolean nullableBoolean = 16384; attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385; @@ -9915,6 +9919,8 @@ internal cluster UnitTesting = 4294048773 { attribute nullable int16u nullableRangeRestrictedInt16u = 16424; attribute nullable int16s nullableRangeRestrictedInt16s = 16425; attribute optional int8u writeOnlyInt8u = 16426; + attribute nullable TestGlobalEnum nullableGlobalEnum = 16435; + attribute nullable TestGlobalStruct nullableGlobalStruct = 16436; attribute int8u meiInt8u = 4294070017; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -10066,6 +10072,11 @@ internal cluster UnitTesting = 4294048773 { SimpleEnum arg2 = 1; } + response struct GlobalEchoResponse = 14 { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestNullableOptionalRequestRequest { optional nullable int8u arg1 = 0; } @@ -10119,6 +10130,11 @@ internal cluster UnitTesting = 4294048773 { octet_string payload = 0; } + request struct GlobalEchoRequestRequest { + TestGlobalStruct field1 = 0; + TestGlobalEnum field2 = 1; + } + request struct TestDifferentVendorMeiRequestRequest { int8u arg1 = 0; } @@ -10202,6 +10218,9 @@ internal cluster UnitTesting = 4294048773 { the string back. If the string is large then it would require a session that supports large payloads. */ command StringEchoRequest(StringEchoRequestRequest): StringEchoResponse = 24; + /** Command that takes arguments that are global structs/enums and the + response just echoes them back. */ + command GlobalEchoRequest(GlobalEchoRequestRequest): GlobalEchoResponse = 25; /** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */ command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962; } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 6cb7e845025f7b..c58422e10137f9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -65187,6 +65187,8 @@ public static class UnitTestingCluster extends BaseChipCluster { private static final long TIMED_WRITE_BOOLEAN_ATTRIBUTE_ID = 48L; private static final long GENERAL_ERROR_BOOLEAN_ATTRIBUTE_ID = 49L; private static final long CLUSTER_ERROR_BOOLEAN_ATTRIBUTE_ID = 50L; + private static final long GLOBAL_ENUM_ATTRIBUTE_ID = 51L; + private static final long GLOBAL_STRUCT_ATTRIBUTE_ID = 52L; private static final long UNSUPPORTED_ATTRIBUTE_ID = 255L; private static final long NULLABLE_BOOLEAN_ATTRIBUTE_ID = 16384L; private static final long NULLABLE_BITMAP8_ATTRIBUTE_ID = 16385L; @@ -65222,6 +65224,8 @@ public static class UnitTestingCluster extends BaseChipCluster { private static final long NULLABLE_RANGE_RESTRICTED_INT16U_ATTRIBUTE_ID = 16424L; private static final long NULLABLE_RANGE_RESTRICTED_INT16S_ATTRIBUTE_ID = 16425L; private static final long WRITE_ONLY_INT8U_ATTRIBUTE_ID = 16426L; + private static final long NULLABLE_GLOBAL_ENUM_ATTRIBUTE_ID = 16435L; + private static final long NULLABLE_GLOBAL_STRUCT_ATTRIBUTE_ID = 16436L; private static final long MEI_INT8U_ATTRIBUTE_ID = 4294070017L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; @@ -66265,6 +66269,47 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, commandArgs, timedInvokeTimeoutMs); } + public void globalEchoRequest(GlobalEchoResponseCallback callback, ChipStructs.UnitTestingClusterTestGlobalStruct field1, Integer field2) { + globalEchoRequest(callback, field1, field2, 0); + } + + public void globalEchoRequest(GlobalEchoResponseCallback callback, ChipStructs.UnitTestingClusterTestGlobalStruct field1, Integer field2, int timedInvokeTimeoutMs) { + final long commandId = 25L; + + ArrayList elements = new ArrayList<>(); + final long field1FieldID = 0L; + BaseTLVType field1tlvValue = field1.encodeTlv(); + elements.add(new StructElement(field1FieldID, field1tlvValue)); + + final long field2FieldID = 1L; + BaseTLVType field2tlvValue = new UIntType(field2); + elements.add(new StructElement(field2FieldID, field2tlvValue)); + + StructType commandArgs = new StructType(elements); + invoke(new InvokeCallbackImpl(callback) { + @Override + public void onResponse(StructType invokeStructValue) { + final long field1FieldID = 0L; + ChipStructs.UnitTestingClusterTestGlobalStruct field1 = null; + final long field2FieldID = 1L; + Integer field2 = null; + for (StructElement element: invokeStructValue.value()) { + if (element.contextTagNum() == field1FieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + field1 = ChipStructs.UnitTestingClusterTestGlobalStruct.decodeTlv(castingValue); + } + } else if (element.contextTagNum() == field2FieldID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + field2 = castingValue.value(Integer.class); + } + } + } + callback.onSuccess(field1, field2); + }}, commandId, commandArgs, timedInvokeTimeoutMs); + } + public void testDifferentVendorMeiRequest(TestDifferentVendorMeiResponseCallback callback, Integer arg1) { testDifferentVendorMeiRequest(callback, arg1, 0); } @@ -66358,6 +66403,10 @@ public interface StringEchoResponseCallback extends BaseClusterCallback { void onSuccess(byte[] payload); } + public interface GlobalEchoResponseCallback extends BaseClusterCallback { + void onSuccess(ChipStructs.UnitTestingClusterTestGlobalStruct field1, Integer field2); + } + public interface TestDifferentVendorMeiResponseCallback extends BaseClusterCallback { void onSuccess(Integer arg1, Long eventNumber); } @@ -66390,6 +66439,10 @@ public interface ListFabricScopedAttributeCallback extends BaseAttributeCallback void onSuccess(List value); } + public interface GlobalStructAttributeCallback extends BaseAttributeCallback { + void onSuccess(ChipStructs.UnitTestingClusterTestGlobalStruct value); + } + public interface NullableBooleanAttributeCallback extends BaseAttributeCallback { void onSuccess(@Nullable Boolean value); } @@ -66522,6 +66575,14 @@ public interface NullableRangeRestrictedInt16sAttributeCallback extends BaseAttr void onSuccess(@Nullable Integer value); } + public interface NullableGlobalEnumAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Integer value); + } + + public interface NullableGlobalStructAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.UnitTestingClusterTestGlobalStruct value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -68184,6 +68245,76 @@ public void onSuccess(byte[] tlv) { }, CLUSTER_ERROR_BOOLEAN_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readGlobalEnumAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GLOBAL_ENUM_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GLOBAL_ENUM_ATTRIBUTE_ID, true); + } + + public void writeGlobalEnumAttribute(DefaultClusterCallback callback, Integer value) { + writeGlobalEnumAttribute(callback, value, 0); + } + + public void writeGlobalEnumAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), GLOBAL_ENUM_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeGlobalEnumAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GLOBAL_ENUM_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GLOBAL_ENUM_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGlobalStructAttribute( + GlobalStructAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GLOBAL_STRUCT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + ChipStructs.UnitTestingClusterTestGlobalStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GLOBAL_STRUCT_ATTRIBUTE_ID, true); + } + + public void writeGlobalStructAttribute(DefaultClusterCallback callback, ChipStructs.UnitTestingClusterTestGlobalStruct value) { + writeGlobalStructAttribute(callback, value, 0); + } + + public void writeGlobalStructAttribute(DefaultClusterCallback callback, ChipStructs.UnitTestingClusterTestGlobalStruct value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value.encodeTlv(); + writeAttribute(new WriteAttributesCallbackImpl(callback), GLOBAL_STRUCT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeGlobalStructAttribute( + GlobalStructAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GLOBAL_STRUCT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + ChipStructs.UnitTestingClusterTestGlobalStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GLOBAL_STRUCT_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readUnsupportedAttribute( BooleanAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNSUPPORTED_ATTRIBUTE_ID); @@ -69409,6 +69540,76 @@ public void onSuccess(byte[] tlv) { }, WRITE_ONLY_INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readNullableGlobalEnumAttribute( + NullableGlobalEnumAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NULLABLE_GLOBAL_ENUM_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NULLABLE_GLOBAL_ENUM_ATTRIBUTE_ID, true); + } + + public void writeNullableGlobalEnumAttribute(DefaultClusterCallback callback, Integer value) { + writeNullableGlobalEnumAttribute(callback, value, 0); + } + + public void writeNullableGlobalEnumAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); + writeAttribute(new WriteAttributesCallbackImpl(callback), NULLABLE_GLOBAL_ENUM_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeNullableGlobalEnumAttribute( + NullableGlobalEnumAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NULLABLE_GLOBAL_ENUM_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NULLABLE_GLOBAL_ENUM_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNullableGlobalStructAttribute( + NullableGlobalStructAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NULLABLE_GLOBAL_STRUCT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.UnitTestingClusterTestGlobalStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NULLABLE_GLOBAL_STRUCT_ATTRIBUTE_ID, true); + } + + public void writeNullableGlobalStructAttribute(DefaultClusterCallback callback, ChipStructs.UnitTestingClusterTestGlobalStruct value) { + writeNullableGlobalStructAttribute(callback, value, 0); + } + + public void writeNullableGlobalStructAttribute(DefaultClusterCallback callback, ChipStructs.UnitTestingClusterTestGlobalStruct value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = value != null ? value.encodeTlv() : new NullType(); + writeAttribute(new WriteAttributesCallbackImpl(callback), NULLABLE_GLOBAL_STRUCT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeNullableGlobalStructAttribute( + NullableGlobalStructAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NULLABLE_GLOBAL_STRUCT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.UnitTestingClusterTestGlobalStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NULLABLE_GLOBAL_STRUCT_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readMeiInt8uAttribute( IntegerAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MEI_INT8U_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 893ca02a301044..f4051b3948c5bb 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -12960,6 +12960,7 @@ public static class UnitTestingClusterSimpleStruct { public Integer f; public Float g; public Double h; + public Optional i; private static final long A_ID = 0L; private static final long B_ID = 1L; private static final long C_ID = 2L; @@ -12968,6 +12969,7 @@ public static class UnitTestingClusterSimpleStruct { private static final long F_ID = 5L; private static final long G_ID = 6L; private static final long H_ID = 7L; + private static final long I_ID = 8L; public UnitTestingClusterSimpleStruct( Integer a, @@ -12977,7 +12979,8 @@ public UnitTestingClusterSimpleStruct( String e, Integer f, Float g, - Double h + Double h, + Optional i ) { this.a = a; this.b = b; @@ -12987,6 +12990,7 @@ public UnitTestingClusterSimpleStruct( this.f = f; this.g = g; this.h = h; + this.i = i; } public StructType encodeTlv() { @@ -12999,6 +13003,7 @@ public StructType encodeTlv() { values.add(new StructElement(F_ID, new UIntType(f))); values.add(new StructElement(G_ID, new FloatType(g))); values.add(new StructElement(H_ID, new DoubleType(h))); + values.add(new StructElement(I_ID, i.map((nonOptionali) -> new UIntType(nonOptionali)).orElse(new EmptyType()))); return new StructType(values); } @@ -13015,6 +13020,7 @@ public static UnitTestingClusterSimpleStruct decodeTlv(BaseTLVType tlvValue) { Integer f = null; Float g = null; Double h = null; + Optional i = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == A_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -13056,6 +13062,11 @@ public static UnitTestingClusterSimpleStruct decodeTlv(BaseTLVType tlvValue) { DoubleType castingValue = element.value(DoubleType.class); h = castingValue.value(Double.class); } + } else if (element.contextTagNum() == I_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + i = Optional.of(castingValue.value(Integer.class)); + } } } return new UnitTestingClusterSimpleStruct( @@ -13066,7 +13077,8 @@ public static UnitTestingClusterSimpleStruct decodeTlv(BaseTLVType tlvValue) { e, f, g, - h + h, + i ); } @@ -13098,6 +13110,9 @@ public String toString() { output.append("\th: "); output.append(h); output.append("\n"); + output.append("\ti: "); + output.append(i); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -13468,18 +13483,22 @@ public static class UnitTestingClusterNestedStruct { public Integer a; public Boolean b; public ChipStructs.UnitTestingClusterSimpleStruct c; + public Optional d; private static final long A_ID = 0L; private static final long B_ID = 1L; private static final long C_ID = 2L; + private static final long D_ID = 3L; public UnitTestingClusterNestedStruct( Integer a, Boolean b, - ChipStructs.UnitTestingClusterSimpleStruct c + ChipStructs.UnitTestingClusterSimpleStruct c, + Optional d ) { this.a = a; this.b = b; this.c = c; + this.d = d; } public StructType encodeTlv() { @@ -13487,6 +13506,7 @@ public StructType encodeTlv() { values.add(new StructElement(A_ID, new UIntType(a))); values.add(new StructElement(B_ID, new BooleanType(b))); values.add(new StructElement(C_ID, c.encodeTlv())); + values.add(new StructElement(D_ID, d.map((nonOptionald) -> nonOptionald.encodeTlv()).orElse(new EmptyType()))); return new StructType(values); } @@ -13498,6 +13518,7 @@ public static UnitTestingClusterNestedStruct decodeTlv(BaseTLVType tlvValue) { Integer a = null; Boolean b = null; ChipStructs.UnitTestingClusterSimpleStruct c = null; + Optional d = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == A_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { @@ -13514,12 +13535,18 @@ public static UnitTestingClusterNestedStruct decodeTlv(BaseTLVType tlvValue) { StructType castingValue = element.value(StructType.class); c = ChipStructs.UnitTestingClusterSimpleStruct.decodeTlv(castingValue); } + } else if (element.contextTagNum() == D_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + d = Optional.of(ChipStructs.UnitTestingClusterTestGlobalStruct.decodeTlv(castingValue)); + } } } return new UnitTestingClusterNestedStruct( a, b, - c + c, + d ); } @@ -13536,6 +13563,9 @@ public String toString() { output.append("\tc: "); output.append(c); output.append("\n"); + output.append("\td: "); + output.append(d); + output.append("\n"); output.append("}\n"); return output.toString(); } @@ -13783,4 +13813,80 @@ public String toString() { return output.toString(); } } +public static class UnitTestingClusterTestGlobalStruct { + public String name; + public @Nullable Long myBitmap; + public @Nullable Optional myEnum; + private static final long NAME_ID = 0L; + private static final long MY_BITMAP_ID = 1L; + private static final long MY_ENUM_ID = 2L; + + public UnitTestingClusterTestGlobalStruct( + String name, + @Nullable Long myBitmap, + @Nullable Optional myEnum + ) { + this.name = name; + this.myBitmap = myBitmap; + this.myEnum = myEnum; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(NAME_ID, new StringType(name))); + values.add(new StructElement(MY_BITMAP_ID, myBitmap != null ? new UIntType(myBitmap) : new NullType())); + values.add(new StructElement(MY_ENUM_ID, myEnum != null ? myEnum.map((nonOptionalmyEnum) -> new UIntType(nonOptionalmyEnum)).orElse(new EmptyType()) : new NullType())); + + return new StructType(values); + } + + public static UnitTestingClusterTestGlobalStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + String name = null; + @Nullable Long myBitmap = null; + @Nullable Optional myEnum = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == NAME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.String) { + StringType castingValue = element.value(StringType.class); + name = castingValue.value(String.class); + } + } else if (element.contextTagNum() == MY_BITMAP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + myBitmap = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == MY_ENUM_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + myEnum = Optional.of(castingValue.value(Integer.class)); + } + } + } + return new UnitTestingClusterTestGlobalStruct( + name, + myBitmap, + myEnum + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("UnitTestingClusterTestGlobalStruct {\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tmyBitmap: "); + output.append(myBitmap); + output.append("\n"); + output.append("\tmyEnum: "); + output.append(myEnum); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index e073912517d978..b753f8a8644452 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -17752,6 +17752,8 @@ public enum Attribute { TimedWriteBoolean(48L), GeneralErrorBoolean(49L), ClusterErrorBoolean(50L), + GlobalEnum(51L), + GlobalStruct(52L), Unsupported(255L), NullableBoolean(16384L), NullableBitmap8(16385L), @@ -17787,6 +17789,8 @@ public enum Attribute { NullableRangeRestrictedInt16u(16424L), NullableRangeRestrictedInt16s(16425L), WriteOnlyInt8u(16426L), + NullableGlobalEnum(16435L), + NullableGlobalStruct(16436L), MeiInt8u(4294070017L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), @@ -17862,6 +17866,7 @@ public enum Command { TestBatchHelperRequest(22L), TestSecondBatchHelperRequest(23L), StringEchoRequest(24L), + GlobalEchoRequest(25L), TestDifferentVendorMeiRequest(4294049962L),; private final long id; Command(long id) { @@ -18220,6 +18225,23 @@ public static StringEchoRequestCommandField value(int id) throws NoSuchFieldErro } throw new NoSuchFieldError(); } + }public enum GlobalEchoRequestCommandField {Field1(0),Field2(1),; + private final int id; + GlobalEchoRequestCommandField(int id) { + this.id = id; + } + + public int getID() { + return id; + } + public static GlobalEchoRequestCommandField value(int id) throws NoSuchFieldError { + for (GlobalEchoRequestCommandField field : GlobalEchoRequestCommandField.values()) { + if (field.getID() == id) { + return field; + } + } + throw new NoSuchFieldError(); + } }public enum TestDifferentVendorMeiRequestCommandField {Arg1(0),; private final int id; TestDifferentVendorMeiRequestCommandField(int id) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index a52cfa407bf32a..fcc6522d258ea6 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -20935,6 +20935,30 @@ public void onError(Exception error) { } } + public static class DelegatedUnitTestingClusterGlobalEchoResponseCallback implements ChipClusters.UnitTestingCluster.GlobalEchoResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(ChipStructs.UnitTestingClusterTestGlobalStruct field1, Integer field2) { + Map responseValues = new LinkedHashMap<>(); + + // field1: Struct TestGlobalStruct + // Conversion from this type to Java is not properly implemented yet + CommandResponseInfo field2ResponseValue = new CommandResponseInfo("field2", "Integer"); + responseValues.put(field2ResponseValue, field2); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedUnitTestingClusterTestDifferentVendorMeiResponseCallback implements ChipClusters.UnitTestingCluster.TestDifferentVendorMeiResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -21105,6 +21129,27 @@ public void onError(Exception ex) { } } + public static class DelegatedUnitTestingClusterGlobalStructAttributeCallback implements ChipClusters.UnitTestingCluster.GlobalStructAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(ChipStructs.UnitTestingClusterTestGlobalStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.UnitTestingClusterTestGlobalStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedUnitTestingClusterNullableBooleanAttributeCallback implements ChipClusters.UnitTestingCluster.NullableBooleanAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -21798,6 +21843,48 @@ public void onError(Exception ex) { } } + public static class DelegatedUnitTestingClusterNullableGlobalEnumAttributeCallback implements ChipClusters.UnitTestingCluster.NullableGlobalEnumAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Integer value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedUnitTestingClusterNullableGlobalStructAttributeCallback implements ChipClusters.UnitTestingCluster.NullableGlobalStructAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.UnitTestingClusterTestGlobalStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.UnitTestingClusterTestGlobalStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedUnitTestingClusterGeneratedCommandListAttributeCallback implements ChipClusters.UnitTestingCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -29592,6 +29679,28 @@ public Map> getCommandMap() { ); unitTestingClusterInteractionInfoMap.put("stringEchoRequest", unitTestingstringEchoRequestInteractionInfo); + Map unitTestingglobalEchoRequestCommandParams = new LinkedHashMap(); + + + CommandParameterInfo unitTestingglobalEchoRequestfield2CommandParameterInfo = new CommandParameterInfo("field2", Integer.class, Integer.class); + unitTestingglobalEchoRequestCommandParams.put("field2",unitTestingglobalEchoRequestfield2CommandParameterInfo); + InteractionInfo unitTestingglobalEchoRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster) + .globalEchoRequest((ChipClusters.UnitTestingCluster.GlobalEchoResponseCallback) callback + , (ChipStructs.UnitTestingClusterTestGlobalStruct) + commandArguments.get("field1") + + , (Integer) + commandArguments.get("field2") + + ); + }, + () -> new DelegatedUnitTestingClusterGlobalEchoResponseCallback(), + unitTestingglobalEchoRequestCommandParams + ); + unitTestingClusterInteractionInfoMap.put("globalEchoRequest", unitTestingglobalEchoRequestInteractionInfo); + Map unitTestingtestDifferentVendorMeiRequestCommandParams = new LinkedHashMap(); CommandParameterInfo unitTestingtestDifferentVendorMeiRequestarg1CommandParameterInfo = new CommandParameterInfo("arg1", Integer.class, Integer.class); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 787ae03471e1eb..a25c96b9d9e846 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -20835,6 +20835,17 @@ private static Map readUnitTestingInteractionInfo() { readUnitTestingClusterErrorBooleanCommandParams ); result.put("readClusterErrorBooleanAttribute", readUnitTestingClusterErrorBooleanAttributeInteractionInfo); + Map readUnitTestingGlobalEnumCommandParams = new LinkedHashMap(); + InteractionInfo readUnitTestingGlobalEnumAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster).readGlobalEnumAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readUnitTestingGlobalEnumCommandParams + ); + result.put("readGlobalEnumAttribute", readUnitTestingGlobalEnumAttributeInteractionInfo); Map readUnitTestingUnsupportedCommandParams = new LinkedHashMap(); InteractionInfo readUnitTestingUnsupportedAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -21209,6 +21220,17 @@ private static Map readUnitTestingInteractionInfo() { readUnitTestingWriteOnlyInt8uCommandParams ); result.put("readWriteOnlyInt8uAttribute", readUnitTestingWriteOnlyInt8uAttributeInteractionInfo); + Map readUnitTestingNullableGlobalEnumCommandParams = new LinkedHashMap(); + InteractionInfo readUnitTestingNullableGlobalEnumAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster).readNullableGlobalEnumAttribute( + (ChipClusters.UnitTestingCluster.NullableGlobalEnumAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedUnitTestingClusterNullableGlobalEnumAttributeCallback(), + readUnitTestingNullableGlobalEnumCommandParams + ); + result.put("readNullableGlobalEnumAttribute", readUnitTestingNullableGlobalEnumAttributeInteractionInfo); Map readUnitTestingMeiInt8uCommandParams = new LinkedHashMap(); InteractionInfo readUnitTestingMeiInt8uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index 32759bb97af64c..93a48d76bf61dc 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -4827,6 +4827,28 @@ public Map> getWriteAttributeMap() { writeUnitTestingClusterErrorBooleanCommandParams ); writeUnitTestingInteractionInfo.put("writeClusterErrorBooleanAttribute", writeUnitTestingClusterErrorBooleanAttributeInteractionInfo); + Map writeUnitTestingGlobalEnumCommandParams = new LinkedHashMap(); + CommandParameterInfo unitTestingglobalEnumCommandParameterInfo = + new CommandParameterInfo( + "value", + Integer.class, + Integer.class + ); + writeUnitTestingGlobalEnumCommandParams.put( + "value", + unitTestingglobalEnumCommandParameterInfo + ); + InteractionInfo writeUnitTestingGlobalEnumAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster).writeGlobalEnumAttribute( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeUnitTestingGlobalEnumCommandParams + ); + writeUnitTestingInteractionInfo.put("writeGlobalEnumAttribute", writeUnitTestingGlobalEnumAttributeInteractionInfo); Map writeUnitTestingUnsupportedCommandParams = new LinkedHashMap(); CommandParameterInfo unitTestingunsupportedCommandParameterInfo = new CommandParameterInfo( @@ -5575,6 +5597,28 @@ public Map> getWriteAttributeMap() { writeUnitTestingWriteOnlyInt8uCommandParams ); writeUnitTestingInteractionInfo.put("writeWriteOnlyInt8uAttribute", writeUnitTestingWriteOnlyInt8uAttributeInteractionInfo); + Map writeUnitTestingNullableGlobalEnumCommandParams = new LinkedHashMap(); + CommandParameterInfo unitTestingnullableGlobalEnumCommandParameterInfo = + new CommandParameterInfo( + "value", + Integer.class, + Integer.class + ); + writeUnitTestingNullableGlobalEnumCommandParams.put( + "value", + unitTestingnullableGlobalEnumCommandParameterInfo + ); + InteractionInfo writeUnitTestingNullableGlobalEnumAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster).writeNullableGlobalEnumAttribute( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeUnitTestingNullableGlobalEnumCommandParams + ); + writeUnitTestingInteractionInfo.put("writeNullableGlobalEnumAttribute", writeUnitTestingNullableGlobalEnumAttributeInteractionInfo); Map writeUnitTestingMeiInt8uCommandParams = new LinkedHashMap(); CommandParameterInfo unitTestingmeiInt8uCommandParameterInfo = new CommandParameterInfo( 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 f1b8e000f2a5ae..7bd7af0b3fef02 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -152,6 +152,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNullablesAndOptionalsStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestFabricScoped.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestListStructOctet.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UserLabelClusterLabelStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt index 6ec856c422029a..74cfa88e79291f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt @@ -17,6 +17,7 @@ package chip.devicecontroller.cluster.structs import chip.devicecontroller.cluster.* +import java.util.Optional import matter.tlv.ContextSpecificTag import matter.tlv.Tag import matter.tlv.TlvReader @@ -26,12 +27,14 @@ class UnitTestingClusterNestedStruct( val a: UInt, val b: Boolean, val c: UnitTestingClusterSimpleStruct, + val d: Optional, ) { override fun toString(): String = buildString { append("UnitTestingClusterNestedStruct {\n") append("\ta : $a\n") append("\tb : $b\n") append("\tc : $c\n") + append("\td : $d\n") append("}\n") } @@ -41,6 +44,10 @@ class UnitTestingClusterNestedStruct( put(ContextSpecificTag(TAG_A), a) put(ContextSpecificTag(TAG_B), b) c.toTlv(ContextSpecificTag(TAG_C), this) + if (d.isPresent) { + val optd = d.get() + optd.toTlv(ContextSpecificTag(TAG_D), this) + } endStructure() } } @@ -49,16 +56,25 @@ class UnitTestingClusterNestedStruct( private const val TAG_A = 0 private const val TAG_B = 1 private const val TAG_C = 2 + private const val TAG_D = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): UnitTestingClusterNestedStruct { tlvReader.enterStructure(tlvTag) val a = tlvReader.getUInt(ContextSpecificTag(TAG_A)) val b = tlvReader.getBoolean(ContextSpecificTag(TAG_B)) val c = UnitTestingClusterSimpleStruct.fromTlv(ContextSpecificTag(TAG_C), tlvReader) + val d = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_D))) { + Optional.of( + UnitTestingClusterTestGlobalStruct.fromTlv(ContextSpecificTag(TAG_D), tlvReader) + ) + } else { + Optional.empty() + } tlvReader.exitContainer() - return UnitTestingClusterNestedStruct(a, b, c) + return UnitTestingClusterNestedStruct(a, b, c, d) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt index 24f06fb8752b6c..8a6d89c228c11d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt @@ -17,6 +17,7 @@ package chip.devicecontroller.cluster.structs import chip.devicecontroller.cluster.* +import java.util.Optional import matter.tlv.ContextSpecificTag import matter.tlv.Tag import matter.tlv.TlvReader @@ -31,6 +32,7 @@ class UnitTestingClusterSimpleStruct( val f: UInt, val g: Float, val h: Double, + val i: Optional, ) { override fun toString(): String = buildString { append("UnitTestingClusterSimpleStruct {\n") @@ -42,6 +44,7 @@ class UnitTestingClusterSimpleStruct( append("\tf : $f\n") append("\tg : $g\n") append("\th : $h\n") + append("\ti : $i\n") append("}\n") } @@ -56,6 +59,10 @@ class UnitTestingClusterSimpleStruct( put(ContextSpecificTag(TAG_F), f) put(ContextSpecificTag(TAG_G), g) put(ContextSpecificTag(TAG_H), h) + if (i.isPresent) { + val opti = i.get() + put(ContextSpecificTag(TAG_I), opti) + } endStructure() } } @@ -69,6 +76,7 @@ class UnitTestingClusterSimpleStruct( private const val TAG_F = 5 private const val TAG_G = 6 private const val TAG_H = 7 + private const val TAG_I = 8 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): UnitTestingClusterSimpleStruct { tlvReader.enterStructure(tlvTag) @@ -80,10 +88,16 @@ class UnitTestingClusterSimpleStruct( val f = tlvReader.getUInt(ContextSpecificTag(TAG_F)) val g = tlvReader.getFloat(ContextSpecificTag(TAG_G)) val h = tlvReader.getDouble(ContextSpecificTag(TAG_H)) + val i = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_I))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_I))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return UnitTestingClusterSimpleStruct(a, b, c, d, e, f, g, h) + return UnitTestingClusterSimpleStruct(a, b, c, d, e, f, g, h, i) } } } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt new file mode 100644 index 00000000000000..aa66049b549524 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt @@ -0,0 +1,92 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class UnitTestingClusterTestGlobalStruct( + val name: String, + val myBitmap: ULong?, + val myEnum: Optional?, +) { + override fun toString(): String = buildString { + append("UnitTestingClusterTestGlobalStruct {\n") + append("\tname : $name\n") + append("\tmyBitmap : $myBitmap\n") + append("\tmyEnum : $myEnum\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_NAME), name) + if (myBitmap != null) { + put(ContextSpecificTag(TAG_MY_BITMAP), myBitmap) + } else { + putNull(ContextSpecificTag(TAG_MY_BITMAP)) + } + if (myEnum != null) { + if (myEnum.isPresent) { + val optmyEnum = myEnum.get() + put(ContextSpecificTag(TAG_MY_ENUM), optmyEnum) + } + } else { + putNull(ContextSpecificTag(TAG_MY_ENUM)) + } + endStructure() + } + } + + companion object { + private const val TAG_NAME = 0 + private const val TAG_MY_BITMAP = 1 + private const val TAG_MY_ENUM = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): UnitTestingClusterTestGlobalStruct { + tlvReader.enterStructure(tlvTag) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val myBitmap = + if (!tlvReader.isNull()) { + tlvReader.getULong(ContextSpecificTag(TAG_MY_BITMAP)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MY_BITMAP)) + null + } + val myEnum = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MY_ENUM))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MY_ENUM))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MY_ENUM)) + null + } + + tlvReader.exitContainer() + + return UnitTestingClusterTestGlobalStruct(name, myBitmap, myEnum) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/UnitTestingCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/UnitTestingCluster.kt index b50ab4468820d1..74402b19dcfdf3 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/UnitTestingCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/UnitTestingCluster.kt @@ -123,6 +123,8 @@ class UnitTestingCluster(private val controller: MatterController, private val e class StringEchoResponse(val payload: ByteArray) + class GlobalEchoResponse(val field1: UnitTestingClusterTestGlobalStruct, val field2: UByte) + class TestDifferentVendorMeiResponse(val arg1: UByte, val eventNumber: ULong) class ListInt8uAttribute(val value: List) @@ -203,6 +205,17 @@ class UnitTestingCluster(private val controller: MatterController, private val e object SubscriptionEstablished : ListFabricScopedAttributeSubscriptionState() } + class GlobalStructAttribute(val value: UnitTestingClusterTestGlobalStruct) + + sealed class GlobalStructAttributeSubscriptionState { + data class Success(val value: UnitTestingClusterTestGlobalStruct) : + GlobalStructAttributeSubscriptionState() + + data class Error(val exception: Exception) : GlobalStructAttributeSubscriptionState() + + object SubscriptionEstablished : GlobalStructAttributeSubscriptionState() + } + class NullableBooleanAttribute(val value: Boolean?) sealed class NullableBooleanAttributeSubscriptionState { @@ -541,6 +554,27 @@ class UnitTestingCluster(private val controller: MatterController, private val e object SubscriptionEstablished : NullableRangeRestrictedInt16sAttributeSubscriptionState() } + class NullableGlobalEnumAttribute(val value: UByte?) + + sealed class NullableGlobalEnumAttributeSubscriptionState { + data class Success(val value: UByte?) : NullableGlobalEnumAttributeSubscriptionState() + + data class Error(val exception: Exception) : NullableGlobalEnumAttributeSubscriptionState() + + object SubscriptionEstablished : NullableGlobalEnumAttributeSubscriptionState() + } + + class NullableGlobalStructAttribute(val value: UnitTestingClusterTestGlobalStruct?) + + sealed class NullableGlobalStructAttributeSubscriptionState { + data class Success(val value: UnitTestingClusterTestGlobalStruct?) : + NullableGlobalStructAttributeSubscriptionState() + + data class Error(val exception: Exception) : NullableGlobalStructAttributeSubscriptionState() + + object SubscriptionEstablished : NullableGlobalStructAttributeSubscriptionState() + } + class GeneratedCommandListAttribute(val value: List) sealed class GeneratedCommandListAttributeSubscriptionState { @@ -2386,6 +2420,68 @@ class UnitTestingCluster(private val controller: MatterController, private val e return StringEchoResponse(payload_decoded) } + suspend fun globalEchoRequest( + field1: UnitTestingClusterTestGlobalStruct, + field2: UByte, + timedInvokeTimeout: Duration? = null, + ): GlobalEchoResponse { + val commandId: UInt = 25u + + val tlvWriter = TlvWriter() + tlvWriter.startStructure(AnonymousTag) + + val TAG_FIELD1_REQ: Int = 0 + field1.toTlv(ContextSpecificTag(TAG_FIELD1_REQ), tlvWriter) + + val TAG_FIELD2_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_FIELD2_REQ), field2) + tlvWriter.endStructure() + + val request: InvokeRequest = + InvokeRequest( + CommandPath(endpointId, clusterId = CLUSTER_ID, commandId), + tlvPayload = tlvWriter.getEncoded(), + timedRequest = timedInvokeTimeout, + ) + + val response: InvokeResponse = controller.invoke(request) + logger.log(Level.FINE, "Invoke command succeeded: ${response}") + + val tlvReader = TlvReader(response.payload) + tlvReader.enterStructure(AnonymousTag) + val TAG_FIELD1: Int = 0 + var field1_decoded: UnitTestingClusterTestGlobalStruct? = null + + val TAG_FIELD2: Int = 1 + var field2_decoded: UByte? = null + + while (!tlvReader.isEndOfContainer()) { + val tag = tlvReader.peekElement().tag + + if (tag == ContextSpecificTag(TAG_FIELD1)) { + field1_decoded = UnitTestingClusterTestGlobalStruct.fromTlv(tag, tlvReader) + } + + if (tag == ContextSpecificTag(TAG_FIELD2)) { + field2_decoded = tlvReader.getUByte(tag) + } else { + tlvReader.skipElement() + } + } + + if (field1_decoded == null) { + throw IllegalStateException("field1 not found in TLV") + } + + if (field2_decoded == null) { + throw IllegalStateException("field2 not found in TLV") + } + + tlvReader.exitContainer() + + return GlobalEchoResponse(field1_decoded, field2_decoded) + } + suspend fun testDifferentVendorMeiRequest( arg1: UByte, timedInvokeTimeout: Duration? = null, @@ -8305,8 +8401,8 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } - suspend fun readUnsupportedAttribute(): Boolean? { - val ATTRIBUTE_ID: UInt = 255u + suspend fun readGlobalEnumAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 51u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8327,22 +8423,17 @@ class UnitTestingCluster(private val controller: MatterController, private val e it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Unsupported attribute not found in response" } + requireNotNull(attributeData) { "Globalenum attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null - } + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) return decodedValue } - suspend fun writeUnsupportedAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 255u + suspend fun writeGlobalEnumAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 51u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -8381,11 +8472,11 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } - suspend fun subscribeUnsupportedAttribute( + suspend fun subscribeGlobalEnumAttribute( minInterval: Int, maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 255u + ): Flow { + val ATTRIBUTE_ID: UInt = 51u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8403,7 +8494,7 @@ class UnitTestingCluster(private val controller: MatterController, private val e when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - BooleanSubscriptionState.Error( + UByteSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -8416,28 +8507,23 @@ class UnitTestingCluster(private val controller: MatterController, private val e .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Unsupported attribute not found in Node State update" } + requireNotNull(attributeData) { "Globalenum attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getBoolean(AnonymousTag) - } else { - null - } + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) - decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } + emit(UByteSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { - emit(BooleanSubscriptionState.SubscriptionEstablished) + emit(UByteSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readNullableBooleanAttribute(): NullableBooleanAttribute { - val ATTRIBUTE_ID: UInt = 16384u + suspend fun readGlobalStructAttribute(): GlobalStructAttribute { + val ATTRIBUTE_ID: UInt = 52u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8458,26 +8544,24 @@ class UnitTestingCluster(private val controller: MatterController, private val e it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Nullableboolean attribute not found in response" } + requireNotNull(attributeData) { "Globalstruct attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (!tlvReader.isNull()) { - tlvReader.getBoolean(AnonymousTag) - } else { - tlvReader.getNull(AnonymousTag) - null - } + val decodedValue: UnitTestingClusterTestGlobalStruct = + UnitTestingClusterTestGlobalStruct.fromTlv(AnonymousTag, tlvReader) - return NullableBooleanAttribute(decodedValue) + return GlobalStructAttribute(decodedValue) } - suspend fun writeNullableBooleanAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 16384u + suspend fun writeGlobalStructAttribute( + value: UnitTestingClusterTestGlobalStruct, + timedWriteTimeout: Duration? = null, + ) { + val ATTRIBUTE_ID: UInt = 52u val tlvWriter = TlvWriter() - tlvWriter.put(AnonymousTag, value) + value.toTlv(AnonymousTag, tlvWriter) val writeRequests: WriteRequests = WriteRequests( @@ -8513,11 +8597,11 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } - suspend fun subscribeNullableBooleanAttribute( + suspend fun subscribeGlobalStructAttribute( minInterval: Int, maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 16384u + ): Flow { + val ATTRIBUTE_ID: UInt = 52u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8535,7 +8619,7 @@ class UnitTestingCluster(private val controller: MatterController, private val e when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - NullableBooleanAttributeSubscriptionState.Error( + GlobalStructAttributeSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -8548,31 +8632,24 @@ class UnitTestingCluster(private val controller: MatterController, private val e .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { - "Nullableboolean attribute not found in Node State update" - } + requireNotNull(attributeData) { "Globalstruct attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: Boolean? = - if (!tlvReader.isNull()) { - tlvReader.getBoolean(AnonymousTag) - } else { - tlvReader.getNull(AnonymousTag) - null - } + val decodedValue: UnitTestingClusterTestGlobalStruct = + UnitTestingClusterTestGlobalStruct.fromTlv(AnonymousTag, tlvReader) - decodedValue?.let { emit(NullableBooleanAttributeSubscriptionState.Success(it)) } + emit(GlobalStructAttributeSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { - emit(NullableBooleanAttributeSubscriptionState.SubscriptionEstablished) + emit(GlobalStructAttributeSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readNullableBitmap8Attribute(): NullableBitmap8Attribute { - val ATTRIBUTE_ID: UInt = 16385u + suspend fun readUnsupportedAttribute(): Boolean? { + val ATTRIBUTE_ID: UInt = 255u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8593,23 +8670,22 @@ class UnitTestingCluster(private val controller: MatterController, private val e it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Nullablebitmap8 attribute not found in response" } + requireNotNull(attributeData) { "Unsupported attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UByte? = - if (!tlvReader.isNull()) { - tlvReader.getUByte(AnonymousTag) + val decodedValue: Boolean? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getBoolean(AnonymousTag) } else { - tlvReader.getNull(AnonymousTag) null } - return NullableBitmap8Attribute(decodedValue) + return decodedValue } - suspend fun writeNullableBitmap8Attribute(value: UByte, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 16385u + suspend fun writeUnsupportedAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 255u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -8648,11 +8724,11 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } - suspend fun subscribeNullableBitmap8Attribute( + suspend fun subscribeUnsupportedAttribute( minInterval: Int, maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 16385u + ): Flow { + val ATTRIBUTE_ID: UInt = 255u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8670,7 +8746,7 @@ class UnitTestingCluster(private val controller: MatterController, private val e when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - NullableBitmap8AttributeSubscriptionState.Error( + BooleanSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -8683,31 +8759,28 @@ class UnitTestingCluster(private val controller: MatterController, private val e .filterIsInstance() .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { - "Nullablebitmap8 attribute not found in Node State update" - } + requireNotNull(attributeData) { "Unsupported 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.isNull()) { - tlvReader.getUByte(AnonymousTag) + val decodedValue: Boolean? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getBoolean(AnonymousTag) } else { - tlvReader.getNull(AnonymousTag) null } - decodedValue?.let { emit(NullableBitmap8AttributeSubscriptionState.Success(it)) } + decodedValue?.let { emit(BooleanSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(NullableBitmap8AttributeSubscriptionState.SubscriptionEstablished) + emit(BooleanSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readNullableBitmap16Attribute(): NullableBitmap16Attribute { - val ATTRIBUTE_ID: UInt = 16386u + suspend fun readNullableBooleanAttribute(): NullableBooleanAttribute { + val ATTRIBUTE_ID: UInt = 16384u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8728,23 +8801,23 @@ class UnitTestingCluster(private val controller: MatterController, private val e it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Nullablebitmap16 attribute not found in response" } + requireNotNull(attributeData) { "Nullableboolean attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UShort? = + val decodedValue: Boolean? = if (!tlvReader.isNull()) { - tlvReader.getUShort(AnonymousTag) + tlvReader.getBoolean(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null } - return NullableBitmap16Attribute(decodedValue) + return NullableBooleanAttribute(decodedValue) } - suspend fun writeNullableBitmap16Attribute(value: UShort, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 16386u + suspend fun writeNullableBooleanAttribute(value: Boolean, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 16384u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -8783,11 +8856,11 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } - suspend fun subscribeNullableBitmap16Attribute( + suspend fun subscribeNullableBooleanAttribute( minInterval: Int, maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 16386u + ): Flow { + val ATTRIBUTE_ID: UInt = 16384u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8805,7 +8878,7 @@ class UnitTestingCluster(private val controller: MatterController, private val e when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - NullableBitmap16AttributeSubscriptionState.Error( + NullableBooleanAttributeSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -8819,30 +8892,30 @@ class UnitTestingCluster(private val controller: MatterController, private val e .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Nullablebitmap16 attribute not found in Node State update" + "Nullableboolean attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UShort? = + val decodedValue: Boolean? = if (!tlvReader.isNull()) { - tlvReader.getUShort(AnonymousTag) + tlvReader.getBoolean(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null } - decodedValue?.let { emit(NullableBitmap16AttributeSubscriptionState.Success(it)) } + decodedValue?.let { emit(NullableBooleanAttributeSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(NullableBitmap16AttributeSubscriptionState.SubscriptionEstablished) + emit(NullableBooleanAttributeSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readNullableBitmap32Attribute(): NullableBitmap32Attribute { - val ATTRIBUTE_ID: UInt = 16387u + suspend fun readNullableBitmap8Attribute(): NullableBitmap8Attribute { + val ATTRIBUTE_ID: UInt = 16385u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8863,23 +8936,23 @@ class UnitTestingCluster(private val controller: MatterController, private val e it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Nullablebitmap32 attribute not found in response" } + requireNotNull(attributeData) { "Nullablebitmap8 attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UInt? = + val decodedValue: UByte? = if (!tlvReader.isNull()) { - tlvReader.getUInt(AnonymousTag) + tlvReader.getUByte(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null } - return NullableBitmap32Attribute(decodedValue) + return NullableBitmap8Attribute(decodedValue) } - suspend fun writeNullableBitmap32Attribute(value: UInt, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 16387u + suspend fun writeNullableBitmap8Attribute(value: UByte, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 16385u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -8918,11 +8991,11 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } - suspend fun subscribeNullableBitmap32Attribute( + suspend fun subscribeNullableBitmap8Attribute( minInterval: Int, maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 16387u + ): Flow { + val ATTRIBUTE_ID: UInt = 16385u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8940,7 +9013,7 @@ class UnitTestingCluster(private val controller: MatterController, private val e when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - NullableBitmap32AttributeSubscriptionState.Error( + NullableBitmap8AttributeSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -8954,30 +9027,30 @@ class UnitTestingCluster(private val controller: MatterController, private val e .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Nullablebitmap32 attribute not found in Node State update" + "Nullablebitmap8 attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: UInt? = + val decodedValue: UByte? = if (!tlvReader.isNull()) { - tlvReader.getUInt(AnonymousTag) + tlvReader.getUByte(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null } - decodedValue?.let { emit(NullableBitmap32AttributeSubscriptionState.Success(it)) } + decodedValue?.let { emit(NullableBitmap8AttributeSubscriptionState.Success(it)) } } SubscriptionState.SubscriptionEstablished -> { - emit(NullableBitmap32AttributeSubscriptionState.SubscriptionEstablished) + emit(NullableBitmap8AttributeSubscriptionState.SubscriptionEstablished) } } } } - suspend fun readNullableBitmap64Attribute(): NullableBitmap64Attribute { - val ATTRIBUTE_ID: UInt = 16388u + suspend fun readNullableBitmap16Attribute(): NullableBitmap16Attribute { + val ATTRIBUTE_ID: UInt = 16386u val attributePath = AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -8998,23 +9071,23 @@ class UnitTestingCluster(private val controller: MatterController, private val e it.path.attributeId == ATTRIBUTE_ID } - requireNotNull(attributeData) { "Nullablebitmap64 attribute not found in response" } + requireNotNull(attributeData) { "Nullablebitmap16 attribute not found in response" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: ULong? = + val decodedValue: UShort? = if (!tlvReader.isNull()) { - tlvReader.getULong(AnonymousTag) + tlvReader.getUShort(AnonymousTag) } else { tlvReader.getNull(AnonymousTag) null } - return NullableBitmap64Attribute(decodedValue) + return NullableBitmap16Attribute(decodedValue) } - suspend fun writeNullableBitmap64Attribute(value: ULong, timedWriteTimeout: Duration? = null) { - val ATTRIBUTE_ID: UInt = 16388u + suspend fun writeNullableBitmap16Attribute(value: UShort, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 16386u val tlvWriter = TlvWriter() tlvWriter.put(AnonymousTag, value) @@ -9053,11 +9126,11 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } - suspend fun subscribeNullableBitmap64Attribute( + suspend fun subscribeNullableBitmap16Attribute( minInterval: Int, maxInterval: Int, - ): Flow { - val ATTRIBUTE_ID: UInt = 16388u + ): Flow { + val ATTRIBUTE_ID: UInt = 16386u val attributePaths = listOf( AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) @@ -9075,7 +9148,7 @@ class UnitTestingCluster(private val controller: MatterController, private val e when (subscriptionState) { is SubscriptionState.SubscriptionErrorNotification -> { emit( - NullableBitmap64AttributeSubscriptionState.Error( + NullableBitmap16AttributeSubscriptionState.Error( Exception( "Subscription terminated with error code: ${subscriptionState.terminationCause}" ) @@ -9089,12 +9162,282 @@ class UnitTestingCluster(private val controller: MatterController, private val e .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } requireNotNull(attributeData) { - "Nullablebitmap64 attribute not found in Node State update" + "Nullablebitmap16 attribute not found in Node State update" } // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: ULong? = + val decodedValue: UShort? = + if (!tlvReader.isNull()) { + tlvReader.getUShort(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NullableBitmap16AttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NullableBitmap16AttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNullableBitmap32Attribute(): NullableBitmap32Attribute { + val ATTRIBUTE_ID: UInt = 16387u + + 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) { "Nullablebitmap32 attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NullableBitmap32Attribute(decodedValue) + } + + suspend fun writeNullableBitmap32Attribute(value: UInt, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 16387u + + val tlvWriter = TlvWriter() + tlvWriter.put(AnonymousTag, value) + + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded(), + ) + ), + timedRequest = timedWriteTimeout, + ) + + val response: WriteResponse = controller.write(writeRequests) + + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") + } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } + + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } + + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") + } + } + } + + suspend fun subscribeNullableBitmap32Attribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 16387u + 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( + NullableBitmap32AttributeSubscriptionState.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) { + "Nullablebitmap32 attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt? = + if (!tlvReader.isNull()) { + tlvReader.getUInt(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NullableBitmap32AttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NullableBitmap32AttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNullableBitmap64Attribute(): NullableBitmap64Attribute { + val ATTRIBUTE_ID: UInt = 16388u + + 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) { "Nullablebitmap64 attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = + if (!tlvReader.isNull()) { + tlvReader.getULong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NullableBitmap64Attribute(decodedValue) + } + + suspend fun writeNullableBitmap64Attribute(value: ULong, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 16388u + + val tlvWriter = TlvWriter() + tlvWriter.put(AnonymousTag, value) + + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded(), + ) + ), + timedRequest = timedWriteTimeout, + ) + + val response: WriteResponse = controller.write(writeRequests) + + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") + } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } + + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } + + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") + } + } + } + + suspend fun subscribeNullableBitmap64Attribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 16388u + 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( + NullableBitmap64AttributeSubscriptionState.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) { + "Nullablebitmap64 attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ULong? = if (!tlvReader.isNull()) { tlvReader.getULong(AnonymousTag) } else { @@ -13051,6 +13394,279 @@ class UnitTestingCluster(private val controller: MatterController, private val e } } + suspend fun readNullableGlobalEnumAttribute(): NullableGlobalEnumAttribute { + val ATTRIBUTE_ID: UInt = 16435u + + 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) { "Nullableglobalenum attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte? = + if (!tlvReader.isNull()) { + tlvReader.getUByte(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NullableGlobalEnumAttribute(decodedValue) + } + + suspend fun writeNullableGlobalEnumAttribute(value: UByte, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 16435u + + val tlvWriter = TlvWriter() + tlvWriter.put(AnonymousTag, value) + + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded(), + ) + ), + timedRequest = timedWriteTimeout, + ) + + val response: WriteResponse = controller.write(writeRequests) + + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") + } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } + + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } + + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") + } + } + } + + suspend fun subscribeNullableGlobalEnumAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 16435u + 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( + NullableGlobalEnumAttributeSubscriptionState.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) { + "Nullableglobalenum 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.isNull()) { + tlvReader.getUByte(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NullableGlobalEnumAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NullableGlobalEnumAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNullableGlobalStructAttribute(): NullableGlobalStructAttribute { + val ATTRIBUTE_ID: UInt = 16436u + + 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) { "Nullableglobalstruct attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UnitTestingClusterTestGlobalStruct? = + if (!tlvReader.isNull()) { + UnitTestingClusterTestGlobalStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NullableGlobalStructAttribute(decodedValue) + } + + suspend fun writeNullableGlobalStructAttribute( + value: UnitTestingClusterTestGlobalStruct, + timedWriteTimeout: Duration? = null, + ) { + val ATTRIBUTE_ID: UInt = 16436u + + val tlvWriter = TlvWriter() + value.toTlv(AnonymousTag, tlvWriter) + + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded(), + ) + ), + timedRequest = timedWriteTimeout, + ) + + val response: WriteResponse = controller.write(writeRequests) + + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") + } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } + + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } + + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") + } + } + } + + suspend fun subscribeNullableGlobalStructAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 16436u + 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( + NullableGlobalStructAttributeSubscriptionState.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) { + "Nullableglobalstruct attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UnitTestingClusterTestGlobalStruct? = + if (!tlvReader.isNull()) { + UnitTestingClusterTestGlobalStruct.fromTlv(AnonymousTag, tlvReader) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NullableGlobalStructAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NullableGlobalStructAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readMeiInt8uAttribute(): UByte { val ATTRIBUTE_ID: UInt = 4294070017u 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 807ecf29094786..cbf2790dac68f8 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -152,6 +152,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterNullablesAndOptionalsStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterSimpleStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestFabricScoped.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestListStructOctet.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/UserLabelClusterLabelStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/WaterHeaterModeClusterModeOptionStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterNestedStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterNestedStruct.kt index 3552ec2a5fc075..d57a0432a7c7ed 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterNestedStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterNestedStruct.kt @@ -16,6 +16,7 @@ */ package matter.controller.cluster.structs +import java.util.Optional import matter.controller.cluster.* import matter.tlv.ContextSpecificTag import matter.tlv.Tag @@ -26,12 +27,14 @@ class UnitTestingClusterNestedStruct( val a: UByte, val b: Boolean, val c: UnitTestingClusterSimpleStruct, + val d: Optional, ) { override fun toString(): String = buildString { append("UnitTestingClusterNestedStruct {\n") append("\ta : $a\n") append("\tb : $b\n") append("\tc : $c\n") + append("\td : $d\n") append("}\n") } @@ -41,6 +44,10 @@ class UnitTestingClusterNestedStruct( put(ContextSpecificTag(TAG_A), a) put(ContextSpecificTag(TAG_B), b) c.toTlv(ContextSpecificTag(TAG_C), this) + if (d.isPresent) { + val optd = d.get() + optd.toTlv(ContextSpecificTag(TAG_D), this) + } endStructure() } } @@ -49,16 +56,25 @@ class UnitTestingClusterNestedStruct( private const val TAG_A = 0 private const val TAG_B = 1 private const val TAG_C = 2 + private const val TAG_D = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): UnitTestingClusterNestedStruct { tlvReader.enterStructure(tlvTag) val a = tlvReader.getUByte(ContextSpecificTag(TAG_A)) val b = tlvReader.getBoolean(ContextSpecificTag(TAG_B)) val c = UnitTestingClusterSimpleStruct.fromTlv(ContextSpecificTag(TAG_C), tlvReader) + val d = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_D))) { + Optional.of( + UnitTestingClusterTestGlobalStruct.fromTlv(ContextSpecificTag(TAG_D), tlvReader) + ) + } else { + Optional.empty() + } tlvReader.exitContainer() - return UnitTestingClusterNestedStruct(a, b, c) + return UnitTestingClusterNestedStruct(a, b, c, d) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterSimpleStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterSimpleStruct.kt index 864a28ffd7defc..722445efea8504 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterSimpleStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterSimpleStruct.kt @@ -16,6 +16,7 @@ */ package matter.controller.cluster.structs +import java.util.Optional import matter.controller.cluster.* import matter.tlv.ContextSpecificTag import matter.tlv.Tag @@ -31,6 +32,7 @@ class UnitTestingClusterSimpleStruct( val f: UByte, val g: Float, val h: Double, + val i: Optional, ) { override fun toString(): String = buildString { append("UnitTestingClusterSimpleStruct {\n") @@ -42,6 +44,7 @@ class UnitTestingClusterSimpleStruct( append("\tf : $f\n") append("\tg : $g\n") append("\th : $h\n") + append("\ti : $i\n") append("}\n") } @@ -56,6 +59,10 @@ class UnitTestingClusterSimpleStruct( put(ContextSpecificTag(TAG_F), f) put(ContextSpecificTag(TAG_G), g) put(ContextSpecificTag(TAG_H), h) + if (i.isPresent) { + val opti = i.get() + put(ContextSpecificTag(TAG_I), opti) + } endStructure() } } @@ -69,6 +76,7 @@ class UnitTestingClusterSimpleStruct( private const val TAG_F = 5 private const val TAG_G = 6 private const val TAG_H = 7 + private const val TAG_I = 8 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): UnitTestingClusterSimpleStruct { tlvReader.enterStructure(tlvTag) @@ -80,10 +88,16 @@ class UnitTestingClusterSimpleStruct( val f = tlvReader.getUByte(ContextSpecificTag(TAG_F)) val g = tlvReader.getFloat(ContextSpecificTag(TAG_G)) val h = tlvReader.getDouble(ContextSpecificTag(TAG_H)) + val i = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_I))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_I))) + } else { + Optional.empty() + } tlvReader.exitContainer() - return UnitTestingClusterSimpleStruct(a, b, c, d, e, f, g, h) + return UnitTestingClusterSimpleStruct(a, b, c, d, e, f, g, h, i) } } } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt new file mode 100644 index 00000000000000..66caded2c08ab3 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/UnitTestingClusterTestGlobalStruct.kt @@ -0,0 +1,92 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class UnitTestingClusterTestGlobalStruct( + val name: String, + val myBitmap: UInt?, + val myEnum: Optional?, +) { + override fun toString(): String = buildString { + append("UnitTestingClusterTestGlobalStruct {\n") + append("\tname : $name\n") + append("\tmyBitmap : $myBitmap\n") + append("\tmyEnum : $myEnum\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_NAME), name) + if (myBitmap != null) { + put(ContextSpecificTag(TAG_MY_BITMAP), myBitmap) + } else { + putNull(ContextSpecificTag(TAG_MY_BITMAP)) + } + if (myEnum != null) { + if (myEnum.isPresent) { + val optmyEnum = myEnum.get() + put(ContextSpecificTag(TAG_MY_ENUM), optmyEnum) + } + } else { + putNull(ContextSpecificTag(TAG_MY_ENUM)) + } + endStructure() + } + } + + companion object { + private const val TAG_NAME = 0 + private const val TAG_MY_BITMAP = 1 + private const val TAG_MY_ENUM = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): UnitTestingClusterTestGlobalStruct { + tlvReader.enterStructure(tlvTag) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val myBitmap = + if (!tlvReader.isNull()) { + tlvReader.getUInt(ContextSpecificTag(TAG_MY_BITMAP)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MY_BITMAP)) + null + } + val myEnum = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MY_ENUM))) { + Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_MY_ENUM))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MY_ENUM)) + null + } + + tlvReader.exitContainer() + + return UnitTestingClusterTestGlobalStruct(name, myBitmap, myEnum) + } + } +} diff --git a/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt index 55c880e02e4bf2..bfee37f38f5437 100644 --- a/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt +++ b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt @@ -19,6 +19,7 @@ package chip.devicecontroller.cluster import chip.devicecontroller.cluster.eventstructs.UnitTestingClusterTestEventEvent import chip.devicecontroller.cluster.eventstructs.UnitTestingClusterTestFabricScopedEventEvent import chip.devicecontroller.cluster.structs.UnitTestingClusterSimpleStruct +import java.util.Optional import matter.tlv.AnonymousTag import matter.tlv.TlvReader import matter.tlv.TlvWriter @@ -28,9 +29,29 @@ class ChipClusterEventStructTest { @Test fun testEventEventTlvTest() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val simpleStruct2 = - UnitTestingClusterSimpleStruct(8U, false, 9U, byteArrayOf(0x02, 0x03), "test2", 4U, 5.6f, 7.8) + UnitTestingClusterSimpleStruct( + 8U, + false, + 9U, + byteArrayOf(0x02, 0x03), + "test2", + 4U, + 5.6f, + 7.8, + Optional.empty() + ) val struct = UnitTestingClusterTestEventEvent( 1U, diff --git a/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt index ffa0044569e0af..a38a71d63141ee 100644 --- a/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt +++ b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt @@ -35,9 +35,29 @@ class ChipClusterStructTest { @Test fun doubleNestedStructTlvTest() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val simpleStruct2 = - UnitTestingClusterSimpleStruct(8U, false, 9U, byteArrayOf(0x02, 0x03), "test2", 4U, 5.6f, 7.8) + UnitTestingClusterSimpleStruct( + 8U, + false, + 9U, + byteArrayOf(0x02, 0x03), + "test2", + 4U, + 5.6f, + 7.8, + Optional.empty() + ) val nestedStructList = UnitTestingClusterNestedStructList( 1U, @@ -82,7 +102,17 @@ class ChipClusterStructTest { @Test fun nullablesAndOptionalsStructTlvTest1() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterNullablesAndOptionalsStruct( 1U, @@ -121,7 +151,17 @@ class ChipClusterStructTest { // Optional Check - 1 fun nullablesAndOptionalsStructTlvTest2() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterNullablesAndOptionalsStruct( 1U, @@ -160,7 +200,17 @@ class ChipClusterStructTest { // Optional Check - 2 fun nullablesAndOptionalsStructTlvTest3() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterNullablesAndOptionalsStruct( 1U, @@ -199,7 +249,17 @@ class ChipClusterStructTest { // Nullable check - 1 fun nullablesAndOptionalsStructTlvTest4() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterNullablesAndOptionalsStruct( 1U, @@ -238,7 +298,17 @@ class ChipClusterStructTest { // Nullable check - 2 fun nullablesAndOptionalsStructTlvTest5() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterNullablesAndOptionalsStruct( null, @@ -276,7 +346,17 @@ class ChipClusterStructTest { @Test fun testFabricScopedTlvTest1() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterTestFabricScoped( 1U, @@ -309,7 +389,17 @@ class ChipClusterStructTest { @Test fun testFabricScopedTlvTest2() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterTestFabricScoped( 1U, @@ -342,7 +432,17 @@ class ChipClusterStructTest { @Test fun testFabricScopedTlvTest3() { val simpleStruct = - UnitTestingClusterSimpleStruct(1U, true, 2U, byteArrayOf(0x00, 0x01), "test", 3U, 4.5f, 6.7) + UnitTestingClusterSimpleStruct( + 1U, + true, + 2U, + byteArrayOf(0x00, 0x01), + "test", + 3U, + 4.5f, + 6.7, + Optional.empty() + ) val struct = UnitTestingClusterTestFabricScoped( 1U, diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 7fdd6114e99148..bcbfdeb2fc84b3 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -46552,6 +46552,25 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR chip::JniReferences::GetInstance().CreateBoxedObject( newElement_0_nullableStruct_hClassName.c_str(), newElement_0_nullableStruct_hCtorSignature.c_str(), jninewElement_0_nullableStruct_h, newElement_0_nullableStruct_h); + jobject newElement_0_nullableStruct_i; + if (!entry_0.nullableStruct.Value().i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_nullableStruct_i); + } + else + { + jobject newElement_0_nullableStruct_iInsideOptional; + std::string newElement_0_nullableStruct_iInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_nullableStruct_iInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_nullableStruct_iInsideOptional = + static_cast(entry_0.nullableStruct.Value().i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableStruct_iInsideOptionalClassName.c_str(), + newElement_0_nullableStruct_iInsideOptionalCtorSignature.c_str(), + jninewElement_0_nullableStruct_iInsideOptional, newElement_0_nullableStruct_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_nullableStruct_iInsideOptional, + newElement_0_nullableStruct_i); + } jclass simpleStructStructClass_3; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -46566,7 +46585,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_3, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/Integer;Ljava/" - "lang/Float;Ljava/lang/Double;)V", + "lang/Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_3); if (err != CHIP_NO_ERROR || simpleStructStructCtor_3 == nullptr) { @@ -46578,7 +46597,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR env->NewObject(simpleStructStructClass_3, simpleStructStructCtor_3, newElement_0_nullableStruct_a, newElement_0_nullableStruct_b, newElement_0_nullableStruct_c, newElement_0_nullableStruct_d, newElement_0_nullableStruct_e, newElement_0_nullableStruct_f, newElement_0_nullableStruct_g, - newElement_0_nullableStruct_h); + newElement_0_nullableStruct_h, newElement_0_nullableStruct_i); } jobject newElement_0_optionalStruct; if (!entry_0.optionalStruct.HasValue()) @@ -46647,6 +46666,26 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_optionalStructInsideOptional_hClassName.c_str(), newElement_0_optionalStructInsideOptional_hCtorSignature.c_str(), jninewElement_0_optionalStructInsideOptional_h, newElement_0_optionalStructInsideOptional_h); + jobject newElement_0_optionalStructInsideOptional_i; + if (!entry_0.optionalStruct.Value().i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_optionalStructInsideOptional_i); + } + else + { + jobject newElement_0_optionalStructInsideOptional_iInsideOptional; + std::string newElement_0_optionalStructInsideOptional_iInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_optionalStructInsideOptional_iInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_optionalStructInsideOptional_iInsideOptional = + static_cast(entry_0.optionalStruct.Value().i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_optionalStructInsideOptional_iInsideOptionalClassName.c_str(), + newElement_0_optionalStructInsideOptional_iInsideOptionalCtorSignature.c_str(), + jninewElement_0_optionalStructInsideOptional_iInsideOptional, + newElement_0_optionalStructInsideOptional_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_optionalStructInsideOptional_iInsideOptional, + newElement_0_optionalStructInsideOptional_i); + } jclass simpleStructStructClass_3; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -46661,7 +46700,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_3, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/Integer;Ljava/" - "lang/Float;Ljava/lang/Double;)V", + "lang/Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_3); if (err != CHIP_NO_ERROR || simpleStructStructCtor_3 == nullptr) { @@ -46669,12 +46708,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } - newElement_0_optionalStructInsideOptional = - env->NewObject(simpleStructStructClass_3, simpleStructStructCtor_3, - newElement_0_optionalStructInsideOptional_a, newElement_0_optionalStructInsideOptional_b, - newElement_0_optionalStructInsideOptional_c, newElement_0_optionalStructInsideOptional_d, - newElement_0_optionalStructInsideOptional_e, newElement_0_optionalStructInsideOptional_f, - newElement_0_optionalStructInsideOptional_g, newElement_0_optionalStructInsideOptional_h); + newElement_0_optionalStructInsideOptional = env->NewObject( + simpleStructStructClass_3, simpleStructStructCtor_3, newElement_0_optionalStructInsideOptional_a, + newElement_0_optionalStructInsideOptional_b, newElement_0_optionalStructInsideOptional_c, + newElement_0_optionalStructInsideOptional_d, newElement_0_optionalStructInsideOptional_e, + newElement_0_optionalStructInsideOptional_f, newElement_0_optionalStructInsideOptional_g, + newElement_0_optionalStructInsideOptional_h, newElement_0_optionalStructInsideOptional_i); chip::JniReferences::GetInstance().CreateOptional(newElement_0_optionalStructInsideOptional, newElement_0_optionalStruct); } @@ -46764,6 +46803,29 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_nullableOptionalStructInsideOptional_hCtorSignature.c_str(), jninewElement_0_nullableOptionalStructInsideOptional_h, newElement_0_nullableOptionalStructInsideOptional_h); + jobject newElement_0_nullableOptionalStructInsideOptional_i; + if (!entry_0.nullableOptionalStruct.Value().Value().i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, + newElement_0_nullableOptionalStructInsideOptional_i); + } + else + { + jobject newElement_0_nullableOptionalStructInsideOptional_iInsideOptional; + std::string newElement_0_nullableOptionalStructInsideOptional_iInsideOptionalClassName = + "java/lang/Integer"; + std::string newElement_0_nullableOptionalStructInsideOptional_iInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_nullableOptionalStructInsideOptional_iInsideOptional = + static_cast(entry_0.nullableOptionalStruct.Value().Value().i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_nullableOptionalStructInsideOptional_iInsideOptionalClassName.c_str(), + newElement_0_nullableOptionalStructInsideOptional_iInsideOptionalCtorSignature.c_str(), + jninewElement_0_nullableOptionalStructInsideOptional_iInsideOptional, + newElement_0_nullableOptionalStructInsideOptional_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional( + newElement_0_nullableOptionalStructInsideOptional_iInsideOptional, + newElement_0_nullableOptionalStructInsideOptional_i); + } jclass simpleStructStructClass_4; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -46778,7 +46840,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_4, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/" - "Integer;Ljava/lang/Float;Ljava/lang/Double;)V", + "Integer;Ljava/lang/Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_4); if (err != CHIP_NO_ERROR || simpleStructStructCtor_4 == nullptr) { @@ -46795,7 +46857,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_nullableOptionalStructInsideOptional_e, newElement_0_nullableOptionalStructInsideOptional_f, newElement_0_nullableOptionalStructInsideOptional_g, - newElement_0_nullableOptionalStructInsideOptional_h); + newElement_0_nullableOptionalStructInsideOptional_h, + newElement_0_nullableOptionalStructInsideOptional_i); } chip::JniReferences::GetInstance().CreateOptional(newElement_0_nullableOptionalStructInsideOptional, newElement_0_nullableOptionalStruct); @@ -46983,6 +47046,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jdouble jnivalue_h = static_cast(cppValue.h); chip::JniReferences::GetInstance().CreateBoxedObject(value_hClassName.c_str(), value_hCtorSignature.c_str(), jnivalue_h, value_h); + jobject value_i; + if (!cppValue.i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_i); + } + else + { + jobject value_iInsideOptional; + std::string value_iInsideOptionalClassName = "java/lang/Integer"; + std::string value_iInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_iInsideOptional = static_cast(cppValue.i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(value_iInsideOptionalClassName.c_str(), + value_iInsideOptionalCtorSignature.c_str(), + jnivalue_iInsideOptional, value_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_iInsideOptional, value_i); + } jclass simpleStructStructClass_0; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -46997,7 +47076,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_0, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/" - "Float;Ljava/lang/Double;)V", + "Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_0); if (err != CHIP_NO_ERROR || simpleStructStructCtor_0 == nullptr) { @@ -47006,7 +47085,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } value = env->NewObject(simpleStructStructClass_0, simpleStructStructCtor_0, value_a, value_b, value_c, value_d, value_e, - value_f, value_g, value_h); + value_f, value_g, value_h, value_i); return value; } case Attributes::RangeRestrictedInt8u::Id: { @@ -47246,6 +47325,25 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_fabricSensitiveStruct_hClassName.c_str(), newElement_0_fabricSensitiveStruct_hCtorSignature.c_str(), jninewElement_0_fabricSensitiveStruct_h, newElement_0_fabricSensitiveStruct_h); + jobject newElement_0_fabricSensitiveStruct_i; + if (!entry_0.fabricSensitiveStruct.i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_fabricSensitiveStruct_i); + } + else + { + jobject newElement_0_fabricSensitiveStruct_iInsideOptional; + std::string newElement_0_fabricSensitiveStruct_iInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_fabricSensitiveStruct_iInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_fabricSensitiveStruct_iInsideOptional = + static_cast(entry_0.fabricSensitiveStruct.i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_fabricSensitiveStruct_iInsideOptionalClassName.c_str(), + newElement_0_fabricSensitiveStruct_iInsideOptionalCtorSignature.c_str(), + jninewElement_0_fabricSensitiveStruct_iInsideOptional, newElement_0_fabricSensitiveStruct_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_fabricSensitiveStruct_iInsideOptional, + newElement_0_fabricSensitiveStruct_i); + } jclass simpleStructStructClass_2; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -47260,7 +47358,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_2, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/" - "Float;Ljava/lang/Double;)V", + "Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_2); if (err != CHIP_NO_ERROR || simpleStructStructCtor_2 == nullptr) { @@ -47273,7 +47371,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR newElement_0_fabricSensitiveStruct_b, newElement_0_fabricSensitiveStruct_c, newElement_0_fabricSensitiveStruct_d, newElement_0_fabricSensitiveStruct_e, newElement_0_fabricSensitiveStruct_f, newElement_0_fabricSensitiveStruct_g, - newElement_0_fabricSensitiveStruct_h); + newElement_0_fabricSensitiveStruct_h, newElement_0_fabricSensitiveStruct_i); jobject newElement_0_fabricSensitiveInt8uList; chip::JniReferences::GetInstance().CreateArrayList(newElement_0_fabricSensitiveInt8uList); @@ -47375,6 +47473,93 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jnivalue, value); return value; } + case Attributes::GlobalEnum::Id: { + using TypeInfo = Attributes::GlobalEnum::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::GlobalStruct::Id: { + using TypeInfo = Attributes::GlobalStruct::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + jobject value_name; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(cppValue.name, value_name)); + jobject value_myBitmap; + if (cppValue.myBitmap.IsNull()) + { + value_myBitmap = nullptr; + } + else + { + std::string value_myBitmapClassName = "java/lang/Long"; + std::string value_myBitmapCtorSignature = "(J)V"; + jlong jnivalue_myBitmap = static_cast(cppValue.myBitmap.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_myBitmapClassName.c_str(), value_myBitmapCtorSignature.c_str(), jnivalue_myBitmap, value_myBitmap); + } + jobject value_myEnum; + if (!cppValue.myEnum.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_myEnum); + } + else + { + jobject value_myEnumInsideOptional; + if (cppValue.myEnum.Value().IsNull()) + { + value_myEnumInsideOptional = nullptr; + } + else + { + std::string value_myEnumInsideOptionalClassName = "java/lang/Integer"; + std::string value_myEnumInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_myEnumInsideOptional = static_cast(cppValue.myEnum.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_myEnumInsideOptionalClassName.c_str(), value_myEnumInsideOptionalCtorSignature.c_str(), + jnivalue_myEnumInsideOptional, value_myEnumInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional(value_myEnumInsideOptional, value_myEnum); + } + + jclass testGlobalStructStructClass_0; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$UnitTestingClusterTestGlobalStruct", testGlobalStructStructClass_0); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$UnitTestingClusterTestGlobalStruct"); + return nullptr; + } + + jmethodID testGlobalStructStructCtor_0; + err = chip::JniReferences::GetInstance().FindMethod(env, testGlobalStructStructClass_0, "", + "(Ljava/lang/String;Ljava/lang/Long;Ljava/util/Optional;)V", + &testGlobalStructStructCtor_0); + if (err != CHIP_NO_ERROR || testGlobalStructStructCtor_0 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$UnitTestingClusterTestGlobalStruct constructor"); + return nullptr; + } + + value = env->NewObject(testGlobalStructStructClass_0, testGlobalStructStructCtor_0, value_name, value_myBitmap, + value_myEnum); + return value; + } case Attributes::Unsupported::Id: { using TypeInfo = Attributes::Unsupported::TypeInfo; TypeInfo::DecodableType cppValue; @@ -48088,6 +48273,22 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR jdouble jnivalue_h = static_cast(cppValue.Value().h); chip::JniReferences::GetInstance().CreateBoxedObject(value_hClassName.c_str(), value_hCtorSignature.c_str(), jnivalue_h, value_h); + jobject value_i; + if (!cppValue.Value().i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_i); + } + else + { + jobject value_iInsideOptional; + std::string value_iInsideOptionalClassName = "java/lang/Integer"; + std::string value_iInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_iInsideOptional = static_cast(cppValue.Value().i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(value_iInsideOptionalClassName.c_str(), + value_iInsideOptionalCtorSignature.c_str(), + jnivalue_iInsideOptional, value_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_iInsideOptional, value_i); + } jclass simpleStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -48102,7 +48303,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_1, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/" - "Float;Ljava/lang/Double;)V", + "Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_1); if (err != CHIP_NO_ERROR || simpleStructStructCtor_1 == nullptr) { @@ -48111,7 +48312,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } value = env->NewObject(simpleStructStructClass_1, simpleStructStructCtor_1, value_a, value_b, value_c, value_d, - value_e, value_f, value_g, value_h); + value_e, value_f, value_g, value_h, value_i); } return value; } @@ -48223,6 +48424,107 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } + case Attributes::NullableGlobalEnum::Id: { + using TypeInfo = Attributes::NullableGlobalEnum::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::NullableGlobalStruct::Id: { + using TypeInfo = Attributes::NullableGlobalStruct::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_name; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(cppValue.Value().name, value_name)); + jobject value_myBitmap; + if (cppValue.Value().myBitmap.IsNull()) + { + value_myBitmap = nullptr; + } + else + { + std::string value_myBitmapClassName = "java/lang/Long"; + std::string value_myBitmapCtorSignature = "(J)V"; + jlong jnivalue_myBitmap = static_cast(cppValue.Value().myBitmap.Value().Raw()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_myBitmapClassName.c_str(), value_myBitmapCtorSignature.c_str(), jnivalue_myBitmap, value_myBitmap); + } + jobject value_myEnum; + if (!cppValue.Value().myEnum.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_myEnum); + } + else + { + jobject value_myEnumInsideOptional; + if (cppValue.Value().myEnum.Value().IsNull()) + { + value_myEnumInsideOptional = nullptr; + } + else + { + std::string value_myEnumInsideOptionalClassName = "java/lang/Integer"; + std::string value_myEnumInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_myEnumInsideOptional = static_cast(cppValue.Value().myEnum.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_myEnumInsideOptionalClassName.c_str(), value_myEnumInsideOptionalCtorSignature.c_str(), + jnivalue_myEnumInsideOptional, value_myEnumInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional(value_myEnumInsideOptional, value_myEnum); + } + + jclass testGlobalStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$UnitTestingClusterTestGlobalStruct", testGlobalStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$UnitTestingClusterTestGlobalStruct"); + return nullptr; + } + + jmethodID testGlobalStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod(env, testGlobalStructStructClass_1, "", + "(Ljava/lang/String;Ljava/lang/Long;Ljava/util/Optional;)V", + &testGlobalStructStructCtor_1); + if (err != CHIP_NO_ERROR || testGlobalStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$UnitTestingClusterTestGlobalStruct constructor"); + return nullptr; + } + + value = env->NewObject(testGlobalStructStructClass_1, testGlobalStructStructCtor_1, value_name, value_myBitmap, + value_myEnum); + } + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 7f3c03f9e8ab05..89a4a256880158 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -8260,6 +8260,22 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & jdouble jnivalue_arg4_h = static_cast(cppValue.arg4.h); chip::JniReferences::GetInstance().CreateBoxedObject( value_arg4_hClassName.c_str(), value_arg4_hCtorSignature.c_str(), jnivalue_arg4_h, value_arg4_h); + jobject value_arg4_i; + if (!cppValue.arg4.i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_arg4_i); + } + else + { + jobject value_arg4_iInsideOptional; + std::string value_arg4_iInsideOptionalClassName = "java/lang/Integer"; + std::string value_arg4_iInsideOptionalCtorSignature = "(I)V"; + jint jnivalue_arg4_iInsideOptional = static_cast(cppValue.arg4.i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_arg4_iInsideOptionalClassName.c_str(), value_arg4_iInsideOptionalCtorSignature.c_str(), + jnivalue_arg4_iInsideOptional, value_arg4_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_arg4_iInsideOptional, value_arg4_i); + } jclass simpleStructStructClass_0; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -8274,7 +8290,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_0, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/" - "Float;Ljava/lang/Double;)V", + "Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_0); if (err != CHIP_NO_ERROR || simpleStructStructCtor_0 == nullptr) { @@ -8282,8 +8298,9 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & return nullptr; } - value_arg4 = env->NewObject(simpleStructStructClass_0, simpleStructStructCtor_0, value_arg4_a, value_arg4_b, - value_arg4_c, value_arg4_d, value_arg4_e, value_arg4_f, value_arg4_g, value_arg4_h); + value_arg4 = + env->NewObject(simpleStructStructClass_0, simpleStructStructCtor_0, value_arg4_a, value_arg4_b, value_arg4_c, + value_arg4_d, value_arg4_e, value_arg4_f, value_arg4_g, value_arg4_h, value_arg4_i); jobject value_arg5; chip::JniReferences::GetInstance().CreateArrayList(value_arg5); @@ -8336,6 +8353,22 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & jdouble jninewElement_0_h = static_cast(entry_0.h); chip::JniReferences::GetInstance().CreateBoxedObject( newElement_0_hClassName.c_str(), newElement_0_hCtorSignature.c_str(), jninewElement_0_h, newElement_0_h); + jobject newElement_0_i; + if (!entry_0.i.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_i); + } + else + { + jobject newElement_0_iInsideOptional; + std::string newElement_0_iInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_0_iInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_0_iInsideOptional = static_cast(entry_0.i.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_iInsideOptionalClassName.c_str(), newElement_0_iInsideOptionalCtorSignature.c_str(), + jninewElement_0_iInsideOptional, newElement_0_iInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_iInsideOptional, newElement_0_i); + } jclass simpleStructStructClass_1; err = chip::JniReferences::GetInstance().GetLocalClassRef( @@ -8350,7 +8383,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & err = chip::JniReferences::GetInstance().FindMethod( env, simpleStructStructClass_1, "", "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Integer;[BLjava/lang/String;Ljava/lang/Integer;Ljava/lang/" - "Float;Ljava/lang/Double;)V", + "Float;Ljava/lang/Double;Ljava/util/Optional;)V", &simpleStructStructCtor_1); if (err != CHIP_NO_ERROR || simpleStructStructCtor_1 == nullptr) { @@ -8358,9 +8391,9 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & return nullptr; } - newElement_0 = - env->NewObject(simpleStructStructClass_1, simpleStructStructCtor_1, newElement_0_a, newElement_0_b, - newElement_0_c, newElement_0_d, newElement_0_e, newElement_0_f, newElement_0_g, newElement_0_h); + newElement_0 = env->NewObject(simpleStructStructClass_1, simpleStructStructCtor_1, newElement_0_a, newElement_0_b, + newElement_0_c, newElement_0_d, newElement_0_e, newElement_0_f, newElement_0_g, + newElement_0_h, newElement_0_i); chip::JniReferences::GetInstance().AddToList(value_arg5, newElement_0); } diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 44c78c0fd0e7f3..d0a212daf6ff55 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -14475,6 +14475,14 @@ class ChipClusters: "payload": "bytes", }, }, + 0x00000019: { + "commandId": 0x00000019, + "commandName": "GlobalEchoRequest", + "args": { + "field1": "TestGlobalStruct", + "field2": "int", + }, + }, 0xFFF200AA: { "commandId": 0xFFF200AA, "commandName": "TestDifferentVendorMeiRequest", @@ -14813,6 +14821,20 @@ class ChipClusters: "reportable": True, "writable": True, }, + 0x00000033: { + "attributeName": "GlobalEnum", + "attributeId": 0x00000033, + "type": "int", + "reportable": True, + "writable": True, + }, + 0x00000034: { + "attributeName": "GlobalStruct", + "attributeId": 0x00000034, + "type": "", + "reportable": True, + "writable": True, + }, 0x000000FF: { "attributeName": "Unsupported", "attributeId": 0x000000FF, @@ -15058,6 +15080,20 @@ class ChipClusters: "reportable": True, "writable": True, }, + 0x00004033: { + "attributeName": "NullableGlobalEnum", + "attributeId": 0x00004033, + "type": "int", + "reportable": True, + "writable": True, + }, + 0x00004034: { + "attributeName": "NullableGlobalStruct", + "attributeId": 0x00004034, + "type": "", + "reportable": True, + "writable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index c72db3785ac03b..b27f42f7ad4f43 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -50105,6 +50105,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="timedWriteBoolean", Tag=0x00000030, Type=bool), ClusterObjectFieldDescriptor(Label="generalErrorBoolean", Tag=0x00000031, Type=bool), ClusterObjectFieldDescriptor(Label="clusterErrorBoolean", Tag=0x00000032, Type=bool), + ClusterObjectFieldDescriptor(Label="globalEnum", Tag=0x00000033, Type=Globals.Enums.TestGlobalEnum), + ClusterObjectFieldDescriptor(Label="globalStruct", Tag=0x00000034, Type=Globals.Structs.TestGlobalStruct), ClusterObjectFieldDescriptor(Label="unsupported", Tag=0x000000FF, Type=typing.Optional[bool]), ClusterObjectFieldDescriptor(Label="nullableBoolean", Tag=0x00004000, Type=typing.Union[Nullable, bool]), ClusterObjectFieldDescriptor(Label="nullableBitmap8", Tag=0x00004001, Type=typing.Union[Nullable, uint]), @@ -50140,6 +50142,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt16u", Tag=0x00004028, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt16s", Tag=0x00004029, Type=typing.Union[Nullable, int]), ClusterObjectFieldDescriptor(Label="writeOnlyInt8u", Tag=0x0000402A, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="nullableGlobalEnum", Tag=0x00004033, Type=typing.Union[Nullable, Globals.Enums.TestGlobalEnum]), + ClusterObjectFieldDescriptor(Label="nullableGlobalStruct", Tag=0x00004034, Type=typing.Union[Nullable, Globals.Structs.TestGlobalStruct]), 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]), @@ -50196,6 +50200,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: timedWriteBoolean: 'bool' = None generalErrorBoolean: 'bool' = None clusterErrorBoolean: 'bool' = None + globalEnum: 'Globals.Enums.TestGlobalEnum' = None + globalStruct: 'Globals.Structs.TestGlobalStruct' = None unsupported: 'typing.Optional[bool]' = None nullableBoolean: 'typing.Union[Nullable, bool]' = None nullableBitmap8: 'typing.Union[Nullable, uint]' = None @@ -50231,6 +50237,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: nullableRangeRestrictedInt16u: 'typing.Union[Nullable, uint]' = None nullableRangeRestrictedInt16s: 'typing.Union[Nullable, int]' = None writeOnlyInt8u: 'typing.Optional[uint]' = None + nullableGlobalEnum: 'typing.Union[Nullable, Globals.Enums.TestGlobalEnum]' = None + nullableGlobalStruct: 'typing.Union[Nullable, Globals.Structs.TestGlobalStruct]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -50296,6 +50304,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="f", Tag=5, Type=uint), ClusterObjectFieldDescriptor(Label="g", Tag=6, Type=float32), ClusterObjectFieldDescriptor(Label="h", Tag=7, Type=float), + ClusterObjectFieldDescriptor(Label="i", Tag=8, Type=typing.Optional[Globals.Enums.TestGlobalEnum]), ]) a: 'uint' = 0 @@ -50306,6 +50315,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: f: 'uint' = 0 g: 'float32' = 0.0 h: 'float' = 0.0 + i: 'typing.Optional[Globals.Enums.TestGlobalEnum]' = None @dataclass class TestFabricScoped(ClusterObject): @@ -50374,11 +50384,13 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="a", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="b", Tag=1, Type=bool), ClusterObjectFieldDescriptor(Label="c", Tag=2, Type=UnitTesting.Structs.SimpleStruct), + ClusterObjectFieldDescriptor(Label="d", Tag=3, Type=typing.Optional[Globals.Structs.TestGlobalStruct]), ]) a: 'uint' = 0 b: 'bool' = False c: 'UnitTesting.Structs.SimpleStruct' = field(default_factory=lambda: UnitTesting.Structs.SimpleStruct()) + d: 'typing.Optional[Globals.Structs.TestGlobalStruct]' = None @dataclass class NestedStructList(ClusterObject): @@ -50966,6 +50978,24 @@ def descriptor(cls) -> ClusterObjectDescriptor: arg1: 'uint' = 0 arg2: 'UnitTesting.Enums.SimpleEnum' = 0 + @dataclass + class GlobalEchoResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0xFFF1FC05 + command_id: typing.ClassVar[int] = 0x0000000E + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="field1", Tag=0, Type=Globals.Structs.TestGlobalStruct), + ClusterObjectFieldDescriptor(Label="field2", Tag=1, Type=Globals.Enums.TestGlobalEnum), + ]) + + field1: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: UnitTesting.Structs.TestGlobalStruct()) + field2: 'Globals.Enums.TestGlobalEnum' = 0 + @dataclass class TestNullableOptionalRequest(ClusterCommand): cluster_id: typing.ClassVar[int] = 0xFFF1FC05 @@ -51161,6 +51191,24 @@ def descriptor(cls) -> ClusterObjectDescriptor: payload: 'bytes' = b"" + @dataclass + class GlobalEchoRequest(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0xFFF1FC05 + command_id: typing.ClassVar[int] = 0x00000019 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = 'GlobalEchoResponse' + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="field1", Tag=0, Type=Globals.Structs.TestGlobalStruct), + ClusterObjectFieldDescriptor(Label="field2", Tag=1, Type=Globals.Enums.TestGlobalEnum), + ]) + + field1: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: UnitTesting.Structs.TestGlobalStruct()) + field2: 'Globals.Enums.TestGlobalEnum' = 0 + @dataclass class TestDifferentVendorMeiRequest(ClusterCommand): cluster_id: typing.ClassVar[int] = 0xFFF1FC05 @@ -51952,6 +52000,38 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'bool' = False + @dataclass + class GlobalEnum(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC05 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000033 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=Globals.Enums.TestGlobalEnum) + + value: 'Globals.Enums.TestGlobalEnum' = 0 + + @dataclass + class GlobalStruct(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC05 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000034 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=Globals.Structs.TestGlobalStruct) + + value: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: UnitTesting.Structs.TestGlobalStruct()) + @dataclass class Unsupported(ClusterAttributeDescriptor): @ChipUtility.classproperty @@ -52512,6 +52592,38 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[uint]' = None + @dataclass + class NullableGlobalEnum(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC05 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00004033 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, Globals.Enums.TestGlobalEnum]) + + value: 'typing.Union[Nullable, Globals.Enums.TestGlobalEnum]' = NullValue + + @dataclass + class NullableGlobalStruct(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0xFFF1FC05 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00004034 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, Globals.Structs.TestGlobalStruct]) + + value: 'typing.Union[Nullable, Globals.Structs.TestGlobalStruct]' = NullValue + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index aed4d52a4c4b3c..ee6351b3c6793e 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9695,29 +9695,38 @@ - WaterHeaterMode - WiFiNetworkManagement attributes: - OccupancySensing: - # Targeting 1.4 - - HoldTime - - HoldTimeLimits GeneralCommissioning: # Targeting 1.4 - TCAcceptedVersion - TCMinRequiredVersion - TCAcknowledgements - TCAcknowledgementsRequired + OccupancySensing: + # Targeting 1.4 + - HoldTime + - HoldTimeLimits + UnitTesting: + # Ideally none of UnitTesting would be exposed as public API, but + # for now just start doing that for new additions to it. + - GlobalEnum + - GlobalStruct + - NullableGlobalEnum + - NullableGlobalStruct commands: BridgedDeviceBasicInformation: # Targeting 1.4 - KeepActive + GeneralCommissioning: + # Targeting 1.4 + - SetTCAcknowledgements + - SetTCAcknowledgementsResponse UnitTesting: # Ideally none of UnitTesting would be exposed as public API, but # for now just start doing that for new additions to it. + - GlobalEchoRequest + - GlobalEchoResponse - StringEchoRequest - StringEchoResponse - GeneralCommissioning: - # Targeting 1.4 - - SetTCAcknowledgements - - SetTCAcknowledgementsResponse structs: Globals: # Test-only value @@ -9725,6 +9734,14 @@ OccupancySensing: # Targeting 1.4 - HoldTimeLimitsStruct + struct fields: + UnitTesting: + # Ideally none of UnitTesting would be exposed as public API, but + # for now just start doing that for new additions to it. + SimpleStruct: + - i + NestedStruct: + - d events: BridgedDeviceBasicInformation: # Targeting 1.4 @@ -9744,10 +9761,10 @@ BridgedDeviceBasicInformation: # Targeting 1.4 - Feature - OccupancySensing: + GeneralCommissioning: # Targeting 1.4 - Feature - GeneralCommissioning: + OccupancySensing: # Targeting 1.4 - Feature bitmap values: diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 2352e4f70941fe..aa1690bfdc3134 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -6675,6 +6675,12 @@ static BOOL AttributeIsSpecifiedInUnitTestingCluster(AttributeId aAttributeId) case Attributes::ClusterErrorBoolean::Id: { return YES; } + case Attributes::GlobalEnum::Id: { + return YES; + } + case Attributes::GlobalStruct::Id: { + return YES; + } case Attributes::Unsupported::Id: { return YES; } @@ -6780,6 +6786,12 @@ static BOOL AttributeIsSpecifiedInUnitTestingCluster(AttributeId aAttributeId) case Attributes::WriteOnlyInt8u::Id: { return YES; } + case Attributes::NullableGlobalEnum::Id: { + return YES; + } + case Attributes::NullableGlobalStruct::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 0187c598f9ffab..59f4109452438c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -19318,6 +19318,11 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri newElement_0.nullableStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().f.Raw()]; newElement_0.nullableStruct.g = [NSNumber numberWithFloat:entry_0.nullableStruct.Value().g]; newElement_0.nullableStruct.h = [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; + if (entry_0.nullableStruct.Value().i.HasValue()) { + newElement_0.nullableStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().i.Value())]; + } else { + newElement_0.nullableStruct.i = nil; + } } if (entry_0.optionalStruct.HasValue()) { newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; @@ -19334,6 +19339,11 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri newElement_0.optionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().f.Raw()]; newElement_0.optionalStruct.g = [NSNumber numberWithFloat:entry_0.optionalStruct.Value().g]; newElement_0.optionalStruct.h = [NSNumber numberWithDouble:entry_0.optionalStruct.Value().h]; + if (entry_0.optionalStruct.Value().i.HasValue()) { + newElement_0.optionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().i.Value())]; + } else { + newElement_0.optionalStruct.i = nil; + } } else { newElement_0.optionalStruct = nil; } @@ -19355,6 +19365,11 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri newElement_0.nullableOptionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().f.Raw()]; newElement_0.nullableOptionalStruct.g = [NSNumber numberWithFloat:entry_0.nullableOptionalStruct.Value().Value().g]; newElement_0.nullableOptionalStruct.h = [NSNumber numberWithDouble:entry_0.nullableOptionalStruct.Value().Value().h]; + if (entry_0.nullableOptionalStruct.Value().Value().i.HasValue()) { + newElement_0.nullableOptionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().i.Value())]; + } else { + newElement_0.nullableOptionalStruct.i = nil; + } } } else { newElement_0.nullableOptionalStruct = nil; @@ -19467,6 +19482,11 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri value.f = [NSNumber numberWithUnsignedChar:cppValue.f.Raw()]; value.g = [NSNumber numberWithFloat:cppValue.g]; value.h = [NSNumber numberWithDouble:cppValue.h]; + if (cppValue.i.HasValue()) { + value.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.i.Value())]; + } else { + value.i = nil; + } return value; } case Attributes::RangeRestrictedInt8u::Id: { @@ -19594,6 +19614,11 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri newElement_0.fabricSensitiveStruct.f = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.f.Raw()]; newElement_0.fabricSensitiveStruct.g = [NSNumber numberWithFloat:entry_0.fabricSensitiveStruct.g]; newElement_0.fabricSensitiveStruct.h = [NSNumber numberWithDouble:entry_0.fabricSensitiveStruct.h]; + if (entry_0.fabricSensitiveStruct.i.HasValue()) { + newElement_0.fabricSensitiveStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.i.Value())]; + } else { + newElement_0.fabricSensitiveStruct.i = nil; + } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; auto iter_2 = entry_0.fabricSensitiveInt8uList.begin(); @@ -19655,6 +19680,48 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri value = [NSNumber numberWithBool:cppValue]; return value; } + case Attributes::GlobalEnum::Id: { + using TypeInfo = Attributes::GlobalEnum::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::GlobalStruct::Id: { + using TypeInfo = Attributes::GlobalStruct::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRDataTypeTestGlobalStruct * _Nonnull value; + value = [MTRDataTypeTestGlobalStruct new]; + value.name = AsString(cppValue.name); + if (value.name == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (cppValue.myBitmap.IsNull()) { + value.myBitmap = nil; + } else { + value.myBitmap = [NSNumber numberWithUnsignedInt:cppValue.myBitmap.Value().Raw()]; + } + if (cppValue.myEnum.HasValue()) { + if (cppValue.myEnum.Value().IsNull()) { + value.myEnum = nil; + } else { + value.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.myEnum.Value().Value())]; + } + } else { + value.myEnum = nil; + } + return value; + } case Attributes::Unsupported::Id: { using TypeInfo = Attributes::Unsupported::TypeInfo; TypeInfo::DecodableType cppValue; @@ -20116,6 +20183,11 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri value.f = [NSNumber numberWithUnsignedChar:cppValue.Value().f.Raw()]; value.g = [NSNumber numberWithFloat:cppValue.Value().g]; value.h = [NSNumber numberWithDouble:cppValue.Value().h]; + if (cppValue.Value().i.HasValue()) { + value.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().i.Value())]; + } else { + value.i = nil; + } } return value; } @@ -20190,6 +20262,56 @@ static id _Nullable DecodeAttributeValueForUnitTestingCluster(AttributeId aAttri value = [NSNumber numberWithUnsignedChar:cppValue]; return value; } + case Attributes::NullableGlobalEnum::Id: { + using TypeInfo = Attributes::NullableGlobalEnum::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::NullableGlobalStruct::Id: { + using TypeInfo = Attributes::NullableGlobalStruct::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRDataTypeTestGlobalStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRDataTypeTestGlobalStruct new]; + value.name = AsString(cppValue.Value().name); + if (value.name == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } + if (cppValue.Value().myBitmap.IsNull()) { + value.myBitmap = nil; + } else { + value.myBitmap = [NSNumber numberWithUnsignedInt:cppValue.Value().myBitmap.Value().Raw()]; + } + if (cppValue.Value().myEnum.HasValue()) { + if (cppValue.Value().myEnum.Value().IsNull()) { + value.myEnum = nil; + } else { + value.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().myEnum.Value().Value())]; + } + } else { + value.myEnum = nil; + } + } + return value; + } case Attributes::MeiInt8u::Id: { using TypeInfo = Attributes::MeiInt8u::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 e5e21cc992188f..bc10c0e7020cac 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -16317,6 +16317,13 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) supports large payloads. */ - (void)stringEchoRequestWithParams:(MTRUnitTestingClusterStringEchoRequestParams *)params completion:(void (^)(MTRUnitTestingClusterStringEchoResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +/** + * Command GlobalEchoRequest + * + * Command that takes arguments that are global structs/enums and the + response just echoes them back. + */ +- (void)globalEchoRequestWithParams:(MTRUnitTestingClusterGlobalEchoRequestParams *)params completion:(void (^)(MTRUnitTestingClusterGlobalEchoResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; /** * Command TestDifferentVendorMeiRequest * @@ -16700,6 +16707,22 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeClusterErrorBooleanWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)readAttributeGlobalEnumWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalEnumWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalEnumWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGlobalEnumWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGlobalEnumWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeGlobalStructWithCompletion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGlobalStructWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGlobalStructWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeUnsupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeUnsupportedWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeUnsupportedWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -16980,6 +17003,22 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeWriteOnlyInt8uWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)readAttributeNullableGlobalEnumWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalEnumWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalEnumWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNullableGlobalEnumWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNullableGlobalEnumWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNullableGlobalStructWithCompletion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nullable)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNullableGlobalStructWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNullableGlobalStructWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)subscribeAttributeGeneratedCommandListWithParams:(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 c7a41dfa237381..0d6b87b30a50a2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -116414,6 +116414,30 @@ - (void)stringEchoRequestWithParams:(MTRUnitTestingClusterStringEchoRequestParam queue:self.callbackQueue completion:responseHandler]; } +- (void)globalEchoRequestWithParams:(MTRUnitTestingClusterGlobalEchoRequestParams *)params completion:(void (^)(MTRUnitTestingClusterGlobalEchoResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRUnitTestingClusterGlobalEchoRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = UnitTesting::Commands::GlobalEchoRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterGlobalEchoResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} - (void)testDifferentVendorMeiRequestWithParams:(MTRUnitTestingClusterTestDifferentVendorMeiRequestParams *)params completion:(void (^)(MTRUnitTestingClusterTestDifferentVendorMeiResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { @@ -118840,6 +118864,10 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu nonNullValue_2.f = static_cast>(element_0.nullableStruct.f.unsignedCharValue); nonNullValue_2.g = element_0.nullableStruct.g.floatValue; nonNullValue_2.h = element_0.nullableStruct.h.doubleValue; + if (element_0.nullableStruct.i != nil) { + auto & definedValue_4 = nonNullValue_2.i.Emplace(); + definedValue_4 = static_cast>(element_0.nullableStruct.i.unsignedCharValue); + } } if (element_0.optionalStruct != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].optionalStruct.Emplace(); @@ -118851,6 +118879,10 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu definedValue_2.f = static_cast>(element_0.optionalStruct.f.unsignedCharValue); definedValue_2.g = element_0.optionalStruct.g.floatValue; definedValue_2.h = element_0.optionalStruct.h.doubleValue; + if (element_0.optionalStruct.i != nil) { + auto & definedValue_4 = definedValue_2.i.Emplace(); + definedValue_4 = static_cast>(element_0.optionalStruct.i.unsignedCharValue); + } } if (element_0.nullableOptionalStruct != nil) { auto & definedValue_2 = listHolder_0->mList[i_0].nullableOptionalStruct.Emplace(); @@ -118866,6 +118898,10 @@ - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSArray * _Nonnu nonNullValue_3.f = static_cast>(element_0.nullableOptionalStruct.f.unsignedCharValue); nonNullValue_3.g = element_0.nullableOptionalStruct.g.floatValue; nonNullValue_3.h = element_0.nullableOptionalStruct.h.doubleValue; + if (element_0.nullableOptionalStruct.i != nil) { + auto & definedValue_5 = nonNullValue_3.i.Emplace(); + definedValue_5 = static_cast>(element_0.nullableOptionalStruct.i.unsignedCharValue); + } } } if (element_0.nullableList == nil) { @@ -119091,6 +119127,10 @@ - (void)writeAttributeStructAttrWithValue:(MTRUnitTestingClusterSimpleStruct * _ cppValue.f = static_cast>(value.f.unsignedCharValue); cppValue.g = value.g.floatValue; cppValue.h = value.h.doubleValue; + if (value.i != nil) { + auto & definedValue_1 = cppValue.i.Emplace(); + definedValue_1 = static_cast>(value.i.unsignedCharValue); + } chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); @@ -119539,6 +119579,10 @@ - (void)writeAttributeListFabricScopedWithValue:(NSArray * _Nonnull)value params listHolder_0->mList[i_0].fabricSensitiveStruct.f = static_castmList[i_0].fabricSensitiveStruct.f)>>(element_0.fabricSensitiveStruct.f.unsignedCharValue); listHolder_0->mList[i_0].fabricSensitiveStruct.g = element_0.fabricSensitiveStruct.g.floatValue; listHolder_0->mList[i_0].fabricSensitiveStruct.h = element_0.fabricSensitiveStruct.h.doubleValue; + if (element_0.fabricSensitiveStruct.i != nil) { + auto & definedValue_3 = listHolder_0->mList[i_0].fabricSensitiveStruct.i.Emplace(); + definedValue_3 = static_cast>(element_0.fabricSensitiveStruct.i.unsignedCharValue); + } { using ListType_2 = std::remove_reference_tmList[i_0].fabricSensitiveInt8uList)>; using ListMemberType_2 = ListMemberTypeGetter::Type; @@ -119794,6 +119838,149 @@ + (void)readAttributeClusterErrorBooleanWithClusterStateCache:(MTRClusterStateCa completion:completion]; } +- (void)readAttributeGlobalEnumWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::GlobalEnum::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeGlobalEnumWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeGlobalEnumWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeGlobalEnumWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = UnitTesting::Attributes::GlobalEnum::TypeInfo; + TypeInfo::Type cppValue; + cppValue = static_cast>(value.unsignedCharValue); + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeGlobalEnumWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = UnitTesting::Attributes::GlobalEnum::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGlobalEnumWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::GlobalEnum::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeGlobalStructWithCompletion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::GlobalStruct::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = UnitTesting::Attributes::GlobalStruct::TypeInfo; + TypeInfo::Type cppValue; + cppValue.name = AsCharSpan(value.name); + if (value.myBitmap == nil) { + cppValue.myBitmap.SetNull(); + } else { + auto & nonNullValue_1 = cppValue.myBitmap.SetNonNull(); + nonNullValue_1 = static_cast>(value.myBitmap.unsignedIntValue); + } + if (value.myEnum != nil) { + auto & definedValue_1 = cppValue.myEnum.Emplace(); + if (value.myEnum == nil) { + definedValue_1.SetNull(); + } else { + auto & nonNullValue_2 = definedValue_1.SetNonNull(); + nonNullValue_2 = static_cast>(value.myEnum.unsignedCharValue); + } + } + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeGlobalStructWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = UnitTesting::Attributes::GlobalStruct::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGlobalStructWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::GlobalStruct::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + - (void)readAttributeUnsupportedWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = UnitTesting::Attributes::Unsupported::TypeInfo; @@ -121834,6 +122021,10 @@ - (void)writeAttributeNullableStructWithValue:(MTRUnitTestingClusterSimpleStruct nonNullValue_0.f = static_cast>(value.f.unsignedCharValue); nonNullValue_0.g = value.g.floatValue; nonNullValue_0.h = value.h.doubleValue; + if (value.i != nil) { + auto & definedValue_2 = nonNullValue_0.i.Emplace(); + definedValue_2 = static_cast>(value.i.unsignedCharValue); + } } chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); @@ -122206,6 +122397,159 @@ + (void)readAttributeWriteOnlyInt8uWithClusterStateCache:(MTRClusterStateCacheCo completion:completion]; } +- (void)readAttributeNullableGlobalEnumWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::NullableGlobalEnum::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeNullableGlobalEnumWithValue:(NSNumber * _Nullable)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeNullableGlobalEnumWithValue:(NSNumber * _Nullable) value params:nil completion:completion]; +} +- (void)writeAttributeNullableGlobalEnumWithValue:(NSNumber * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = UnitTesting::Attributes::NullableGlobalEnum::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>(value.unsignedCharValue); + } + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeNullableGlobalEnumWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = UnitTesting::Attributes::NullableGlobalEnum::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNullableGlobalEnumWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::NullableGlobalEnum::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNullableGlobalStructWithCompletion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::NullableGlobalStruct::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeNullableGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nullable)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeNullableGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nullable) value params:nil completion:completion]; +} +- (void)writeAttributeNullableGlobalStructWithValue:(MTRDataTypeTestGlobalStruct * _Nullable)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = UnitTesting::Attributes::NullableGlobalStruct::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0.name = AsCharSpan(value.name); + if (value.myBitmap == nil) { + nonNullValue_0.myBitmap.SetNull(); + } else { + auto & nonNullValue_2 = nonNullValue_0.myBitmap.SetNonNull(); + nonNullValue_2 = static_cast>(value.myBitmap.unsignedIntValue); + } + if (value.myEnum != nil) { + auto & definedValue_2 = nonNullValue_0.myEnum.Emplace(); + if (value.myEnum == nil) { + definedValue_2.SetNull(); + } else { + auto & nonNullValue_3 = definedValue_2.SetNonNull(); + nonNullValue_3 = static_cast>(value.myEnum.unsignedCharValue); + } + } + } + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeNullableGlobalStructWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = UnitTesting::Attributes::NullableGlobalStruct::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNullableGlobalStructWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = UnitTesting::Attributes::NullableGlobalStruct::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = UnitTesting::Attributes::GeneratedCommandList::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index e2b7de84eda696..55033aaeb22d37 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -5763,6 +5763,8 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterUnitTestingAttributeTimedWriteBooleanID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000030, MTRAttributeIDTypeClusterUnitTestingAttributeGeneralErrorBooleanID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000031, MTRAttributeIDTypeClusterUnitTestingAttributeClusterErrorBooleanID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000032, + MTRAttributeIDTypeClusterUnitTestingAttributeGlobalEnumID MTR_PROVISIONALLY_AVAILABLE = 0x00000033, + MTRAttributeIDTypeClusterUnitTestingAttributeGlobalStructID MTR_PROVISIONALLY_AVAILABLE = 0x00000034, MTRAttributeIDTypeClusterUnitTestingAttributeUnsupportedID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x000000FF, MTRAttributeIDTypeClusterUnitTestingAttributeNullableBooleanID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00004000, MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap8ID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00004001, @@ -5798,6 +5800,8 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt16uID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00004028, MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt16sID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00004029, MTRAttributeIDTypeClusterUnitTestingAttributeWriteOnlyInt8uID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000402A, + MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalEnumID MTR_PROVISIONALLY_AVAILABLE = 0x00004033, + MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalStructID MTR_PROVISIONALLY_AVAILABLE = 0x00004034, MTRAttributeIDTypeClusterUnitTestingAttributeGeneratedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterUnitTestingAttributeAcceptedCommandListID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterUnitTestingAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -7100,6 +7104,7 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterUnitTestingCommandTestListInt8UReverseRequestID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000000D, MTRCommandIDTypeClusterUnitTestingCommandStringEchoResponseID MTR_PROVISIONALLY_AVAILABLE = 0x0000000D, MTRCommandIDTypeClusterUnitTestingCommandTestEnumsRequestID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000000E, + MTRCommandIDTypeClusterUnitTestingCommandGlobalEchoResponseID MTR_PROVISIONALLY_AVAILABLE = 0x0000000E, MTRCommandIDTypeClusterUnitTestingCommandTestNullableOptionalRequestID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x0000000F, MTRCommandIDTypeClusterUnitTestingCommandTestComplexNullableOptionalRequestID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000010, MTRCommandIDTypeClusterUnitTestingCommandSimpleStructEchoRequestID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000011, @@ -7110,6 +7115,7 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { MTRCommandIDTypeClusterUnitTestingCommandTestBatchHelperRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000016, MTRCommandIDTypeClusterUnitTestingCommandTestSecondBatchHelperRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000017, MTRCommandIDTypeClusterUnitTestingCommandStringEchoRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000018, + MTRCommandIDTypeClusterUnitTestingCommandGlobalEchoRequestID MTR_PROVISIONALLY_AVAILABLE = 0x00000019, MTRCommandIDTypeClusterUnitTestingCommandTestDifferentVendorMeiRequestID MTR_PROVISIONALLY_AVAILABLE = 0xFFF200AA, MTRCommandIDTypeClusterUnitTestingCommandTestDifferentVendorMeiResponseID MTR_PROVISIONALLY_AVAILABLE = 0xFFF200BB, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index 81911e1c559358..a08bb8c4ba55e9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -9159,6 +9159,14 @@ result = @"ClusterErrorBoolean"; break; + case MTRAttributeIDTypeClusterUnitTestingAttributeGlobalEnumID: + result = @"GlobalEnum"; + break; + + case MTRAttributeIDTypeClusterUnitTestingAttributeGlobalStructID: + result = @"GlobalStruct"; + break; + case MTRAttributeIDTypeClusterUnitTestingAttributeUnsupportedID: result = @"Unsupported"; break; @@ -9299,6 +9307,14 @@ result = @"WriteOnlyInt8u"; break; + case MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalEnumID: + result = @"NullableGlobalEnum"; + break; + + case MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalStructID: + result = @"NullableGlobalStruct"; + break; + case MTRAttributeIDTypeClusterUnitTestingAttributeGeneratedCommandListID: result = @"GeneratedCommandList"; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index bf694242a5885f..de78ab978068bd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -7447,6 +7447,7 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - (void)testBatchHelperRequestWithParams:(MTRUnitTestingClusterTestBatchHelperRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestBatchHelperResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)testSecondBatchHelperRequestWithParams:(MTRUnitTestingClusterTestSecondBatchHelperRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestBatchHelperResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)stringEchoRequestWithParams:(MTRUnitTestingClusterStringEchoRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterStringEchoResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)globalEchoRequestWithParams:(MTRUnitTestingClusterGlobalEchoRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterGlobalEchoResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (void)testDifferentVendorMeiRequestWithParams:(MTRUnitTestingClusterTestDifferentVendorMeiRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestDifferentVendorMeiResponseParams * _Nullable data, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeBooleanWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -7637,6 +7638,14 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - (void)writeAttributeClusterErrorBooleanWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeClusterErrorBooleanWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (NSDictionary * _Nullable)readAttributeGlobalEnumWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGlobalStructWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeUnsupportedWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeUnsupportedWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeUnsupportedWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -7777,6 +7786,14 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - (void)writeAttributeWriteOnlyInt8uWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributeWriteOnlyInt8uWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (NSDictionary * _Nullable)readAttributeNullableGlobalEnumWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNullableGlobalStructWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeNullableGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index a3a608cb8a6cb4..a118d1f89fd0bb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -21690,6 +21690,33 @@ - (void)stringEchoRequestWithParams:(MTRUnitTestingClusterStringEchoRequestParam completion:responseHandler]; } +- (void)globalEchoRequestWithParams:(MTRUnitTestingClusterGlobalEchoRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterGlobalEchoResponseParams * _Nullable data, NSError * _Nullable error))completion +{ + if (params == nil) { + params = [[MTRUnitTestingClusterGlobalEchoRequestParams + alloc] init]; + } + + auto responseHandler = ^(id _Nullable response, NSError * _Nullable error) { + completion(response, error); + }; + + auto * timedInvokeTimeoutMs = params.timedInvokeTimeoutMs; + + using RequestType = UnitTesting::Commands::GlobalEchoRequest::Type; + [self.device _invokeKnownCommandWithEndpointID:self.endpointID + clusterID:@(RequestType::GetClusterId()) + commandID:@(RequestType::GetCommandId()) + commandPayload:params + expectedValues:expectedValues + expectedValueInterval:expectedValueIntervalMs + timedInvokeTimeout:timedInvokeTimeoutMs + serverSideProcessingTimeout:params.serverSideProcessingTimeout + responseClass:MTRUnitTestingClusterGlobalEchoResponseParams.class + queue:self.callbackQueue + completion:responseHandler]; +} + - (void)testDifferentVendorMeiRequestWithParams:(MTRUnitTestingClusterTestDifferentVendorMeiRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(void (^)(MTRUnitTestingClusterTestDifferentVendorMeiResponseParams * _Nullable data, NSError * _Nullable error))completion { if (params == nil) { @@ -22472,6 +22499,38 @@ - (void)writeAttributeClusterErrorBooleanWithValue:(NSDictionary [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeClusterErrorBooleanID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } +- (NSDictionary * _Nullable)readAttributeGlobalEnumWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGlobalEnumID) params:params]; +} + +- (void)writeAttributeGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeGlobalEnumWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGlobalEnumID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeGlobalStructWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGlobalStructID) params:params]; +} + +- (void)writeAttributeGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeGlobalStructWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGlobalStructID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + - (NSDictionary * _Nullable)readAttributeUnsupportedWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeUnsupportedID) params:params]; @@ -23032,6 +23091,38 @@ - (void)writeAttributeWriteOnlyInt8uWithValue:(NSDictionary *)da [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeWriteOnlyInt8uID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } +- (NSDictionary * _Nullable)readAttributeNullableGlobalEnumWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalEnumID) params:params]; +} + +- (void)writeAttributeNullableGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeNullableGlobalEnumWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeNullableGlobalEnumWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalEnumID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeNullableGlobalStructWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalStructID) params:params]; +} + +- (void)writeAttributeNullableGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeNullableGlobalStructWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeNullableGlobalStructWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableGlobalStructID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeUnitTestingID) attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGeneratedCommandListID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index f98b19053ff0d4..1940d25ab95cae 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -12896,6 +12896,27 @@ MTR_DEPRECATED("Please use MTRUnitTestingClusterTestEnumsRequestParams", ios(16. @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRUnitTestingClusterGlobalEchoResponseParams : NSObject + +@property (nonatomic, copy) MTRDataTypeTestGlobalStruct * _Nonnull field1 MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull field2 MTR_PROVISIONALLY_AVAILABLE; + +/** + * Initialize an MTRUnitTestingClusterGlobalEchoResponseParams with a response-value dictionary + * of the sort that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * a command data response or is not the right command response. + * + * Will return nil and hand out an error if the data response does not match the known + * schema for this command. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRUnitTestingClusterTestNullableOptionalRequestParams : NSObject @@ -13462,6 +13483,38 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRUnitTestingClusterGlobalEchoRequestParams : NSObject + +@property (nonatomic, copy) MTRDataTypeTestGlobalStruct * _Nonnull field1 MTR_PROVISIONALLY_AVAILABLE; + +@property (nonatomic, copy) NSNumber * _Nonnull field2 MTR_PROVISIONALLY_AVAILABLE; +/** + * Controls whether the command is a timed command (using Timed Invoke). + * + * If nil (the default value), a regular invoke is done for commands that do + * not require a timed invoke and a timed invoke with some default timed request + * timeout is done for commands that require a timed invoke. + * + * If not nil, a timed invoke is done, with the provided value used as the timed + * request timeout. The value should be chosen small enough to provide the + * desired security properties but large enough that it will allow a round-trip + * from the sever to the client (for the status response and actual invoke + * request) within the timeout window. + * + */ +@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs; + +/** + * Controls how much time, in seconds, we will allow for the server to process the command. + * + * The command will then time out if that much time, plus an allowance for retransmits due to network failures, passes. + * + * If nil, the framework will try to select an appropriate timeout value itself. + */ +@property (nonatomic, copy, nullable) NSNumber * serverSideProcessingTimeout; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRUnitTestingClusterTestDifferentVendorMeiRequestParams : NSObject diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 8f69e294bbfd1d..2db799f5509ca7 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -32885,6 +32885,11 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; + if (entry_0.c.i.HasValue()) { + newElement_0.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.i.Value())]; + } else { + newElement_0.c.i = nil; + } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; auto iter_2 = entry_0.d.begin(); @@ -32904,6 +32909,11 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; + if (entry_2.i.HasValue()) { + newElement_2.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.i.Value())]; + } else { + newElement_2.i = nil; + } [array_2 addObject:newElement_2]; } CHIP_ERROR err = iter_2.GetStatus(); @@ -32986,6 +32996,11 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + if (entry_0.i.HasValue()) { + newElement_0.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.i.Value())]; + } else { + newElement_0.i = nil; + } [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); @@ -33498,6 +33513,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader listHolder_0->mList[i_0].c.f = static_castmList[i_0].c.f)>>(element_0.c.f.unsignedCharValue); listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; + if (element_0.c.i != nil) { + auto & definedValue_3 = listHolder_0->mList[i_0].c.i.Emplace(); + definedValue_3 = static_cast>(element_0.c.i.unsignedCharValue); + } { using ListType_2 = std::remove_reference_tmList[i_0].d)>; using ListMemberType_2 = ListMemberTypeGetter::Type; @@ -33521,6 +33540,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader listHolder_2->mList[i_2].f = static_castmList[i_2].f)>>(element_2.f.unsignedCharValue); listHolder_2->mList[i_2].g = element_2.g.floatValue; listHolder_2->mList[i_2].h = element_2.h.doubleValue; + if (element_2.i != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].i.Emplace(); + definedValue_4 = static_cast>(element_2.i.unsignedCharValue); + } } listHolder_0->mList[i_0].d = ListType_2(listHolder_2->mList, element_0.d.count); } else { @@ -33624,6 +33647,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader listHolder_0->mList[i_0].f = static_castmList[i_0].f)>>(element_0.f.unsignedCharValue); listHolder_0->mList[i_0].g = element_0.g.floatValue; listHolder_0->mList[i_0].h = element_0.h.doubleValue; + if (element_0.i != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].i.Emplace(); + definedValue_2 = static_cast>(element_0.i.unsignedCharValue); + } } encodableStruct.arg2 = ListType_0(listHolder_0->mList, self.arg2.count); } else { @@ -33904,6 +33931,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.arg1.f = static_cast>(self.arg1.f.unsignedCharValue); encodableStruct.arg1.g = self.arg1.g.floatValue; encodableStruct.arg1.h = self.arg1.h.doubleValue; + if (self.arg1.i != nil) { + auto & definedValue_1 = encodableStruct.arg1.i.Emplace(); + definedValue_1 = static_cast>(self.arg1.i.unsignedCharValue); + } } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -34208,6 +34239,11 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest self.nullableStructValue.f = [NSNumber numberWithUnsignedChar:decodableStruct.nullableStructValue.Value().f.Raw()]; self.nullableStructValue.g = [NSNumber numberWithFloat:decodableStruct.nullableStructValue.Value().g]; self.nullableStructValue.h = [NSNumber numberWithDouble:decodableStruct.nullableStructValue.Value().h]; + if (decodableStruct.nullableStructValue.Value().i.HasValue()) { + self.nullableStructValue.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.nullableStructValue.Value().i.Value())]; + } else { + self.nullableStructValue.i = nil; + } } else { self.nullableStructValue = nil; } @@ -34230,6 +34266,11 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest self.optionalStructValue.f = [NSNumber numberWithUnsignedChar:decodableStruct.optionalStructValue.Value().f.Raw()]; self.optionalStructValue.g = [NSNumber numberWithFloat:decodableStruct.optionalStructValue.Value().g]; self.optionalStructValue.h = [NSNumber numberWithDouble:decodableStruct.optionalStructValue.Value().h]; + if (decodableStruct.optionalStructValue.Value().i.HasValue()) { + self.optionalStructValue.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.optionalStructValue.Value().i.Value())]; + } else { + self.optionalStructValue.i = nil; + } } else { self.optionalStructValue = nil; } @@ -34259,6 +34300,11 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest self.nullableOptionalStructValue.f = [NSNumber numberWithUnsignedChar:decodableStruct.nullableOptionalStructValue.Value().f.Raw()]; self.nullableOptionalStructValue.g = [NSNumber numberWithFloat:decodableStruct.nullableOptionalStructValue.Value().g]; self.nullableOptionalStructValue.h = [NSNumber numberWithDouble:decodableStruct.nullableOptionalStructValue.Value().h]; + if (decodableStruct.nullableOptionalStructValue.Value().i.HasValue()) { + self.nullableOptionalStructValue.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.nullableOptionalStructValue.Value().i.Value())]; + } else { + self.nullableOptionalStructValue.i = nil; + } } else { self.nullableOptionalStructValue = nil; } @@ -34427,6 +34473,29 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.arg1.c.f = static_cast>(self.arg1.c.f.unsignedCharValue); encodableStruct.arg1.c.g = self.arg1.c.g.floatValue; encodableStruct.arg1.c.h = self.arg1.c.h.doubleValue; + if (self.arg1.c.i != nil) { + auto & definedValue_2 = encodableStruct.arg1.c.i.Emplace(); + definedValue_2 = static_cast>(self.arg1.c.i.unsignedCharValue); + } + if (self.arg1.d != nil) { + auto & definedValue_1 = encodableStruct.arg1.d.Emplace(); + definedValue_1.name = AsCharSpan(self.arg1.d.name); + if (self.arg1.d.myBitmap == nil) { + definedValue_1.myBitmap.SetNull(); + } else { + auto & nonNullValue_3 = definedValue_1.myBitmap.SetNonNull(); + nonNullValue_3 = static_cast>(self.arg1.d.myBitmap.unsignedIntValue); + } + if (self.arg1.d.myEnum != nil) { + auto & definedValue_3 = definedValue_1.myEnum.Emplace(); + if (self.arg1.d.myEnum == nil) { + definedValue_3.SetNull(); + } else { + auto & nonNullValue_4 = definedValue_3.SetNonNull(); + nonNullValue_4 = static_cast>(self.arg1.d.myEnum.unsignedCharValue); + } + } + } } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -34620,6 +34689,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader listHolder_0->mList[i_0].f = static_castmList[i_0].f)>>(element_0.f.unsignedCharValue); listHolder_0->mList[i_0].g = element_0.g.floatValue; listHolder_0->mList[i_0].h = element_0.h.doubleValue; + if (element_0.i != nil) { + auto & definedValue_2 = listHolder_0->mList[i_0].i.Emplace(); + definedValue_2 = static_cast>(element_0.i.unsignedCharValue); + } } encodableStruct.arg1 = ListType_0(listHolder_0->mList, self.arg1.count); } else { @@ -34759,6 +34832,11 @@ - (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTest self.arg1.f = [NSNumber numberWithUnsignedChar:decodableStruct.arg1.f.Raw()]; self.arg1.g = [NSNumber numberWithFloat:decodableStruct.arg1.g]; self.arg1.h = [NSNumber numberWithDouble:decodableStruct.arg1.h]; + if (decodableStruct.arg1.i.HasValue()) { + self.arg1.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.arg1.i.Value())]; + } else { + self.arg1.i = nil; + } } return CHIP_NO_ERROR; } @@ -35010,6 +35088,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.arg1.c.f = static_cast>(self.arg1.c.f.unsignedCharValue); encodableStruct.arg1.c.g = self.arg1.c.g.floatValue; encodableStruct.arg1.c.h = self.arg1.c.h.doubleValue; + if (self.arg1.c.i != nil) { + auto & definedValue_2 = encodableStruct.arg1.c.i.Emplace(); + definedValue_2 = static_cast>(self.arg1.c.i.unsignedCharValue); + } { using ListType_1 = std::remove_reference_t; using ListMemberType_1 = ListMemberTypeGetter::Type; @@ -35033,6 +35115,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader listHolder_1->mList[i_1].f = static_castmList[i_1].f)>>(element_1.f.unsignedCharValue); listHolder_1->mList[i_1].g = element_1.g.floatValue; listHolder_1->mList[i_1].h = element_1.h.doubleValue; + if (element_1.i != nil) { + auto & definedValue_3 = listHolder_1->mList[i_1].i.Emplace(); + definedValue_3 = static_cast>(element_1.i.unsignedCharValue); + } } encodableStruct.arg1.d = ListType_1(listHolder_1->mList, self.arg1.d.count); } else { @@ -35300,6 +35386,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader listHolder_0->mList[i_0].c.f = static_castmList[i_0].c.f)>>(element_0.c.f.unsignedCharValue); listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; + if (element_0.c.i != nil) { + auto & definedValue_3 = listHolder_0->mList[i_0].c.i.Emplace(); + definedValue_3 = static_cast>(element_0.c.i.unsignedCharValue); + } { using ListType_2 = std::remove_reference_tmList[i_0].d)>; using ListMemberType_2 = ListMemberTypeGetter::Type; @@ -35323,6 +35413,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader listHolder_2->mList[i_2].f = static_castmList[i_2].f)>>(element_2.f.unsignedCharValue); listHolder_2->mList[i_2].g = element_2.g.floatValue; listHolder_2->mList[i_2].h = element_2.h.doubleValue; + if (element_2.i != nil) { + auto & definedValue_4 = listHolder_2->mList[i_2].i.Emplace(); + definedValue_4 = static_cast>(element_2.i.unsignedCharValue); + } } listHolder_0->mList[i_0].d = ListType_2(listHolder_2->mList, element_0.d.count); } else { @@ -35803,6 +35897,110 @@ @implementation MTRTestClusterClusterTestEnumsRequestParams @dynamic timedInvokeTimeoutMs; @dynamic serverSideProcessingTimeout; @end +@implementation MTRUnitTestingClusterGlobalEchoResponseParams +- (instancetype)init +{ + if (self = [super init]) { + + _field1 = [MTRDataTypeTestGlobalStruct new]; + + _field2 = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRUnitTestingClusterGlobalEchoResponseParams alloc] init]; + + other.field1 = self.field1; + other.field2 = self.field2; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: field1:%@; field2:%@; >", NSStringFromClass([self class]), _field1, _field2]; + return descriptionString; +} + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + using DecodableType = chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::DecodableType; + chip::System::PacketBufferHandle buffer = [MTRBaseDevice _responseDataForCommand:responseValue + clusterID:DecodableType::GetClusterId() + commandID:DecodableType::GetCommandId() + error:error]; + if (buffer.IsNull()) { + return nil; + } + + chip::TLV::TLVReader reader; + reader.Init(buffer->Start(), buffer->DataLength()); + + CHIP_ERROR err = reader.Next(chip::TLV::AnonymousTag()); + if (err == CHIP_NO_ERROR) { + DecodableType decodedStruct; + err = chip::app::DataModel::Decode(reader, decodedStruct); + if (err == CHIP_NO_ERROR) { + err = [self _setFieldsFromDecodableStruct:decodedStruct]; + if (err == CHIP_NO_ERROR) { + return self; + } + } + } + + NSString * errorStr = [NSString stringWithFormat:@"Command payload decoding failed: %s", err.AsString()]; + MTR_LOG_ERROR("%s", errorStr.UTF8String); + if (error != nil) { + NSDictionary * userInfo = @{ NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; + *error = [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeSchemaMismatch userInfo:userInfo]; + } + return nil; +} + +@end + +@implementation MTRUnitTestingClusterGlobalEchoResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::DecodableType &)decodableStruct +{ + { + self.field1 = [MTRDataTypeTestGlobalStruct new]; + self.field1.name = AsString(decodableStruct.field1.name); + if (self.field1.name == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + return err; + } + if (decodableStruct.field1.myBitmap.IsNull()) { + self.field1.myBitmap = nil; + } else { + self.field1.myBitmap = [NSNumber numberWithUnsignedInt:decodableStruct.field1.myBitmap.Value().Raw()]; + } + if (decodableStruct.field1.myEnum.HasValue()) { + if (decodableStruct.field1.myEnum.Value().IsNull()) { + self.field1.myEnum = nil; + } else { + self.field1.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.field1.myEnum.Value().Value())]; + } + } else { + self.field1.myEnum = nil; + } + } + { + self.field2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(decodableStruct.field2)]; + } + return CHIP_NO_ERROR; +} + +@end + @implementation MTRUnitTestingClusterTestNullableOptionalRequestParams - (instancetype)init { @@ -36029,6 +36227,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader nonNullValue_0.f = static_cast>(self.nullableStruct.f.unsignedCharValue); nonNullValue_0.g = self.nullableStruct.g.floatValue; nonNullValue_0.h = self.nullableStruct.h.doubleValue; + if (self.nullableStruct.i != nil) { + auto & definedValue_2 = nonNullValue_0.i.Emplace(); + definedValue_2 = static_cast>(self.nullableStruct.i.unsignedCharValue); + } } } { @@ -36042,6 +36244,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader definedValue_0.f = static_cast>(self.optionalStruct.f.unsignedCharValue); definedValue_0.g = self.optionalStruct.g.floatValue; definedValue_0.h = self.optionalStruct.h.doubleValue; + if (self.optionalStruct.i != nil) { + auto & definedValue_2 = definedValue_0.i.Emplace(); + definedValue_2 = static_cast>(self.optionalStruct.i.unsignedCharValue); + } } } { @@ -36059,6 +36265,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader nonNullValue_1.f = static_cast>(self.nullableOptionalStruct.f.unsignedCharValue); nonNullValue_1.g = self.nullableOptionalStruct.g.floatValue; nonNullValue_1.h = self.nullableOptionalStruct.h.doubleValue; + if (self.nullableOptionalStruct.i != nil) { + auto & definedValue_3 = nonNullValue_1.i.Emplace(); + definedValue_3 = static_cast>(self.nullableOptionalStruct.i.unsignedCharValue); + } } } } @@ -36252,6 +36462,10 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader encodableStruct.arg1.f = static_cast>(self.arg1.f.unsignedCharValue); encodableStruct.arg1.g = self.arg1.g.floatValue; encodableStruct.arg1.h = self.arg1.h.doubleValue; + if (self.arg1.i != nil) { + auto & definedValue_1 = encodableStruct.arg1.i.Emplace(); + definedValue_1 = static_cast>(self.arg1.i.unsignedCharValue); + } } auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); @@ -36909,6 +37123,106 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader } @end +@implementation MTRUnitTestingClusterGlobalEchoRequestParams +- (instancetype)init +{ + if (self = [super init]) { + + _field1 = [MTRDataTypeTestGlobalStruct new]; + + _field2 = @(0); + _timedInvokeTimeoutMs = nil; + _serverSideProcessingTimeout = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone; +{ + auto other = [[MTRUnitTestingClusterGlobalEchoRequestParams alloc] init]; + + other.field1 = self.field1; + other.field2 = self.field2; + other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; + other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: field1:%@; field2:%@; >", NSStringFromClass([self class]), _field1, _field2]; + return descriptionString; +} + +@end + +@implementation MTRUnitTestingClusterGlobalEchoRequestParams (InternalMethods) + +- (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader +{ + chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Type encodableStruct; + ListFreer listFreer; + { + encodableStruct.field1.name = AsCharSpan(self.field1.name); + if (self.field1.myBitmap == nil) { + encodableStruct.field1.myBitmap.SetNull(); + } else { + auto & nonNullValue_1 = encodableStruct.field1.myBitmap.SetNonNull(); + nonNullValue_1 = static_cast>(self.field1.myBitmap.unsignedIntValue); + } + if (self.field1.myEnum != nil) { + auto & definedValue_1 = encodableStruct.field1.myEnum.Emplace(); + if (self.field1.myEnum == nil) { + definedValue_1.SetNull(); + } else { + auto & nonNullValue_2 = definedValue_1.SetNonNull(); + nonNullValue_2 = static_cast>(self.field1.myEnum.unsignedCharValue); + } + } + } + { + encodableStruct.field2 = static_cast>(self.field2.unsignedCharValue); + } + + auto buffer = chip::System::PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + return CHIP_ERROR_NO_MEMORY; + } + + chip::System::PacketBufferTLVWriter writer; + // Commands never need chained buffers, since they cannot be chunked. + writer.Init(std::move(buffer), /* useChainedBuffers = */ false); + + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::AnonymousTag(), encodableStruct)); + + ReturnErrorOnFailure(writer.Finalize(&buffer)); + + reader.Init(std::move(buffer)); + return reader.Next(chip::TLV::kTLVType_Structure, chip::TLV::AnonymousTag()); +} + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error +{ + chip::System::PacketBufferTLVReader reader; + CHIP_ERROR err = [self _encodeToTLVReader:reader]; + if (err != CHIP_NO_ERROR) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:err]; + } + return nil; + } + + auto decodedObj = MTRDecodeDataValueDictionaryFromCHIPTLV(&reader); + if (decodedObj == nil) { + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; + } + } + return decodedObj; +} +@end + @implementation MTRUnitTestingClusterTestDifferentVendorMeiRequestParams - (instancetype)init { diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h index b0b7832c5f2ad7..0647b697468314 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloads_Internal.h @@ -2260,6 +2260,12 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRUnitTestingClusterGlobalEchoResponseParams (InternalMethods) + +- (CHIP_ERROR)_setFieldsFromDecodableStruct:(const chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::DecodableType &)decodableStruct; + +@end + @interface MTRUnitTestingClusterTestNullableOptionalRequestParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; @@ -2320,6 +2326,12 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface MTRUnitTestingClusterGlobalEchoRequestParams (InternalMethods) + +- (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; + +@end + @interface MTRUnitTestingClusterTestDifferentVendorMeiRequestParams (InternalMethods) - (NSDictionary * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 4d70a00ee32937..821b8f6d58173d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -4637,6 +4637,11 @@ static id _Nullable DecodeEventPayloadForUnitTestingCluster(EventId aEventId, TL memberValue.f = [NSNumber numberWithUnsignedChar:cppValue.arg4.f.Raw()]; memberValue.g = [NSNumber numberWithFloat:cppValue.arg4.g]; memberValue.h = [NSNumber numberWithDouble:cppValue.arg4.h]; + if (cppValue.arg4.i.HasValue()) { + memberValue.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg4.i.Value())]; + } else { + memberValue.i = nil; + } value.arg4 = memberValue; } while (0); do { @@ -4661,6 +4666,11 @@ static id _Nullable DecodeEventPayloadForUnitTestingCluster(EventId aEventId, TL newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + if (entry_0.i.HasValue()) { + newElement_0.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.i.Value())]; + } else { + newElement_0.i = nil; + } [array_0 addObject:newElement_0]; } CHIP_ERROR err = iter_0.GetStatus(); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 1257f47c907da7..6e4fab70efda3d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -2145,6 +2145,7 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @property (nonatomic, copy) NSNumber * _Nonnull f MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @property (nonatomic, copy) NSNumber * _Nonnull g MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @property (nonatomic, copy) NSNumber * _Nonnull h MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +@property (nonatomic, copy) NSNumber * _Nullable i MTR_PROVISIONALLY_AVAILABLE; @end MTR_DEPRECATED("Please use MTRUnitTestingClusterSimpleStruct", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) @@ -2220,6 +2221,7 @@ MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @property (nonatomic, copy) NSNumber * _Nonnull a MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @property (nonatomic, copy) NSNumber * _Nonnull b MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @property (nonatomic, copy) MTRUnitTestingClusterSimpleStruct * _Nonnull c MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +@property (nonatomic, copy) MTRDataTypeTestGlobalStruct * _Nullable d MTR_PROVISIONALLY_AVAILABLE; @end MTR_DEPRECATED("Please use MTRUnitTestingClusterNestedStruct", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 7f5599e75b9843..052efc72f6d57e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -8855,6 +8855,8 @@ - (instancetype)init _g = @(0); _h = @(0); + + _i = nil; } return self; } @@ -8871,13 +8873,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.f = self.f; other.g = self.g; other.h = self.h; + other.i = self.i; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: a:%@; b:%@; c:%@; d:%@; e:%@; f:%@; g:%@; h:%@; >", NSStringFromClass([self class]), _a, _b, _c, [_d base64EncodedStringWithOptions:0], _e, _f, _g, _h]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: a:%@; b:%@; c:%@; d:%@; e:%@; f:%@; g:%@; h:%@; i:%@; >", NSStringFromClass([self class]), _a, _b, _c, [_d base64EncodedStringWithOptions:0], _e, _f, _g, _h, _i]; return descriptionString; } @@ -9038,6 +9041,8 @@ - (instancetype)init _b = @(0); _c = [MTRUnitTestingClusterSimpleStruct new]; + + _d = nil; } return self; } @@ -9049,13 +9054,14 @@ - (id)copyWithZone:(NSZone * _Nullable)zone other.a = self.a; other.b = self.b; other.c = self.c; + other.d = self.d; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: a:%@; b:%@; c:%@; >", NSStringFromClass([self class]), _a, _b, _c]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: a:%@; b:%@; c:%@; d:%@; >", NSStringFromClass([self class]), _a, _b, _c, _d]; return descriptionString; } 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 f1bcd8c528be3f..0ef745cfafd7c8 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 @@ -46039,6 +46039,53 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value) } // namespace TimedWriteBoolean +namespace GlobalEnum { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::UnitTesting::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::UnitTesting::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::UnitTesting::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +} // namespace GlobalEnum + namespace Unsupported { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value) @@ -48977,6 +49024,98 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value } // namespace WriteOnlyInt8u +namespace NullableGlobalEnum { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::UnitTesting::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value, + MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::UnitTesting::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::UnitTesting::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::UnitTesting::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteAttribute(endpoint, Clusters::UnitTesting::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty) +{ + if (value.IsNull()) + { + return SetNull(endpoint, markDirty); + } + + return Set(endpoint, value.Value(), markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace NullableGlobalEnum + namespace FeatureMap { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * 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 51c89921d13cdf..9b97ea84692222 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 @@ -6959,6 +6959,14 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value); Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value, MarkAttributeDirty markDirty); } // namespace TimedWriteBoolean +namespace GlobalEnum { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, + chip::app::Clusters::Globals::TestGlobalEnum * value); // TestGlobalEnum +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value, + MarkAttributeDirty markDirty); +} // namespace GlobalEnum + namespace Unsupported { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, bool * value); // boolean Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, bool value); @@ -7364,6 +7372,21 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty); } // namespace WriteOnlyInt8u +namespace NullableGlobalEnum { +Protocols::InteractionModel::Status +Get(chip::EndpointId endpoint, DataModel::Nullable & value); // TestGlobalEnum +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, chip::app::Clusters::Globals::TestGlobalEnum value, + MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint); +Protocols::InteractionModel::Status SetNull(chip::EndpointId endpoint, MarkAttributeDirty markDirty); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value, + MarkAttributeDirty markDirty); +} // namespace NullableGlobalEnum + namespace FeatureMap { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint32_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index b924a303cc5b25..724e7a7eb88857 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -6917,6 +6917,12 @@ bool emberAfUnitTestingClusterTestSecondBatchHelperRequestCallback( bool emberAfUnitTestingClusterStringEchoRequestCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::UnitTesting::Commands::StringEchoRequest::DecodableType & commandData); +/** + * @brief Unit Testing Cluster GlobalEchoRequest Command callback (from client) + */ +bool emberAfUnitTestingClusterGlobalEchoRequestCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::DecodableType & commandData); /** * @brief Unit Testing Cluster TestDifferentVendorMeiRequest Command callback (from client) */ 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 b8a0234a172d59..7e51563b2dad56 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 @@ -29444,6 +29444,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const encoder.Encode(to_underlying(Fields::kF), f); encoder.Encode(to_underlying(Fields::kG), g); encoder.Encode(to_underlying(Fields::kH), h); + encoder.Encode(to_underlying(Fields::kI), i); return encoder.Finalize(); } @@ -29493,6 +29494,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, h); } + else if (__context_tag == to_underlying(Fields::kI)) + { + err = DataModel::Decode(reader, i); + } else { } @@ -29710,6 +29715,7 @@ CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const encoder.Encode(to_underlying(Fields::kA), a); encoder.Encode(to_underlying(Fields::kB), b); encoder.Encode(to_underlying(Fields::kC), c); + encoder.Encode(to_underlying(Fields::kD), d); return encoder.Finalize(); } @@ -29739,6 +29745,10 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) { err = DataModel::Decode(reader, c); } + else if (__context_tag == to_underlying(Fields::kD)) + { + err = DataModel::Decode(reader, d); + } else { } @@ -31039,6 +31049,45 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace TestEnumsRequest. +namespace GlobalEchoResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kField1), field1); + encoder.Encode(to_underlying(Fields::kField2), field2); + 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::kField1)) + { + err = DataModel::Decode(reader, field1); + } + else if (__context_tag == to_underlying(Fields::kField2)) + { + err = DataModel::Decode(reader, field2); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace GlobalEchoResponse. namespace TestNullableOptionalRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -31450,6 +31499,45 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } } // namespace StringEchoRequest. +namespace GlobalEchoRequest { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kField1), field1); + encoder.Encode(to_underlying(Fields::kField2), field2); + 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::kField1)) + { + err = DataModel::Decode(reader, field1); + } + else if (__context_tag == to_underlying(Fields::kField2)) + { + err = DataModel::Decode(reader, field2); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace GlobalEchoRequest. namespace TestDifferentVendorMeiRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -31624,6 +31712,10 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, generalErrorBoolean); case Attributes::ClusterErrorBoolean::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, clusterErrorBoolean); + case Attributes::GlobalEnum::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, globalEnum); + case Attributes::GlobalStruct::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, globalStruct); case Attributes::Unsupported::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, unsupported); case Attributes::NullableBoolean::TypeInfo::GetAttributeId(): @@ -31694,6 +31786,10 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, nullableRangeRestrictedInt16s); case Attributes::WriteOnlyInt8u::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, writeOnlyInt8u); + case Attributes::NullableGlobalEnum::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, nullableGlobalEnum); + case Attributes::NullableGlobalStruct::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, nullableGlobalStruct); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 27a51680533443..db5c8fb1065d79 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 @@ -44009,6 +44009,7 @@ enum class Fields : uint8_t kF = 5, kG = 6, kH = 7, + kI = 8, }; struct Type @@ -44022,6 +44023,7 @@ struct Type chip::BitMask f = static_cast>(0); float g = static_cast(0); double h = static_cast(0); + Optional i; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -44159,6 +44161,7 @@ enum class Fields : uint8_t kA = 0, kB = 1, kC = 2, + kD = 3, }; struct Type @@ -44167,6 +44170,7 @@ struct Type uint8_t a = static_cast(0); bool b = static_cast(0); Structs::SimpleStruct::Type c; + Optional d; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -44423,6 +44427,11 @@ struct Type; struct DecodableType; } // namespace TestEnumsRequest +namespace GlobalEchoResponse { +struct Type; +struct DecodableType; +} // namespace GlobalEchoResponse + namespace TestNullableOptionalRequest { struct Type; struct DecodableType; @@ -44473,6 +44482,11 @@ struct Type; struct DecodableType; } // namespace StringEchoRequest +namespace GlobalEchoRequest { +struct Type; +struct DecodableType; +} // namespace GlobalEchoRequest + namespace TestDifferentVendorMeiRequest { struct Type; struct DecodableType; @@ -45527,6 +45541,41 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace TestEnumsRequest +namespace GlobalEchoResponse { +enum class Fields : uint8_t +{ + kField1 = 0, + kField2 = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::GlobalEchoResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + + Globals::Structs::TestGlobalStruct::Type field1; + Globals::TestGlobalEnum field2 = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::GlobalEchoResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + + Globals::Structs::TestGlobalStruct::DecodableType field1; + Globals::TestGlobalEnum field2 = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace GlobalEchoResponse namespace TestNullableOptionalRequest { enum class Fields : uint8_t { @@ -45894,6 +45943,41 @@ struct DecodableType CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace StringEchoRequest +namespace GlobalEchoRequest { +enum class Fields : uint8_t +{ + kField1 = 0, + kField2 = 1, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::GlobalEchoRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + + Globals::Structs::TestGlobalStruct::Type field1; + Globals::TestGlobalEnum field2 = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; + + using ResponseType = Clusters::UnitTesting::Commands::GlobalEchoResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::GlobalEchoRequest::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + + Globals::Structs::TestGlobalStruct::DecodableType field1; + Globals::TestGlobalEnum field2 = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace GlobalEchoRequest namespace TestDifferentVendorMeiRequest { enum class Fields : uint8_t { @@ -46539,6 +46623,30 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace ClusterErrorBoolean +namespace GlobalEnum { +struct TypeInfo +{ + using Type = chip::app::Clusters::Globals::TestGlobalEnum; + using DecodableType = chip::app::Clusters::Globals::TestGlobalEnum; + using DecodableArgType = chip::app::Clusters::Globals::TestGlobalEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::GlobalEnum::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace GlobalEnum +namespace GlobalStruct { +struct TypeInfo +{ + using Type = chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type; + using DecodableType = chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType; + using DecodableArgType = const chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType &; + + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::GlobalStruct::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace GlobalStruct namespace Unsupported { struct TypeInfo { @@ -46966,6 +47074,31 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace WriteOnlyInt8u +namespace NullableGlobalEnum { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableGlobalEnum::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NullableGlobalEnum +namespace NullableGlobalStruct { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = + const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::UnitTesting::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NullableGlobalStruct::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NullableGlobalStruct namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -47074,7 +47207,9 @@ struct TypeInfo Attributes::TimedWriteBoolean::TypeInfo::DecodableType timedWriteBoolean = static_cast(0); Attributes::GeneralErrorBoolean::TypeInfo::DecodableType generalErrorBoolean = static_cast(0); Attributes::ClusterErrorBoolean::TypeInfo::DecodableType clusterErrorBoolean = static_cast(0); - Attributes::Unsupported::TypeInfo::DecodableType unsupported = static_cast(0); + Attributes::GlobalEnum::TypeInfo::DecodableType globalEnum = static_cast(0); + Attributes::GlobalStruct::TypeInfo::DecodableType globalStruct; + Attributes::Unsupported::TypeInfo::DecodableType unsupported = static_cast(0); Attributes::NullableBoolean::TypeInfo::DecodableType nullableBoolean; Attributes::NullableBitmap8::TypeInfo::DecodableType nullableBitmap8; Attributes::NullableBitmap16::TypeInfo::DecodableType nullableBitmap16; @@ -47109,6 +47244,8 @@ struct TypeInfo Attributes::NullableRangeRestrictedInt16u::TypeInfo::DecodableType nullableRangeRestrictedInt16u; Attributes::NullableRangeRestrictedInt16s::TypeInfo::DecodableType nullableRangeRestrictedInt16s; Attributes::WriteOnlyInt8u::TypeInfo::DecodableType writeOnlyInt8u = static_cast(0); + Attributes::NullableGlobalEnum::TypeInfo::DecodableType nullableGlobalEnum; + Attributes::NullableGlobalStruct::TypeInfo::DecodableType nullableGlobalStruct; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index d825736f7a45c6..7c9210d31772d4 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 @@ -8292,6 +8292,14 @@ namespace ClusterErrorBoolean { static constexpr AttributeId Id = 0x00000032; } // namespace ClusterErrorBoolean +namespace GlobalEnum { +static constexpr AttributeId Id = 0x00000033; +} // namespace GlobalEnum + +namespace GlobalStruct { +static constexpr AttributeId Id = 0x00000034; +} // namespace GlobalStruct + namespace Unsupported { static constexpr AttributeId Id = 0x000000FF; } // namespace Unsupported @@ -8432,6 +8440,14 @@ namespace WriteOnlyInt8u { static constexpr AttributeId Id = 0x0000402A; } // namespace WriteOnlyInt8u +namespace NullableGlobalEnum { +static constexpr AttributeId Id = 0x00004033; +} // namespace NullableGlobalEnum + +namespace NullableGlobalStruct { +static constexpr AttributeId Id = 0x00004034; +} // namespace NullableGlobalStruct + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 06aae2f0b822be..d5e25c7d4af60e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -1976,6 +1976,10 @@ namespace TestEnumsRequest { static constexpr CommandId Id = 0x0000000E; } // namespace TestEnumsRequest +namespace GlobalEchoResponse { +static constexpr CommandId Id = 0x0000000E; +} // namespace GlobalEchoResponse + namespace TestNullableOptionalRequest { static constexpr CommandId Id = 0x0000000F; } // namespace TestNullableOptionalRequest @@ -2016,6 +2020,10 @@ namespace StringEchoRequest { static constexpr CommandId Id = 0x00000018; } // namespace StringEchoRequest +namespace GlobalEchoRequest { +static constexpr CommandId Id = 0x00000019; +} // namespace GlobalEchoRequest + namespace TestDifferentVendorMeiRequest { static constexpr CommandId Id = 0xFFF200AA; } // namespace TestDifferentVendorMeiRequest diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 8857ad9aaa82d3..51626042ba49b7 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -14169,6 +14169,7 @@ class ElectricalMeasurementGetMeasurementProfileCommand : public ClusterCommand | * TestBatchHelperRequest | 0x16 | | * TestSecondBatchHelperRequest | 0x17 | | * StringEchoRequest | 0x18 | +| * GlobalEchoRequest | 0x19 | | * TestDifferentVendorMeiRequest | 0xFFF200AA| |------------------------------------------------------------------------------| | Attributes: | | @@ -14219,6 +14220,8 @@ class ElectricalMeasurementGetMeasurementProfileCommand : public ClusterCommand | * TimedWriteBoolean | 0x0030 | | * GeneralErrorBoolean | 0x0031 | | * ClusterErrorBoolean | 0x0032 | +| * GlobalEnum | 0x0033 | +| * GlobalStruct | 0x0034 | | * Unsupported | 0x00FF | | * NullableBoolean | 0x4000 | | * NullableBitmap8 | 0x4001 | @@ -14254,6 +14257,8 @@ class ElectricalMeasurementGetMeasurementProfileCommand : public ClusterCommand | * NullableRangeRestrictedInt16u | 0x4028 | | * NullableRangeRestrictedInt16s | 0x4029 | | * WriteOnlyInt8u | 0x402A | +| * NullableGlobalEnum | 0x4033 | +| * NullableGlobalStruct | 0x4034 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -15270,6 +15275,46 @@ class UnitTestingStringEchoRequest : public ClusterCommand chip::app::Clusters::UnitTesting::Commands::StringEchoRequest::Type mRequest; }; +/* + * Command GlobalEchoRequest + */ +class UnitTestingGlobalEchoRequest : public ClusterCommand +{ +public: + UnitTestingGlobalEchoRequest(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("global-echo-request", credsIssuerConfig), mComplex_Field1(&mRequest.field1) + { + AddArgument("Field1", &mComplex_Field1); + AddArgument("Field2", 0, UINT8_MAX, &mRequest.field2); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, + commandId, endpointIds.at(0)); + return ClusterCommand::SendCommand(device, endpointIds.at(0), clusterId, commandId, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on Group %u", clusterId, commandId, + groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, clusterId, commandId, mRequest); + } + +private: + chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Type mRequest; + TypedComplexArgument mComplex_Field1; +}; + /* * Command TestDifferentVendorMeiRequest */ @@ -27591,6 +27636,7 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // // // Attributes @@ -27644,6 +27690,8 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * make_unique(Id, "timed-write-boolean", Attributes::TimedWriteBoolean::Id, credsIssuerConfig), // make_unique(Id, "general-error-boolean", Attributes::GeneralErrorBoolean::Id, credsIssuerConfig), // make_unique(Id, "cluster-error-boolean", Attributes::ClusterErrorBoolean::Id, credsIssuerConfig), // + make_unique(Id, "global-enum", Attributes::GlobalEnum::Id, credsIssuerConfig), // + make_unique(Id, "global-struct", Attributes::GlobalStruct::Id, credsIssuerConfig), // make_unique(Id, "unsupported", Attributes::Unsupported::Id, credsIssuerConfig), // make_unique(Id, "nullable-boolean", Attributes::NullableBoolean::Id, credsIssuerConfig), // make_unique(Id, "nullable-bitmap8", Attributes::NullableBitmap8::Id, credsIssuerConfig), // @@ -27683,6 +27731,8 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * make_unique(Id, "nullable-range-restricted-int16s", Attributes::NullableRangeRestrictedInt16s::Id, credsIssuerConfig), // make_unique(Id, "write-only-int8u", Attributes::WriteOnlyInt8u::Id, credsIssuerConfig), // + make_unique(Id, "nullable-global-enum", Attributes::NullableGlobalEnum::Id, credsIssuerConfig), // + make_unique(Id, "nullable-global-struct", Attributes::NullableGlobalStruct::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -27791,6 +27841,10 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "cluster-error-boolean", 0, 1, Attributes::ClusterErrorBoolean::Id, WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>( + Id, "global-enum", 0, UINT8_MAX, Attributes::GlobalEnum::Id, WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>( + Id, "global-struct", Attributes::GlobalStruct::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "unsupported", 0, 1, Attributes::Unsupported::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( @@ -27884,6 +27938,12 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * WriteCommandType::kWrite, credsIssuerConfig), // make_unique>(Id, "write-only-int8u", 0, UINT8_MAX, Attributes::WriteOnlyInt8u::Id, WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>>( + Id, "nullable-global-enum", 0, UINT8_MAX, Attributes::NullableGlobalEnum::Id, WriteCommandType::kWrite, + credsIssuerConfig), // + make_unique< + WriteAttributeAsComplex>>( + Id, "nullable-global-struct", Attributes::NullableGlobalStruct::Id, WriteCommandType::kWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -27949,6 +28009,8 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * make_unique(Id, "timed-write-boolean", Attributes::TimedWriteBoolean::Id, credsIssuerConfig), // make_unique(Id, "general-error-boolean", Attributes::GeneralErrorBoolean::Id, credsIssuerConfig), // make_unique(Id, "cluster-error-boolean", Attributes::ClusterErrorBoolean::Id, credsIssuerConfig), // + make_unique(Id, "global-enum", Attributes::GlobalEnum::Id, credsIssuerConfig), // + make_unique(Id, "global-struct", Attributes::GlobalStruct::Id, credsIssuerConfig), // make_unique(Id, "unsupported", Attributes::Unsupported::Id, credsIssuerConfig), // make_unique(Id, "nullable-boolean", Attributes::NullableBoolean::Id, credsIssuerConfig), // make_unique(Id, "nullable-bitmap8", Attributes::NullableBitmap8::Id, credsIssuerConfig), // @@ -27988,6 +28050,8 @@ void registerClusterUnitTesting(Commands & commands, CredentialIssuerCommands * make_unique(Id, "nullable-range-restricted-int16s", Attributes::NullableRangeRestrictedInt16s::Id, credsIssuerConfig), // make_unique(Id, "write-only-int8u", Attributes::WriteOnlyInt8u::Id, credsIssuerConfig), // + make_unique(Id, "nullable-global-enum", Attributes::NullableGlobalEnum::Id, credsIssuerConfig), // + make_unique(Id, "nullable-global-struct", Attributes::NullableGlobalStruct::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 5a439b505e30c7..dc4e8baeee1489 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -19,6 +19,44 @@ #include +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TestGlobalStruct.name", "name", value.isMember("name"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TestGlobalStruct.myBitmap", "myBitmap", value.isMember("myBitmap"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); + valueCopy.removeMember("name"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "myBitmap"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.myBitmap, value["myBitmap"])); + valueCopy.removeMember("myBitmap"); + + if (value.isMember("myEnum")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "myEnum"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.myEnum, value["myEnum"])); + } + valueCopy.removeMember("myEnum"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.name); + ComplexArgumentParser::Finalize(request.myBitmap); + ComplexArgumentParser::Finalize(request.myEnum); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::detail::Structs::ModeTagStruct::Type & request, Json::Value & value) { @@ -455,44 +493,6 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::Opera ComplexArgumentParser::Finalize(request.operationalStateLabel); } -CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request, - Json::Value & value) -{ - VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); - - // Copy to track which members we already processed. - Json::Value valueCopy(value); - - ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TestGlobalStruct.name", "name", value.isMember("name"))); - ReturnErrorOnFailure( - ComplexArgumentParser::EnsureMemberExist("TestGlobalStruct.myBitmap", "myBitmap", value.isMember("myBitmap"))); - - char labelWithMember[kMaxLabelLength]; - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "name"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.name, value["name"])); - valueCopy.removeMember("name"); - - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "myBitmap"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.myBitmap, value["myBitmap"])); - valueCopy.removeMember("myBitmap"); - - if (value.isMember("myEnum")) - { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "myEnum"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.myEnum, value["myEnum"])); - } - valueCopy.removeMember("myEnum"); - - return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); -} - -void ComplexArgumentParser::Finalize(chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request) -{ - ComplexArgumentParser::Finalize(request.name); - ComplexArgumentParser::Finalize(request.myBitmap); - ComplexArgumentParser::Finalize(request.myEnum); -} - CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::Descriptor::Structs::SemanticTagStruct::Type & request, Json::Value & value) @@ -5769,6 +5769,13 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters: ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.h, value["h"])); valueCopy.removeMember("h"); + if (value.isMember("i")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "i"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.i, value["i"])); + } + valueCopy.removeMember("i"); + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } @@ -5782,6 +5789,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::UnitTesting::Structs:: ComplexArgumentParser::Finalize(request.f); ComplexArgumentParser::Finalize(request.g); ComplexArgumentParser::Finalize(request.h); + ComplexArgumentParser::Finalize(request.i); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, @@ -6008,6 +6016,13 @@ CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters: ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.c, value["c"])); valueCopy.removeMember("c"); + if (value.isMember("d")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "d"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.d, value["d"])); + } + valueCopy.removeMember("d"); + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } @@ -6016,6 +6031,7 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::UnitTesting::Structs:: ComplexArgumentParser::Finalize(request.a); ComplexArgumentParser::Finalize(request.b); ComplexArgumentParser::Finalize(request.c); + ComplexArgumentParser::Finalize(request.d); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index d001f91625afd5..b41cafdcd7569e 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -22,6 +22,11 @@ #include #include +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ModeTagStruct::Type & request, Json::Value & value); @@ -76,11 +81,6 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::OperationalStateStruct::Type & request); -static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request, - Json::Value & value); - -static void Finalize(chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type & request); - static CHIP_ERROR Setup(const char * label, chip::app::Clusters::Descriptor::Structs::SemanticTagStruct::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 57860663e7d2e8..e538dcfb5ea9c0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -21,6 +21,39 @@ using namespace chip::app::Clusters; +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Name", indent + 1, value.name); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Name'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MyBitmap", indent + 1, value.myBitmap); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MyBitmap'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MyEnum", indent + 1, value.myEnum); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MyEnum'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ModeTagStruct::DecodableType & value) { @@ -394,39 +427,6 @@ 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::Globals::Structs::TestGlobalStruct::DecodableType & value) -{ - DataModelLogger::LogString(label, indent, "{"); - { - CHIP_ERROR err = LogValue("Name", indent + 1, value.name); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Name'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("MyBitmap", indent + 1, value.myBitmap); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MyBitmap'"); - return err; - } - } - { - CHIP_ERROR err = LogValue("MyEnum", indent + 1, value.myEnum); - if (err != CHIP_NO_ERROR) - { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MyEnum'"); - return err; - } - } - DataModelLogger::LogString(indent, "}"); - - return CHIP_NO_ERROR; -} - CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::Descriptor::Structs::SemanticTagStruct::DecodableType & value) { @@ -5109,6 +5109,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("I", indent + 1, value.i); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'I'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -5322,6 +5330,14 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return err; } } + { + CHIP_ERROR err = LogValue("D", indent + 1, value.d); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'D'"); + return err; + } + } DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; @@ -8794,6 +8810,15 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const UnitTesting::Commands::GlobalEchoResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("field1", indent + 1, value.field1)); + ReturnErrorOnFailure(DataModelLogger::LogValue("field2", indent + 1, value.field2)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const UnitTesting::Commands::TestDifferentVendorMeiResponse::DecodableType & value) { @@ -19033,6 +19058,16 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("cluster_error_boolean", 1, value); } + case UnitTesting::Attributes::GlobalEnum::Id: { + chip::app::Clusters::Globals::TestGlobalEnum value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("global_enum", 1, value); + } + case UnitTesting::Attributes::GlobalStruct::Id: { + chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("global_struct", 1, value); + } case UnitTesting::Attributes::Unsupported::Id: { bool value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -19208,6 +19243,16 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("write_only_int8u", 1, value); } + case UnitTesting::Attributes::NullableGlobalEnum::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("nullable_global_enum", 1, value); + } + case UnitTesting::Attributes::NullableGlobalStruct::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("nullable_global_struct", 1, value); + } case UnitTesting::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -20027,6 +20072,11 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("StringEchoResponse", 1, value); } + case UnitTesting::Commands::GlobalEchoResponse::Id: { + UnitTesting::Commands::GlobalEchoResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GlobalEchoResponse", 1, value); + } case UnitTesting::Commands::TestDifferentVendorMeiResponse::Id: { UnitTesting::Commands::TestDifferentVendorMeiResponse::DecodableType 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 4c5ff8b2375d3a..7f6e370ab6cb6b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -20,6 +20,9 @@ #include #include +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ModeTagStruct::DecodableType & value); @@ -53,9 +56,6 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::OperationalStateStruct::DecodableType & value); -static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::Globals::Structs::TestGlobalStruct::DecodableType & value); - static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Descriptor::Structs::SemanticTagStruct::DecodableType & value); @@ -873,6 +873,8 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Commands::TestBatchHelperResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Commands::StringEchoResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::UnitTesting::Commands::TestDifferentVendorMeiResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 1d35688254998d..10cf9d4c2a14a4 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -177016,6 +177016,7 @@ class SubscribeAttributeElectricalMeasurementClusterRevision : public SubscribeA | * TestBatchHelperRequest | 0x16 | | * TestSecondBatchHelperRequest | 0x17 | | * StringEchoRequest | 0x18 | +| * GlobalEchoRequest | 0x19 | | * TestDifferentVendorMeiRequest | 0xFFF200AA| |------------------------------------------------------------------------------| | Attributes: | | @@ -177066,6 +177067,8 @@ class SubscribeAttributeElectricalMeasurementClusterRevision : public SubscribeA | * TimedWriteBoolean | 0x0030 | | * GeneralErrorBoolean | 0x0031 | | * ClusterErrorBoolean | 0x0032 | +| * GlobalEnum | 0x0033 | +| * GlobalStruct | 0x0034 | | * Unsupported | 0x00FF | | * NullableBoolean | 0x4000 | | * NullableBitmap8 | 0x4001 | @@ -177101,6 +177104,8 @@ class SubscribeAttributeElectricalMeasurementClusterRevision : public SubscribeA | * NullableRangeRestrictedInt16u | 0x4028 | | * NullableRangeRestrictedInt16s | 0x4029 | | * WriteOnlyInt8u | 0x402A | +| * NullableGlobalEnum | 0x4033 | +| * NullableGlobalStruct | 0x4034 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -177453,6 +177458,11 @@ class UnitTestingTestStructArrayArgumentRequest : public ClusterCommand { newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; + if (entry_0.c.i.HasValue()) { + newElement_0.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.i.Value())]; + } else { + newElement_0.c.i = nil; + } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.d) { @@ -177466,6 +177476,11 @@ class UnitTestingTestStructArrayArgumentRequest : public ClusterCommand { newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; + if (entry_2.i.HasValue()) { + newElement_2.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.i.Value())]; + } else { + newElement_2.i = nil; + } [array_2 addObject:newElement_2]; } newElement_0.d = array_2; @@ -177514,6 +177529,11 @@ class UnitTestingTestStructArrayArgumentRequest : public ClusterCommand { newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + if (entry_0.i.HasValue()) { + newElement_0.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.i.Value())]; + } else { + newElement_0.i = nil; + } [array_0 addObject:newElement_0]; } params.arg2 = array_0; @@ -177604,6 +177624,11 @@ class UnitTestingTestStructArgumentRequest : public ClusterCommand { params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; + if (mRequest.arg1.i.HasValue()) { + params.arg1.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.i.Value())]; + } else { + params.arg1.i = nil; + } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -177670,6 +177695,31 @@ class UnitTestingTestNestedStructArgumentRequest : public ClusterCommand { params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; + if (mRequest.arg1.c.i.HasValue()) { + params.arg1.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.i.Value())]; + } else { + params.arg1.c.i = nil; + } + if (mRequest.arg1.d.HasValue()) { + params.arg1.d = [MTRDataTypeTestGlobalStruct new]; + params.arg1.d.name = [[NSString alloc] initWithBytes:mRequest.arg1.d.Value().name.data() length:mRequest.arg1.d.Value().name.size() encoding:NSUTF8StringEncoding]; + if (mRequest.arg1.d.Value().myBitmap.IsNull()) { + params.arg1.d.myBitmap = nil; + } else { + params.arg1.d.myBitmap = [NSNumber numberWithUnsignedInt:mRequest.arg1.d.Value().myBitmap.Value().Raw()]; + } + if (mRequest.arg1.d.Value().myEnum.HasValue()) { + if (mRequest.arg1.d.Value().myEnum.Value().IsNull()) { + params.arg1.d.myEnum = nil; + } else { + params.arg1.d.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.d.Value().myEnum.Value().Value())]; + } + } else { + params.arg1.d.myEnum = nil; + } + } else { + params.arg1.d = nil; + } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -177737,6 +177787,11 @@ class UnitTestingTestListStructArgumentRequest : public ClusterCommand { newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + if (entry_0.i.HasValue()) { + newElement_0.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.i.Value())]; + } else { + newElement_0.i = nil; + } [array_0 addObject:newElement_0]; } params.arg1 = array_0; @@ -177870,6 +177925,11 @@ class UnitTestingTestNestedStructListArgumentRequest : public ClusterCommand { params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; + if (mRequest.arg1.c.i.HasValue()) { + params.arg1.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.i.Value())]; + } else { + params.arg1.c.i = nil; + } { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.arg1.d) { @@ -177883,6 +177943,11 @@ class UnitTestingTestNestedStructListArgumentRequest : public ClusterCommand { newElement_1.f = [NSNumber numberWithUnsignedChar:entry_1.f.Raw()]; newElement_1.g = [NSNumber numberWithFloat:entry_1.g]; newElement_1.h = [NSNumber numberWithDouble:entry_1.h]; + if (entry_1.i.HasValue()) { + newElement_1.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.i.Value())]; + } else { + newElement_1.i = nil; + } [array_1 addObject:newElement_1]; } params.arg1.d = array_1; @@ -177984,6 +178049,11 @@ class UnitTestingTestListNestedStructListArgumentRequest : public ClusterCommand newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; + if (entry_0.c.i.HasValue()) { + newElement_0.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.i.Value())]; + } else { + newElement_0.c.i = nil; + } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.d) { @@ -177997,6 +178067,11 @@ class UnitTestingTestListNestedStructListArgumentRequest : public ClusterCommand newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; + if (entry_2.i.HasValue()) { + newElement_2.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.i.Value())]; + } else { + newElement_2.i = nil; + } [array_2 addObject:newElement_2]; } newElement_0.d = array_2; @@ -178331,6 +178406,11 @@ class UnitTestingTestComplexNullableOptionalRequest : public ClusterCommand { params.nullableStruct.f = [NSNumber numberWithUnsignedChar:mRequest.nullableStruct.Value().f.Raw()]; params.nullableStruct.g = [NSNumber numberWithFloat:mRequest.nullableStruct.Value().g]; params.nullableStruct.h = [NSNumber numberWithDouble:mRequest.nullableStruct.Value().h]; + if (mRequest.nullableStruct.Value().i.HasValue()) { + params.nullableStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableStruct.Value().i.Value())]; + } else { + params.nullableStruct.i = nil; + } } if (mRequest.optionalStruct.HasValue()) { params.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; @@ -178342,6 +178422,11 @@ class UnitTestingTestComplexNullableOptionalRequest : public ClusterCommand { params.optionalStruct.f = [NSNumber numberWithUnsignedChar:mRequest.optionalStruct.Value().f.Raw()]; params.optionalStruct.g = [NSNumber numberWithFloat:mRequest.optionalStruct.Value().g]; params.optionalStruct.h = [NSNumber numberWithDouble:mRequest.optionalStruct.Value().h]; + if (mRequest.optionalStruct.Value().i.HasValue()) { + params.optionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.optionalStruct.Value().i.Value())]; + } else { + params.optionalStruct.i = nil; + } } else { params.optionalStruct = nil; } @@ -178358,6 +178443,11 @@ class UnitTestingTestComplexNullableOptionalRequest : public ClusterCommand { params.nullableOptionalStruct.f = [NSNumber numberWithUnsignedChar:mRequest.nullableOptionalStruct.Value().Value().f.Raw()]; params.nullableOptionalStruct.g = [NSNumber numberWithFloat:mRequest.nullableOptionalStruct.Value().Value().g]; params.nullableOptionalStruct.h = [NSNumber numberWithDouble:mRequest.nullableOptionalStruct.Value().Value().h]; + if (mRequest.nullableOptionalStruct.Value().Value().i.HasValue()) { + params.nullableOptionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableOptionalStruct.Value().Value().i.Value())]; + } else { + params.nullableOptionalStruct.i = nil; + } } } else { params.nullableOptionalStruct = nil; @@ -178473,6 +178563,11 @@ class UnitTestingSimpleStructEchoRequest : public ClusterCommand { params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; + if (mRequest.arg1.i.HasValue()) { + params.arg1.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.i.Value())]; + } else { + params.arg1.i = nil; + } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { @@ -178908,6 +179003,88 @@ class UnitTestingStringEchoRequest : public ClusterCommand { chip::app::Clusters::UnitTesting::Commands::StringEchoRequest::Type mRequest; }; +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/* + * Command GlobalEchoRequest + */ +class UnitTestingGlobalEchoRequest : public ClusterCommand { +public: + UnitTestingGlobalEchoRequest() + : ClusterCommand("global-echo-request") + , mComplex_Field1(&mRequest.field1) + { +#if MTR_ENABLE_PROVISIONAL + AddArgument("Field1", &mComplex_Field1); +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + AddArgument("Field2", 0, UINT8_MAX, &mRequest.field2); +#endif // MTR_ENABLE_PROVISIONAL + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRUnitTestingClusterGlobalEchoRequestParams alloc] init]; + params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; +#if MTR_ENABLE_PROVISIONAL + params.field1 = [MTRDataTypeTestGlobalStruct new]; + params.field1.name = [[NSString alloc] initWithBytes:mRequest.field1.name.data() length:mRequest.field1.name.size() encoding:NSUTF8StringEncoding]; + if (mRequest.field1.myBitmap.IsNull()) { + params.field1.myBitmap = nil; + } else { + params.field1.myBitmap = [NSNumber numberWithUnsignedInt:mRequest.field1.myBitmap.Value().Raw()]; + } + if (mRequest.field1.myEnum.HasValue()) { + if (mRequest.field1.myEnum.Value().IsNull()) { + params.field1.myEnum = nil; + } else { + params.field1.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.field1.myEnum.Value().Value())]; + } + } else { + params.field1.myEnum = nil; + } +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + params.field2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.field2)]; +#endif // MTR_ENABLE_PROVISIONAL + uint16_t repeatCount = mRepeatCount.ValueOr(1); + uint16_t __block responsesNeeded = repeatCount; + while (repeatCount--) { + [cluster globalEchoRequestWithParams:params completion: + ^(MTRUnitTestingClusterGlobalEchoResponseParams * _Nullable values, NSError * _Nullable error) { + NSLog(@"Values: %@", values); + if (error == nil) { + constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::Id; + RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); + } + responsesNeeded--; + if (error != nil) { + mError = error; + LogNSError("Error", error); + constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::Id; + RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); + } + if (responsesNeeded == 0) { + SetCommandExitStatus(mError); + } + }]; + } + return CHIP_NO_ERROR; + } + +private: + chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Type mRequest; + TypedComplexArgument mComplex_Field1; +}; + #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* @@ -183428,6 +183605,11 @@ class WriteUnitTestingListNullablesAndOptionalsStruct : public WriteAttribute { newElement_0.nullableStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().f.Raw()]; newElement_0.nullableStruct.g = [NSNumber numberWithFloat:entry_0.nullableStruct.Value().g]; newElement_0.nullableStruct.h = [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; + if (entry_0.nullableStruct.Value().i.HasValue()) { + newElement_0.nullableStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().i.Value())]; + } else { + newElement_0.nullableStruct.i = nil; + } } if (entry_0.optionalStruct.HasValue()) { newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; @@ -183439,6 +183621,11 @@ class WriteUnitTestingListNullablesAndOptionalsStruct : public WriteAttribute { newElement_0.optionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().f.Raw()]; newElement_0.optionalStruct.g = [NSNumber numberWithFloat:entry_0.optionalStruct.Value().g]; newElement_0.optionalStruct.h = [NSNumber numberWithDouble:entry_0.optionalStruct.Value().h]; + if (entry_0.optionalStruct.Value().i.HasValue()) { + newElement_0.optionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().i.Value())]; + } else { + newElement_0.optionalStruct.i = nil; + } } else { newElement_0.optionalStruct = nil; } @@ -183455,6 +183642,11 @@ class WriteUnitTestingListNullablesAndOptionalsStruct : public WriteAttribute { newElement_0.nullableOptionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().f.Raw()]; newElement_0.nullableOptionalStruct.g = [NSNumber numberWithFloat:entry_0.nullableOptionalStruct.Value().Value().g]; newElement_0.nullableOptionalStruct.h = [NSNumber numberWithDouble:entry_0.nullableOptionalStruct.Value().Value().h]; + if (entry_0.nullableOptionalStruct.Value().Value().i.HasValue()) { + newElement_0.nullableOptionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().i.Value())]; + } else { + newElement_0.nullableOptionalStruct.i = nil; + } } } else { newElement_0.nullableOptionalStruct = nil; @@ -183763,6 +183955,11 @@ class WriteUnitTestingStructAttr : public WriteAttribute { value.f = [NSNumber numberWithUnsignedChar:mValue.f.Raw()]; value.g = [NSNumber numberWithFloat:mValue.g]; value.h = [NSNumber numberWithDouble:mValue.h]; + if (mValue.i.HasValue()) { + value.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.i.Value())]; + } else { + value.i = nil; + } [cluster writeAttributeStructAttrWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { @@ -184553,6 +184750,11 @@ class WriteUnitTestingListFabricScoped : public WriteAttribute { newElement_0.fabricSensitiveStruct.f = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.f.Raw()]; newElement_0.fabricSensitiveStruct.g = [NSNumber numberWithFloat:entry_0.fabricSensitiveStruct.g]; newElement_0.fabricSensitiveStruct.h = [NSNumber numberWithDouble:entry_0.fabricSensitiveStruct.h]; + if (entry_0.fabricSensitiveStruct.i.HasValue()) { + newElement_0.fabricSensitiveStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.i.Value())]; + } else { + newElement_0.fabricSensitiveStruct.i = nil; + } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.fabricSensitiveInt8uList) { @@ -184913,22 +185115,274 @@ class ReadUnitTestingClusterErrorBoolean : public ReadAttribute { class WriteUnitTestingClusterErrorBoolean : public WriteAttribute { public: - WriteUnitTestingClusterErrorBoolean() - : WriteAttribute("cluster-error-boolean") + WriteUnitTestingClusterErrorBoolean() + : WriteAttribute("cluster-error-boolean") + { + AddArgument("attr-name", "cluster-error-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingClusterErrorBoolean() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; + + [cluster writeAttributeClusterErrorBooleanWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("UnitTesting ClusterErrorBoolean write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + bool mValue; +}; + +class SubscribeAttributeUnitTestingClusterErrorBoolean : public SubscribeAttribute { +public: + SubscribeAttributeUnitTestingClusterErrorBoolean() + : SubscribeAttribute("cluster-error-boolean") + { + } + + ~SubscribeAttributeUnitTestingClusterErrorBoolean() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::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 = [[MTRBaseClusterUnitTesting 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 subscribeAttributeClusterErrorBooleanWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.ClusterErrorBoolean 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; + } +}; + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute GlobalEnum + */ +class ReadUnitTestingGlobalEnum : public ReadAttribute { +public: + ReadUnitTestingGlobalEnum() + : ReadAttribute("global-enum") + { + } + + ~ReadUnitTestingGlobalEnum() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalEnum::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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGlobalEnumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.GlobalEnum response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("UnitTesting GlobalEnum read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteUnitTestingGlobalEnum : public WriteAttribute { +public: + WriteUnitTestingGlobalEnum() + : WriteAttribute("global-enum") + { + AddArgument("attr-name", "global-enum"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingGlobalEnum() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalEnum::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeGlobalEnumWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("UnitTesting GlobalEnum write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + uint8_t mValue; +}; + +class SubscribeAttributeUnitTestingGlobalEnum : public SubscribeAttribute { +public: + SubscribeAttributeUnitTestingGlobalEnum() + : SubscribeAttribute("global-enum") + { + } + + ~SubscribeAttributeUnitTestingGlobalEnum() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalEnum::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 = [[MTRBaseClusterUnitTesting 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 subscribeAttributeGlobalEnumWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.GlobalEnum 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 GlobalStruct + */ +class ReadUnitTestingGlobalStruct : public ReadAttribute { +public: + ReadUnitTestingGlobalStruct() + : ReadAttribute("global-struct") + { + } + + ~ReadUnitTestingGlobalStruct() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalStruct::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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGlobalStructWithCompletion:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.GlobalStruct response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("UnitTesting GlobalStruct read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteUnitTestingGlobalStruct : public WriteAttribute { +public: + WriteUnitTestingGlobalStruct() + : WriteAttribute("global-struct") + , mComplex(&mValue) { - AddArgument("attr-name", "cluster-error-boolean"); - AddArgument("attr-value", 0, 1, &mValue); + AddArgument("attr-name", "global-struct"); + AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } - ~WriteUnitTestingClusterErrorBoolean() + ~WriteUnitTestingGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; - constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); @@ -184936,11 +185390,27 @@ class WriteUnitTestingClusterErrorBoolean : public WriteAttribute { __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; - NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; + MTRDataTypeTestGlobalStruct * _Nonnull value; + value = [MTRDataTypeTestGlobalStruct new]; + value.name = [[NSString alloc] initWithBytes:mValue.name.data() length:mValue.name.size() encoding:NSUTF8StringEncoding]; + if (mValue.myBitmap.IsNull()) { + value.myBitmap = nil; + } else { + value.myBitmap = [NSNumber numberWithUnsignedInt:mValue.myBitmap.Value().Raw()]; + } + if (mValue.myEnum.HasValue()) { + if (mValue.myEnum.Value().IsNull()) { + value.myEnum = nil; + } else { + value.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.myEnum.Value().Value())]; + } + } else { + value.myEnum = nil; + } - [cluster writeAttributeClusterErrorBooleanWithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster writeAttributeGlobalStructWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("UnitTesting ClusterErrorBoolean write Error", error); + LogNSError("UnitTesting GlobalStruct write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); @@ -184949,24 +185419,25 @@ class WriteUnitTestingClusterErrorBoolean : public WriteAttribute { } private: - bool mValue; + chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type mValue; + TypedComplexArgument mComplex; }; -class SubscribeAttributeUnitTestingClusterErrorBoolean : public SubscribeAttribute { +class SubscribeAttributeUnitTestingGlobalStruct : public SubscribeAttribute { public: - SubscribeAttributeUnitTestingClusterErrorBoolean() - : SubscribeAttribute("cluster-error-boolean") + SubscribeAttributeUnitTestingGlobalStruct() + : SubscribeAttribute("global-struct") { } - ~SubscribeAttributeUnitTestingClusterErrorBoolean() + ~SubscribeAttributeUnitTestingGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; - constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalStruct::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); @@ -184981,10 +185452,10 @@ class SubscribeAttributeUnitTestingClusterErrorBoolean : public SubscribeAttribu if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } - [cluster subscribeAttributeClusterErrorBooleanWithParams:params + [cluster subscribeAttributeGlobalStructWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"UnitTesting.ClusterErrorBoolean response %@", [value description]); + reportHandler:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.GlobalStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { @@ -184997,6 +185468,8 @@ class SubscribeAttributeUnitTestingClusterErrorBoolean : public SubscribeAttribu } }; +#endif // MTR_ENABLE_PROVISIONAL + /* * Attribute Unsupported */ @@ -188724,6 +189197,11 @@ class WriteUnitTestingNullableStruct : public WriteAttribute { value.f = [NSNumber numberWithUnsignedChar:mValue.Value().f.Raw()]; value.g = [NSNumber numberWithFloat:mValue.Value().g]; value.h = [NSNumber numberWithDouble:mValue.Value().h]; + if (mValue.Value().i.HasValue()) { + value.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.Value().i.Value())]; + } else { + value.i = nil; + } } [cluster writeAttributeNullableStructWithValue:value params:params completion:^(NSError * _Nullable error) { @@ -189413,6 +189891,284 @@ class SubscribeAttributeUnitTestingWriteOnlyInt8u : public SubscribeAttribute { } }; +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute NullableGlobalEnum + */ +class ReadUnitTestingNullableGlobalEnum : public ReadAttribute { +public: + ReadUnitTestingNullableGlobalEnum() + : ReadAttribute("nullable-global-enum") + { + } + + ~ReadUnitTestingNullableGlobalEnum() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalEnum::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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNullableGlobalEnumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.NullableGlobalEnum response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("UnitTesting NullableGlobalEnum read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteUnitTestingNullableGlobalEnum : public WriteAttribute { +public: + WriteUnitTestingNullableGlobalEnum() + : WriteAttribute("nullable-global-enum") + { + AddArgument("attr-name", "nullable-global-enum"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableGlobalEnum() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalEnum::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nullable value = nil; + if (!mValue.IsNull()) { + value = [NSNumber numberWithUnsignedChar:mValue.Value()]; + } + + [cluster writeAttributeNullableGlobalEnumWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableGlobalEnum write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + chip::app::DataModel::Nullable mValue; +}; + +class SubscribeAttributeUnitTestingNullableGlobalEnum : public SubscribeAttribute { +public: + SubscribeAttributeUnitTestingNullableGlobalEnum() + : SubscribeAttribute("nullable-global-enum") + { + } + + ~SubscribeAttributeUnitTestingNullableGlobalEnum() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalEnum::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 = [[MTRBaseClusterUnitTesting 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 subscribeAttributeNullableGlobalEnumWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.NullableGlobalEnum 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 NullableGlobalStruct + */ +class ReadUnitTestingNullableGlobalStruct : public ReadAttribute { +public: + ReadUnitTestingNullableGlobalStruct() + : ReadAttribute("nullable-global-struct") + { + } + + ~ReadUnitTestingNullableGlobalStruct() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalStruct::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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNullableGlobalStructWithCompletion:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.NullableGlobalStruct response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("UnitTesting NullableGlobalStruct read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteUnitTestingNullableGlobalStruct : public WriteAttribute { +public: + WriteUnitTestingNullableGlobalStruct() + : WriteAttribute("nullable-global-struct") + , mComplex(&mValue) + { + AddArgument("attr-name", "nullable-global-struct"); + AddArgument("attr-value", &mComplex); + WriteAttribute::AddArguments(); + } + + ~WriteUnitTestingNullableGlobalStruct() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalStruct::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (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 = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + MTRDataTypeTestGlobalStruct * _Nullable value; + if (mValue.IsNull()) { + value = nil; + } else { + value = [MTRDataTypeTestGlobalStruct new]; + value.name = [[NSString alloc] initWithBytes:mValue.Value().name.data() length:mValue.Value().name.size() encoding:NSUTF8StringEncoding]; + if (mValue.Value().myBitmap.IsNull()) { + value.myBitmap = nil; + } else { + value.myBitmap = [NSNumber numberWithUnsignedInt:mValue.Value().myBitmap.Value().Raw()]; + } + if (mValue.Value().myEnum.HasValue()) { + if (mValue.Value().myEnum.Value().IsNull()) { + value.myEnum = nil; + } else { + value.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.Value().myEnum.Value().Value())]; + } + } else { + value.myEnum = nil; + } + } + + [cluster writeAttributeNullableGlobalStructWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("UnitTesting NullableGlobalStruct write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + chip::app::DataModel::Nullable mValue; + TypedComplexArgument> mComplex; +}; + +class SubscribeAttributeUnitTestingNullableGlobalStruct : public SubscribeAttribute { +public: + SubscribeAttributeUnitTestingNullableGlobalStruct() + : SubscribeAttribute("nullable-global-struct") + { + } + + ~SubscribeAttributeUnitTestingNullableGlobalStruct() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalStruct::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 = [[MTRBaseClusterUnitTesting 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 subscribeAttributeNullableGlobalStructWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"UnitTesting.NullableGlobalStruct 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 + /* * Attribute GeneratedCommandList */ @@ -198074,6 +198830,9 @@ void registerClusterUnitTesting(Commands & commands) #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL @@ -198221,6 +198980,16 @@ void registerClusterUnitTesting(Commands & commands) make_unique(), // make_unique(), // make_unique(), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // @@ -198326,6 +199095,16 @@ void registerClusterUnitTesting(Commands & commands) make_unique(), // make_unique(), // make_unique(), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // From 1a7352f49a9b30220bc7cef0ebd85843c1d87b37 Mon Sep 17 00:00:00 2001 From: Michael Rupp <95718139+mykrupp@users.noreply.github.com> Date: Wed, 31 Jul 2024 22:31:44 -0400 Subject: [PATCH 48/63] [Silabs] Port platform specific Multi-Chip OTA work (#34440) * Pull request #1836: Cherry multi ota Merge in WMN_TOOLS/matter from cherry-multi-ota to silabs_slc_1.3 Squashed commit of the following: commit 4320bb46571658bc44fb82345348265def394991 Author: Michael Rupp Date: Fri May 10 14:26:07 2024 -0400 remove some unwanted diffs in provision files commit be160931dc600de7e7ead378b70d6a43c3945e46 Author: Michael Rupp Date: Fri May 10 14:24:25 2024 -0400 revert changes to generator.project.mak commit 14b6605887166e6d5284a61feb2bf407d850bdcf Author: Michael Rupp Date: Fri May 10 13:06:12 2024 -0400 revert NVM key changes and script changes ... and 8 more commits * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by autopep8 * remove unused libs caught by linter * update doctree with new readmes * rerun CI, cirque failing for unknown reasons * fix include guards in provision examples * Restyled by clang-format --------- Co-authored-by: Restyled.io --- docs/tools/index.md | 2 + .../provision/ProvisionStorageDefault.cpp | 5 +- .../provision/ProvisionStorageFlash.cpp | 5 +- .../silabs/factory_data_generator/README.md | 56 ++++++ .../silabs/factory_data_generator/custom.py | 106 +++++++++++ .../silabs/factory_data_generator/default.py | 131 ++++++++++++++ scripts/tools/silabs/ota/README.md | 15 +- .../binaries/ext_flash_ota_entry_example.bin | Bin 0 -> 7056 bytes .../examples/ota_custom_entries_example.json | 67 +++++++ .../examples/ota_custom_entries_example2.json | 88 +++++++++ .../tools/silabs/ota/ota_multi_image_tool.py | 10 +- scripts/tools/silabs/ota/requirements.txt | 1 + src/platform/silabs/efr32/BUILD.gn | 21 ++- .../silabs/efr32/efr32-psa-crypto-config.h | 5 + .../silabs/multi-ota/OTACustomProcessor.cpp | 94 ++++++++++ .../silabs/multi-ota/OTACustomProcessor.h | 56 ++++++ .../multi-ota/OTAFactoryDataProcessor.cpp | 170 ++++++++++++++++++ .../multi-ota/OTAFactoryDataProcessor.h | 81 +++++++++ .../{efr32 => }/OTAFirmwareProcessor.cpp | 37 +++- .../{efr32 => }/OTAFirmwareProcessor.h | 0 .../silabs/multi-ota/{efr32 => }/OTAHooks.cpp | 27 ++- .../multi-ota/OTAMultiImageProcessorImpl.cpp | 3 - .../silabs/multi-ota/OTATlvProcessor.cpp | 70 +------- .../silabs/multi-ota/OTATlvProcessor.h | 10 ++ .../silabs/multi-ota/OtaTlvEncryptionKey.cpp | 130 ++++++++++++++ .../silabs/multi-ota/OtaTlvEncryptionKey.h | 34 ++++ third_party/silabs/efr32_sdk.gni | 10 ++ 27 files changed, 1145 insertions(+), 89 deletions(-) create mode 100644 scripts/tools/silabs/factory_data_generator/README.md create mode 100644 scripts/tools/silabs/factory_data_generator/custom.py create mode 100644 scripts/tools/silabs/factory_data_generator/default.py create mode 100755 scripts/tools/silabs/ota/examples/binaries/ext_flash_ota_entry_example.bin create mode 100644 scripts/tools/silabs/ota/examples/ota_custom_entries_example.json create mode 100644 scripts/tools/silabs/ota/examples/ota_custom_entries_example2.json create mode 100644 scripts/tools/silabs/ota/requirements.txt create mode 100644 src/platform/silabs/multi-ota/OTACustomProcessor.cpp create mode 100644 src/platform/silabs/multi-ota/OTACustomProcessor.h create mode 100644 src/platform/silabs/multi-ota/OTAFactoryDataProcessor.cpp create mode 100644 src/platform/silabs/multi-ota/OTAFactoryDataProcessor.h rename src/platform/silabs/multi-ota/{efr32 => }/OTAFirmwareProcessor.cpp (84%) rename src/platform/silabs/multi-ota/{efr32 => }/OTAFirmwareProcessor.h (100%) rename src/platform/silabs/multi-ota/{efr32 => }/OTAHooks.cpp (52%) create mode 100644 src/platform/silabs/multi-ota/OtaTlvEncryptionKey.cpp create mode 100644 src/platform/silabs/multi-ota/OtaTlvEncryptionKey.h diff --git a/docs/tools/index.md b/docs/tools/index.md index 003573ed5ebb14..a2ff8fd1587f89 100644 --- a/docs/tools/index.md +++ b/docs/tools/index.md @@ -49,6 +49,8 @@ Source files for these tools are located at `scripts/tools`. :maxdepth: 1 ../scripts/tools/silabs/README +../scripts/tools/silabs/ota/README +../scripts/tools/silabs/factory_data_generator/README ``` diff --git a/examples/platform/silabs/provision/ProvisionStorageDefault.cpp b/examples/platform/silabs/provision/ProvisionStorageDefault.cpp index 09f103592d2470..1162323cda3d51 100644 --- a/examples/platform/silabs/provision/ProvisionStorageDefault.cpp +++ b/examples/platform/silabs/provision/ProvisionStorageDefault.cpp @@ -28,6 +28,9 @@ #include #include #include +#ifdef OTA_ENCRYPTION_ENABLE +#include +#endif // OTA_ENCRYPTION_ENABLE #ifdef SLI_SI91X_MCU_INTERFACE #include #else @@ -659,7 +662,7 @@ CHIP_ERROR Storage::SetOtaTlvEncryptionKey(const ByteSpan & value) ReturnErrorOnFailure(key.Import(value.data(), value.size())); return SilabsConfig::WriteConfigValue(SilabsConfig::kOtaTlvEncryption_KeyId, key.GetId()); } -#endif +#endif // OTA_ENCRYPTION_ENABLE /** * @brief Reads the test event trigger key from NVM. If the key isn't present, returns default value if defined. diff --git a/examples/platform/silabs/provision/ProvisionStorageFlash.cpp b/examples/platform/silabs/provision/ProvisionStorageFlash.cpp index 5bd11108bd9cc6..35a32d6af8f5ec 100644 --- a/examples/platform/silabs/provision/ProvisionStorageFlash.cpp +++ b/examples/platform/silabs/provision/ProvisionStorageFlash.cpp @@ -25,6 +25,9 @@ #include #include #include +#ifdef OTA_ENCRYPTION_ENABLE +#include +#endif // OTA_ENCRYPTION_ENABLE using namespace chip::Credentials; @@ -708,7 +711,7 @@ CHIP_ERROR Storage::SetOtaTlvEncryptionKey(const ByteSpan & value) { return CHIP_ERROR_NOT_IMPLEMENTED; } -#endif +#endif // OTA_ENCRYPTION_ENABLE CHIP_ERROR Storage::GetTestEventTriggerKey(MutableByteSpan & keySpan) { diff --git a/scripts/tools/silabs/factory_data_generator/README.md b/scripts/tools/silabs/factory_data_generator/README.md new file mode 100644 index 00000000000000..c75c52f91d0333 --- /dev/null +++ b/scripts/tools/silabs/factory_data_generator/README.md @@ -0,0 +1,56 @@ +# Silabs Factory Data Generator + +## Tool implementation + +The tool comprises of two files: `default.py`, `custom.py` + +### `default.py` + +Defines the base `InputArgument` class and its derived classes that will be +referenced as **default classes**. + +`InputArgument` offers an abstract interface in the form of three methods: +`key()`, `length()`, `encode()`, that will be used to generate the `(K, L, V)` +tuple through the public `output()` method. Each custom class should implement +the abstract interface, if its direct parent does not offer a relevant +implementation. + +### `custom.py` + +Defines classes for each argument that should generate data in the output binary +(will be referenced as **custom classes**). Please note that each new class +should derive from a default class, not from `InputArgument` directly. + +### How to add a new argument + +Example of defining a new argument class in `custom.py`: + +``` +class FooArgument(BarArgument): + def __init__(self, arg): + super().__init__(arg) + + def key(self): + return + + def length(self): + return + + def encode(self): + return + + def custom_function(self): + pass +``` + +where `BarArgument` is one of the **default classes**. Please note that a user +can define additional methods if needed (e.g. `custom_function`; also see +`generate_private_key` from `DacPKey` class). + +Then use this class in `generate.py` to create a `FooArgument` object from an +option: + +``` +parser.add_argument("--foo", required=True, type=FooArgument, + help="[int | hex] Foo argument.") +``` diff --git a/scripts/tools/silabs/factory_data_generator/custom.py b/scripts/tools/silabs/factory_data_generator/custom.py new file mode 100644 index 00000000000000..a06d61ca3f8568 --- /dev/null +++ b/scripts/tools/silabs/factory_data_generator/custom.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2022 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. +# + +'''This file should contain custom classes derived any class from default.py. + +Each class implemented here should describe an input parameter and should +implement the InputArgument abstract interface, if its base class does not +already offer an implementation or if there is a need of a custom behavior. + +Example of defining a new argument class: + + class FooArgument(IntArgument): + def __init__(self, arg): + super().__init__(arg) + + def key(self): + return + + def length(self): + return + + def encode(self): + return + + def custom_function(self): + pass + +Then use this class in generate.py to create a FooArgument object from an +option: + + parser.add_argument("--foo", required=True, type=FooArgument, + help="[int | hex] Foo argument.") +''' + +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives.serialization import load_der_private_key +from default import FileArgument + + +class DacPKey(FileArgument): + + def __init__(self, arg): + super().__init__(arg) + self.private_key = None + + def key(self): + return 1 + + def length(self): + assert (self.private_key is not None) + return len(self.private_key) + + def encode(self): + assert (self.private_key is not None) + return self.private_key + + def generate_private_key(self, password, use_sss_blob=True): + if use_sss_blob: + self.private_key = self.val + else: + keys = load_der_private_key(self.val, password, backend=default_backend()) + self.private_key = keys.private_numbers().private_value.to_bytes( + 32, byteorder='big' + ) + + +class DacCert(FileArgument): + + def __init__(self, arg): + super().__init__(arg) + + def key(self): + return 2 + + +class PaiCert(FileArgument): + + def __init__(self, arg): + super().__init__(arg) + + def key(self): + return 3 + + +class CertDeclaration(FileArgument): + + def __init__(self, arg): + super().__init__(arg) + + def key(self): + return 4 diff --git a/scripts/tools/silabs/factory_data_generator/default.py b/scripts/tools/silabs/factory_data_generator/default.py new file mode 100644 index 00000000000000..13dc0866aaed40 --- /dev/null +++ b/scripts/tools/silabs/factory_data_generator/default.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2022 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. +# +'''This file should contain default argument classes. + +Base class is InputArgument. It defines the abstract interface to be +implemented and offers a way to compute a KLV value through output(). +Other classes that derive InputArgument directly will be referenced +as default classes throughout the docstrings. + +The default classes should not be used to instantiate arguments. +If one wants to add another argument, a custom class should be derived +from one of the default classes. +''' + +import base64 +import logging + + +class InputArgument: + '''Base class for any input argument that will be added to KLV. + + The user will define its arguments as instances of InputArgument + by setting the "type" attribute of ArgumentParser add_argument to + an instance of a derived class. This means that all derived classes + must accept an additional "arg" parameter in the constructor. In the + end, the list of arguments will be parsed into objects derived from + InputArgument (or default derived classes), which decouples the object + creation from its processing. + + Abstract methods: + key: Should be overwritten by final classes to return a "magic number". + length: Can be overwritten by default classes to specify a default value + (e.g. int arguments with a default length value of 4); can also + be overwritten by final classes to specify a custom value for a + certain argument. + encode: Should be overwritten to generate the correct bytes array from + its internal value. + + Main usage is to iterate over an iterable entity of InputArguments and call + the output() method to generate the (K, L, V) tuple. Note that the output() + method should not be implemented, since its a common functionality across + all InputArgument classes. + ''' + + def __init__(self): + self.val = None + + def key(self): + logging.error("key() should be implemented in derived classes.") + + def length(self): + logging.error("length() should be implemented in derived classes.") + + def encode(self): + logging.error("encode() should be implemented in derived classes.") + + def output(self): + out = (self.key(), self.length(), self.encode()) + logging.info("'{}' length: {}".format(type(self).__name__, self.length())) + return out + + +class IntArgument(InputArgument): + + def __init__(self, arg): + super().__init__() + self.val = int(arg, 0) + + def length(self): + return 4 + + def encode(self): + return self.val.to_bytes(self.length(), "little") + + +class Base64Argument(InputArgument): + + def __init__(self, arg): + super().__init__() + self.val = base64.b64decode(arg) + + def length(self): + return len(self.encode()) + + def encode(self): + return base64.b64encode(self.val) + + +class StrArgument(InputArgument): + + def __init__(self, arg): + super().__init__() + self.val = str(arg) + + def length(self): + return len(self.encode()) + + def encode(self): + return str.encode(self.val) + + def max_length(self): + return 32 + + +class FileArgument(InputArgument): + + def __init__(self, arg): + super().__init__() + with open(arg, "rb") as _file: + self.val = _file.read() + + def length(self): + return len(self.val) + + def encode(self): + return self.val diff --git a/scripts/tools/silabs/ota/README.md b/scripts/tools/silabs/ota/README.md index d0c1bd39e068cd..0629d8650c1e8a 100644 --- a/scripts/tools/silabs/ota/README.md +++ b/scripts/tools/silabs/ota/README.md @@ -25,8 +25,7 @@ python3 ./scripts/tools/silabs/ota/ota_multi_image_tool.py create -v 0xDEAD -p 0 ``` followed by \*_custom options_- and a positional argument (should be last) that -specifies the output file. Please see the `create_ota_images.sh` for some -reference commands. +specifies the output file. The list of **custom options**: @@ -38,12 +37,6 @@ The list of **custom options**: --app-version-str --> Application version string. Same as above. --app-build-date --> Application build date. Same as above. -# SSBL options ---bl-input-file --> Path to the SSBL binary. ---bl-version --> SSBL version. ---bl-version-str --> SSBL version string. ---bl-build-date --> SSBL build date. - # Factory data options --factory-data --> If set, enables the generation of factory data. --cert_declaration --> Certification Declaration. @@ -51,6 +44,10 @@ The list of **custom options**: --dac_key --> DAC private key. --pai_cert --> PAI certificate. +# Encryption options +--enc_enable --> Enable ota encryption +--input_ota_key --> 16 Byte AES key + # Custom TLV options --json --> Path to a JSON file following ota_payload.schema ``` @@ -67,5 +64,5 @@ processing. When defining a custom processor, a user is able to also specify the custom format of the TLV by creating a JSON file based on the `ota_payload.schema`. The tool offers support for describing multiple TLV in the same JSON file. Please -see the `examples/ota_max_entries_example.json` for a multi-app + SSBL example. +see the `examples/ota_custom_entries_example.json` for a multi-binary example. Option `--json` must be used to specify the path to the JSON file. diff --git a/scripts/tools/silabs/ota/examples/binaries/ext_flash_ota_entry_example.bin b/scripts/tools/silabs/ota/examples/binaries/ext_flash_ota_entry_example.bin new file mode 100755 index 0000000000000000000000000000000000000000..5800a9860f70aae4d8f235a4371b31c6b77a498f GIT binary patch literal 7056 zcmcIod011|w%;e`Bsn1Tih2}w8sqK!ibrz$w~LA6(|UaMZKL{W=X zD;ft(E)Lb+GKdU{6}gB?ty66if)%wY)@zR#TTd9wVUWCau-<#$_r1T~_q_wZ>~Za3 z?KSMRTjpWJdJLgTKsbTW2}tVz)qtbsz8=A9T|r6^LWQL>k9`Amuf7_{*8(a9Km(`- zd;_Qf)B@@N^?>t$2EawYCBPNHHNbVij{rNs0k{FU3AhEg1Go#g4|o802zUfw0IdKg z;5WcCfD6zL=mfX{U4S0I3xEfJ;RxY?SDz5_Vt@o71^57b0e%2~Kpq_SyM7ujVms4rr0op z|A{cekfjc;B3)r1*c_rjuZ|3~hZ^G4gv!q@Q2N?$aO61uN=5(NMz%!}lGebHqYxX^ zRo;$FeN2!+O%>=7E9)9$7?iqIBXJB$MbuV}%z;=@*Zfl$d!W0IakQf3f=ur?B+u78 zz4iAQ$EOgnUCeZjoIRZ*CL#H5&7)gIP}j}$vyQ^lg#!>yAUG)aI%$Mcu*Y$L6ac^H zipT7{M>L7ZdW_=t_V3;Q|L4Y5qc9rrGaHKf%{GA!rK9O{dPF^Dl(bEcln-sfPPD?wEEH)d3CVi1ozLV zU;{GaooG2`c2r@iAp1ZsEMkyNP$F>V;=t`mgi9?#;k&udVqU0x>`j~r^SBEqz*xY1r^zKXbMK4#~?`eB#5B?Op_Xc zjh8a4g_pPWSzdXD=cNlQ8f5EZ1TpI~s8B2&&gV?F9wblG2vUc$Vw_M(n(sfx+2J@j zd^l?4HpcoH9Ng(>zclEjb#SIQN2a2qWkCoL;;m)t7ic@MI7hm%W0=Ch*%EGx#W#eh zX-gW~Xi8%h1q({5VGVR1H4zG-%yKhN<)@K+}kuDbte}Yy^|Y7g%FK|pyS*? zyrV_ouieQ-QQ9Yh1v|MnsA)n$M>>omNXyM|WZe<>-hdUWNj0zE0cm^sK|j`{3Fq>*LO^);_@&oL_YX-%=&jVyh(t*3l9w)h4aJ0=aX3QtkTH zsY0wH9g}LO^W1>3WhvvTWs?rMNTJ7l-SaTZBI>=N`l~=CvEeE&8>aHASFBx-b*Ji% z`1hu9bw@t8R&_D*wV`VjYeNW_4R+vSl(0U2ERe6H``kiPuu({pE*T1-2Y`%y=~2@n zm+8H;=@duJ^SCXZa2Cf8ixoOKP1?*F^42tt2w9!c#k@?-n(pRE9Xa`LAjuwgxd%>S zdTBbyXwnSEpTkrUD_jh!=Xt`?EbUwjg$!3A2hyX3{d=8Yw@tOI;Al5rs}lwv_hMp zc(e{FELCaAVh5t66~Lh#a+)9S4&w)>Ap~G?zcXlfC5`r;pbNPv(U_{t7HCDPa$9hw zxPP5E^?;e1{Pfm!4w-V8&estBaR9>o1|qx|Ag(sD$Qx6DB}*Wz9=G0uSA4(`J>qK2 zEKndbU-#x8b!_#!Z^y6NRDmMZ?3X59OTFaRTQOZ3=dEtws89!&?;osffZs`}4csA( zu>-xUZu^>owrS)-b=x;o%EG*bmlu+YQWiCE>S=ucP!`8{3O=9oANf$$l*HE?J4_is zKM*SdiqKFRv7dO1&ppe_I3n6tQO1d)p$C-6=rYbLI?Ave)*_SN&bXar2R)5U8=M|7 znJ+uDZbNxwipL$)=ghK#rVXF8G>ZUD@wk2a!VDwW9Q{E}fK6^Vs2OQ9vYvR4JE||l zFbq7fX__V7v|zyCx|ezYFuo?Bg8f=BA|Y8hH3>0 zyT_Dn=m9&bS`i60e1EdqpBB(Tz>lYWh$8D`)f>e56&Ov})bdQIebARh zOVg%j@|MiYAWb8OP2mWmmLm*iO_yC{7!os;BYdGO<;$`PSsmyd3-%762IMZ`HCw#I zUzfYk5v*1T!JY)r<8-TWU(E_kndpKP*QUw~k>;2>d<%81& zicQdR$)zSWbPTMhpifDw6Flw`PXbtj5j1!@GBK*iDMsGShb2qdM1i0O1G^-0uJ=%=N|^IfjP6vX1bZFY})NiXT5NK^9D#-#?OJiZwEMi=PcvYyixXnwIT zHpCYd=mq&m`Lms;;^&Bi@d+o1QB)Dw2Ae(JG9ShjsII}d&G~0QQ!)FbiTrFEnz#4eRt;eo&KdPXx;NeoAA9S2n+<&9J6K zgGI9e+SZj!rTIM|Wn#ygaJ6$>=$faXCkXiGm$PREjRUW0vHCK4>b{01&e zE@pkD>Nd=O1nVm4+*n#q5LeG1Y@+ncT-Iz{Y{i{H_nQ5l70K z_966D<|TDY^DLSuriwi7Z~Bn(mc5B7glk9N=Gy-%lp{PY zL3kl|k-{Q`cBC4U29g*$Fw`$yb_`R2h6-R67)1xv2ZU4Mh@JK#+A=mGshKLKK-yAY zL|bDEO!8meIR{!@+|#mvf;GL<7X~^6zW#vT(BRsN`=J)j1=tT?16@9^txj5j}uwl&+}K@NTGc|nt7|92o}VI%bI+=>@SiQncW{dKTg0*k=9t4l;#SEGoDw?}}4l9d=xC@kSX zt6GIr6Kr8ni!>U?$4+xQF%)Fc6km>1UYPqANE93WY_L zErnU}eQ%|oXA~9*zA?uTxkB>;0@=+qwt4(3oztU?Po|Gp%HrfX zw%kGCrCg)`pS*&>ir&dv*QMXx4bB2oce~_|ZFp~R* zO=|OeYGg|W7};9Tc0$rqLqw?ALnd-RX*tzDqDGE6_Gko+wN<1UDa7Wxtzv~)qx@NF zRa8zghzbhyzSf|0p*0uyGrMXhbD}fFxV!#p5a#q2oZ}uF^XiXurf4^CsHLDDDb~YX zW9pD|U_EVIOVl)R&ka76v!viWGukj5xbD->_02tE>l^`2X9MSj)>nLwH247DMb=Si zLBYO?3*6&Gfx?llmBWT=lb%=gbMYuo*CL%Tn&Wfv|uddxo^G!7&K zQ>xpnCZEn-8Q34C-KLY=gjn7;>@`_IM};&}s@W~31&cA2x^0tbAJpwLDB%{nxBq5Z zpkG)llb;0p`F?j(>uI><%~dqDo`EzS(zB4xS8O-T*>k;h)@Y2{3e-G&I!~@a3gPY% zw2{R~!n~9<&H9GhnDM;wCTE%|bkf6>5LI}_!`+=j%4N2F5KH!{l5Htqua-lN+P229 zKl#mO4Ly+-M`-RMMK17(Fq1BfJnfSBie04mCp%$XaAKnzg$9D<+}6FDdn0>|SnYbc zzKK)j*MJ8>?62!`CcCd97ju5tPL&TB^Dz<(r!Ti{R82=;P3 zu16$jl0>W7f$L}Y-+hr1v6>BijFsNYoZztWZX%{!R2KT=4goDMR2DI<_ORo zq-1T?8u5O-xiVSQT&-!fV{eI^Nuk>{|7^q*g^bXZtvvw|kG=6d-6=?~Hzv^&Xz|D$ zKR0rDF;(0)40mPIe2b*9P=hz`Pkz`8sU3H!6@{9+4lIU@W#B$DryD8v+(zN`EyXUG zmrOpDmH-DN-QJcc@Zr1dQme>Z#|2GM4YMSF;V5=_V-a*}h>t7YYYg=3>`J03`4sS2 zZCzpDTSn4jz_*w{4stqHm3vukb12%P$>~^DKBiQq3onAGEpj_|lk(>T3EP2Bqf2K7 z&zfDvHBnmzBld@`LTDRP+=%#7xWt#Ddun)2X1Bn7@Q*lp&)W#+?eBla4!pn3g7_f= zVhPV(395_&Uu=9Q$!|Ww-x7~#Is!NGFw+?Gd-Rx6%h=f&f7+|~F(?&LsBMb?AVN)@j<2p8#tmWScq!^DeR~Z?HEye*@%vI*d_T0+< zd5Xv36hnF?(TN?(<4Eyst5@7yhA_`zAQn9>w1AzS4sS)FD3re)V%-?@`%8ITX4~qr zU0B>$`*KDzB(Xz!e1O4M-oQPM@-f(25m-L{g_5u|aJxsrE9D1Y(b0PD(aXC8A4~Bu z7B8c`tnzlc8s6qMtqz2jH#h?MTF#>f9pVEimMHAM6;C-l`kH?79h#hj;L(a}M~u_nO*l=>b`9>C*Q#8Ez}-m1lJ)TVH6g4X-UY4!$FFhC*?OGzhp1$M_jvjrun~3;o><|-g!~Wui(uJ&ioq}Z5wR~z#NwCj1ocNc z?T`L7kpAndm0`873i*Q}M}fb5`9R)Z&D)Y!?f+Z)>iK-)%-zqbLt`qxn*8JVo$sa} zJCGT>@zTt~5T(zjJ30gK_?lZ6apKP{-dn~urk1;Yd-BHTj_uF5Z2qx8t# z2RnRMo{1bwjW@mdVvXhF`+{W?w3kH^N8W28y?3ogsw~E!Re#>{;o5UMl0FE!_x;+B zYE>KArp9^UUj@#QMxQ!9>-{vzhZdh4b8X?E0SR}<-FSXs@GsW+E@H(_QAH)IZ8R*C zFE{^Pb~dia%*@S_J92mZ^zq*Jrgg_nyBhV=*`H6gth>2zZLC21{t?T}woR*kN&ar! z#ggYOy+iXhluUd-E9iir<>950^0_{_5?1z)yW;}i^=_L`KI++%@4t%h8vbz19eVNS zo43q3n*YUb?zmZ5x5KN7*Ss!WeK_p=>&q|v`ZT3=$~ZFN*UL+OOfk=VsCGyG>DeLG zI^D`;B?*OJu6md$`7711?bDBYw8y1Aa|fJqF2>*d!g0DHa!1UMzwe!$z3$l$`G1w< zjh}}ksgf4Qjs>$0ylSA4X_ zy>9B(N8djx`tU&Y+-+~icV^emdHda84&)?!d~i+9lZ>3ByWaoxPJHd)cEiV0@6frY aOX=pJ+=kw7SL#0dc~SP73%^%zf&UFmw4W~k literal 0 HcmV?d00001 diff --git a/scripts/tools/silabs/ota/examples/ota_custom_entries_example.json b/scripts/tools/silabs/ota/examples/ota_custom_entries_example.json new file mode 100644 index 00000000000000..8f679a266da9bd --- /dev/null +++ b/scripts/tools/silabs/ota/examples/ota_custom_entries_example.json @@ -0,0 +1,67 @@ +{ + "inputs": [ + { + "tag": 8, + "descriptor": [ + { + "name": "binary_version", + "length": 4, + "value": 1003 + }, + { + "name": "binary_version_str", + "length": 64, + "value": "TestVersion" + }, + { + "name": "build_date", + "length": 64, + "value": "2024-03-25" + } + ], + "path": "./binaries/ext_flash_ota_entry_example.bin" + }, + { + "tag": 9, + "descriptor": [ + { + "name": "binary_version", + "length": 4, + "value": 1004 + }, + { + "name": "binary_version_str", + "length": 64, + "value": "TestVersion2" + }, + { + "name": "build_date", + "length": 64, + "value": "2024-03-25" + } + ], + "path": "./binaries/ext_flash_ota_entry_example.bin" + }, + { + "tag": 10, + "descriptor": [ + { + "name": "binary_version", + "length": 4, + "value": 1005 + }, + { + "name": "binary_version_str", + "length": 64, + "value": "TestVersion3" + }, + { + "name": "build_date", + "length": 64, + "value": "2024-03-25" + } + ], + "path": "./binaries/ext_flash_ota_entry_example.bin" + } + ] +} diff --git a/scripts/tools/silabs/ota/examples/ota_custom_entries_example2.json b/scripts/tools/silabs/ota/examples/ota_custom_entries_example2.json new file mode 100644 index 00000000000000..3b910f2d163156 --- /dev/null +++ b/scripts/tools/silabs/ota/examples/ota_custom_entries_example2.json @@ -0,0 +1,88 @@ +{ + "inputs": [ + { + "tag": 8, + "descriptor": [ + { + "name": "binary_version", + "length": 4, + "value": 1003 + }, + { + "name": "binary_version_str", + "length": 64, + "value": "TestVersion" + }, + { + "name": "build_date", + "length": 64, + "value": "2024-03-25" + } + ], + "path": "./binaries/ext_flash_ota_entry_example.bin" + }, + { + "tag": 9, + "descriptor": [ + { + "name": "binary_version", + "length": 4, + "value": 1004 + }, + { + "name": "binary_version_str", + "length": 64, + "value": "TestVersion2" + }, + { + "name": "build_date", + "length": 64, + "value": "2024-03-25" + } + ], + "path": "./binaries/ext_flash_ota_entry_example.bin" + }, + { + "tag": 10, + "descriptor": [ + { + "name": "binary_version", + "length": 4, + "value": 1005 + }, + { + "name": "binary_version_str", + "length": 64, + "value": "TestVersion3" + }, + { + "name": "build_date", + "length": 64, + "value": "2024-03-25" + } + ], + "path": "./binaries/ext_flash_ota_entry_example.bin" + }, + { + "tag": 11, + "descriptor": [ + { + "name": "binary_version", + "length": 4, + "value": 1006 + }, + { + "name": "binary_version_str", + "length": 64, + "value": "TestVersion4" + }, + { + "name": "build_date", + "length": 64, + "value": "2024-03-25" + } + ], + "path": "./binaries/ext_flash_ota_entry_example.bin" + } + ] +} diff --git a/scripts/tools/silabs/ota/ota_multi_image_tool.py b/scripts/tools/silabs/ota/ota_multi_image_tool.py index 64715d784aeecd..280c80ea516a5d 100755 --- a/scripts/tools/silabs/ota/ota_multi_image_tool.py +++ b/scripts/tools/silabs/ota/ota_multi_image_tool.py @@ -50,7 +50,6 @@ from chip.tlv import TLVWriter # noqa: E402 isort:skip from custom import CertDeclaration, DacCert, DacPKey, PaiCert # noqa: E402 isort:skip from default import InputArgument # noqa: E402 isort:skip -from generate import set_logger # noqa: E402 isort:skip OTA_APP_TLV_TEMP = os.path.join(os.path.dirname(__file__), "ota_temp_app_tlv.bin") OTA_BOOTLOADER_TLV_TEMP = os.path.join(os.path.dirname(__file__), "ota_temp_ssbl_tlv.bin") @@ -65,6 +64,15 @@ class TAG: FACTORY_DATA = 3 +def set_logger(): + stdout_handler = logging.StreamHandler(stream=sys.stdout) + logging.basicConfig( + level=logging.DEBUG, + format='[%(levelname)s] %(message)s', + handlers=[stdout_handler] + ) + + def write_to_temp(path: str, payload: bytearray): with open(path, "wb") as _handle: _handle.write(payload) diff --git a/scripts/tools/silabs/ota/requirements.txt b/scripts/tools/silabs/ota/requirements.txt new file mode 100644 index 00000000000000..9d440c9c5b780b --- /dev/null +++ b/scripts/tools/silabs/ota/requirements.txt @@ -0,0 +1 @@ +jsonschema>=3.2.0 diff --git a/src/platform/silabs/efr32/BUILD.gn b/src/platform/silabs/efr32/BUILD.gn index 5d661886d54f21..a71a0cd8b335e6 100644 --- a/src/platform/silabs/efr32/BUILD.gn +++ b/src/platform/silabs/efr32/BUILD.gn @@ -78,14 +78,29 @@ static_library("efr32") { } if (chip_enable_multi_ota_requestor) { + if (chip_enable_multi_ota_encryption) { + sources += [ + "${silabs_platform_dir}/multi-ota/OtaTlvEncryptionKey.cpp", + "${silabs_platform_dir}/multi-ota/OtaTlvEncryptionKey.h", + ] + } + + if (chip_enable_ota_custom_tlv_testing) { + sources += [ + "${silabs_platform_dir}/multi-ota/OTACustomProcessor.cpp", + "${silabs_platform_dir}/multi-ota/OTACustomProcessor.h", + ] + } sources += [ + "${silabs_platform_dir}/multi-ota/OTAFactoryDataProcessor.cpp", + "${silabs_platform_dir}/multi-ota/OTAFactoryDataProcessor.h", + "${silabs_platform_dir}/multi-ota/OTAFirmwareProcessor.cpp", + "${silabs_platform_dir}/multi-ota/OTAFirmwareProcessor.h", + "${silabs_platform_dir}/multi-ota/OTAHooks.cpp", "${silabs_platform_dir}/multi-ota/OTAMultiImageProcessorImpl.cpp", "${silabs_platform_dir}/multi-ota/OTAMultiImageProcessorImpl.h", "${silabs_platform_dir}/multi-ota/OTATlvProcessor.cpp", "${silabs_platform_dir}/multi-ota/OTATlvProcessor.h", - "${silabs_platform_dir}/multi-ota/efr32/OTAFirmwareProcessor.cpp", - "${silabs_platform_dir}/multi-ota/efr32/OTAFirmwareProcessor.h", - "${silabs_platform_dir}/multi-ota/efr32/OTAHooks.cpp", ] } else if (chip_enable_ota_requestor) { sources += [ diff --git a/src/platform/silabs/efr32/efr32-psa-crypto-config.h b/src/platform/silabs/efr32/efr32-psa-crypto-config.h index b5564f88bd3258..b389431f85ec0b 100644 --- a/src/platform/silabs/efr32/efr32-psa-crypto-config.h +++ b/src/platform/silabs/efr32/efr32-psa-crypto-config.h @@ -30,5 +30,10 @@ #define PSA_WANT_ALG_CBC_NO_PADDING #endif // SL_USE_COAP_CONFIG +// Multi-chip OTA encryption processing +#if OTA_ENCRYPTION_ENABLE +#define PSA_WANT_ALG_CTR +#endif // OTA_ENCRYPTION_ENABLE + // Include Generated fies #include "psa_crypto_config.h" diff --git a/src/platform/silabs/multi-ota/OTACustomProcessor.cpp b/src/platform/silabs/multi-ota/OTACustomProcessor.cpp new file mode 100644 index 00000000000000..85ceb7d44d4eaf --- /dev/null +++ b/src/platform/silabs/multi-ota/OTACustomProcessor.cpp @@ -0,0 +1,94 @@ +/* + * + * 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 + +extern "C" { +#include "btl_interface.h" +#include "em_bus.h" // For CORE_CRITICAL_SECTION +#if SL_WIFI +#include "spi_multiplex.h" +#endif // SL_WIFI +} + +/// No error, operation OK +#define SL_BOOTLOADER_OK 0L + +namespace chip { + +// Define static memebers +uint8_t OTACustomProcessor::mSlotId = 0; +uint32_t OTACustomProcessor::mWriteOffset = 0; +uint16_t OTACustomProcessor::writeBufOffset = 0; +uint8_t OTACustomProcessor::writeBuffer[kAlignmentBytes] __attribute__((aligned(4))) = { 0 }; + +CHIP_ERROR OTACustomProcessor::Init() +{ + ReturnErrorCodeIf(mCallbackProcessDescriptor == nullptr, CHIP_OTA_PROCESSOR_CB_NOT_REGISTERED); + mAccumulator.Init(sizeof(Descriptor)); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTACustomProcessor::Clear() +{ + OTATlvProcessor::ClearInternal(); + mAccumulator.Clear(); + mDescriptorProcessed = false; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTACustomProcessor::ProcessInternal(ByteSpan & block) +{ + if (!mDescriptorProcessed) + { + ReturnErrorOnFailure(ProcessDescriptor(block)); + } + + ChipLogError(SoftwareUpdate, "Reached Custom Processor"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTACustomProcessor::ProcessDescriptor(ByteSpan & block) +{ + ReturnErrorOnFailure(mAccumulator.Accumulate(block)); + ReturnErrorOnFailure(mCallbackProcessDescriptor(static_cast(mAccumulator.data()))); + + mDescriptorProcessed = true; + mAccumulator.Clear(); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTACustomProcessor::ApplyAction() +{ + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTACustomProcessor::FinalizeAction() +{ + return CHIP_NO_ERROR; +} + +} // namespace chip diff --git a/src/platform/silabs/multi-ota/OTACustomProcessor.h b/src/platform/silabs/multi-ota/OTACustomProcessor.h new file mode 100644 index 00000000000000..64610f4b41fa37 --- /dev/null +++ b/src/platform/silabs/multi-ota/OTACustomProcessor.h @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +namespace chip { + +class OTACustomProcessor : public OTATlvProcessor +{ +public: + struct Descriptor + { + uint32_t version; + char versionString[kVersionStringSize]; + char buildDate[kBuildDateSize]; + }; + + CHIP_ERROR Init() override; + CHIP_ERROR Clear() override; + CHIP_ERROR ApplyAction() override; + CHIP_ERROR FinalizeAction() override; + +private: + CHIP_ERROR ProcessInternal(ByteSpan & block) override; + CHIP_ERROR ProcessDescriptor(ByteSpan & block); + + OTADataAccumulator mAccumulator; + bool mDescriptorProcessed = false; + static constexpr size_t kAlignmentBytes = 64; + static uint32_t mWriteOffset; // End of last written block + static uint8_t mSlotId; // Bootloader storage slot + // Bootloader storage API requires the buffer size to be a multiple of 4. + static uint8_t writeBuffer[kAlignmentBytes] __attribute__((aligned(4))); + // Offset indicates how far the write buffer has been filled + static uint16_t writeBufOffset; +}; + +} // namespace chip diff --git a/src/platform/silabs/multi-ota/OTAFactoryDataProcessor.cpp b/src/platform/silabs/multi-ota/OTAFactoryDataProcessor.cpp new file mode 100644 index 00000000000000..8d38207df35542 --- /dev/null +++ b/src/platform/silabs/multi-ota/OTAFactoryDataProcessor.cpp @@ -0,0 +1,170 @@ +/* + * + * 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 + +namespace chip { + +using FactoryProvider = DeviceLayer::Silabs::Provision::Storage; + +CHIP_ERROR OTAFactoryDataProcessor::Init() +{ + mAccumulator.Init(mLength); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAFactoryDataProcessor::Clear() +{ + OTATlvProcessor::ClearInternal(); + mAccumulator.Clear(); + mPayload.Clear(); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAFactoryDataProcessor::ProcessInternal(ByteSpan & block) +{ + CHIP_ERROR error = CHIP_NO_ERROR; + + ReturnErrorOnFailure(mAccumulator.Accumulate(block)); +#if OTA_ENCRYPTION_ENABLE + MutableByteSpan mBlock = MutableByteSpan(mAccumulator.data(), mAccumulator.GetThreshold()); + OTATlvProcessor::vOtaProcessInternalEncryption(mBlock); +#endif + error = DecodeTlv(); + + if (error != CHIP_NO_ERROR) + { + // The factory data payload can contain a variable number of fields + // to be updated. CHIP_END_OF_TLV is returned if no more fields are + // found. + if (error == CHIP_END_OF_TLV) + { + return CHIP_NO_ERROR; + } + + Clear(); + } + + return error; +} + +CHIP_ERROR OTAFactoryDataProcessor::ApplyAction() +{ + CHIP_ERROR error = CHIP_NO_ERROR; + + SuccessOrExit(error = Update((uint8_t) FactoryTags::kDacKey, mPayload.mCertDacKey)); + SuccessOrExit(error = Update((uint8_t) FactoryTags::kDacCert, mPayload.mCertDac)); + SuccessOrExit(error = Update((uint8_t) FactoryTags::kPaiCert, mPayload.mCertPai)); + SuccessOrExit(error = Update((uint8_t) FactoryTags::kCdCert, mPayload.mCertDeclaration)); + +exit: + if (error != CHIP_NO_ERROR) + { + ChipLogError(SoftwareUpdate, "Failed to update factory data. Error: %s", ErrorStr(error)); + } + else + { + ChipLogProgress(SoftwareUpdate, "Factory data update finished."); + } + + return error; +} + +CHIP_ERROR OTAFactoryDataProcessor::FinalizeAction() +{ + ChipLogProgress(SoftwareUpdate, "Finalize Action\n"); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAFactoryDataProcessor::DecodeTlv() +{ + TLV::TLVReader tlvReader; + tlvReader.Init(mAccumulator.data(), mLength); + ReturnErrorOnFailure(tlvReader.Next(TLV::TLVType::kTLVType_Structure, TLV::AnonymousTag())); + + TLV::TLVType outerType; + ReturnErrorOnFailure(tlvReader.EnterContainer(outerType)); + ReturnErrorOnFailure(tlvReader.Next()); + + if (tlvReader.GetTag() == TLV::ContextTag((uint8_t) FactoryTags::kDacKey)) + { + ReturnErrorOnFailure(tlvReader.Get(mPayload.mCertDacKey.Emplace())); + ReturnErrorOnFailure(tlvReader.Next()); + } + + if (tlvReader.GetTag() == TLV::ContextTag((uint8_t) FactoryTags::kDacCert)) + { + ReturnErrorOnFailure(tlvReader.Get(mPayload.mCertDac.Emplace())); + ReturnErrorOnFailure(tlvReader.Next()); + } + + if (tlvReader.GetTag() == TLV::ContextTag((uint8_t) FactoryTags::kPaiCert)) + { + ReturnErrorOnFailure(tlvReader.Get(mPayload.mCertPai.Emplace())); + ReturnErrorOnFailure(tlvReader.Next()); + } + + if (tlvReader.GetTag() == TLV::ContextTag((uint8_t) FactoryTags::kCdCert)) + { + ReturnErrorOnFailure(tlvReader.Get(mPayload.mCertDeclaration.Emplace())); + } + + ReturnErrorOnFailure(tlvReader.ExitContainer(outerType)); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAFactoryDataProcessor::Update(uint8_t tag, Optional & optional) +{ + CHIP_ERROR error = CHIP_NO_ERROR; + if (optional.HasValue()) + { + error = UpdateValue(tag, optional.Value()); + } + + return error; +} + +CHIP_ERROR OTAFactoryDataProcessor::UpdateValue(uint8_t tag, ByteSpan & newValue) +{ + FactoryProvider factoryProvider; + switch (tag) + { + case (int) FactoryTags::kDacKey: + ChipLogProgress(SoftwareUpdate, "Set Device Attestation Key"); + return factoryProvider.FactoryProvider::SetDeviceAttestationKey(newValue); + case (int) FactoryTags::kDacCert: + ChipLogProgress(SoftwareUpdate, "Set Device Attestation Cert"); + return factoryProvider.FactoryProvider::SetDeviceAttestationCert(newValue); + case (int) FactoryTags::kPaiCert: + ChipLogProgress(SoftwareUpdate, "Set Product Attestionation Intermediate Cert"); + return factoryProvider.FactoryProvider::SetProductAttestationIntermediateCert(newValue); + case (int) FactoryTags::kCdCert: + ChipLogProgress(SoftwareUpdate, "Set Certification Declaration"); + return factoryProvider.FactoryProvider::SetCertificationDeclaration(newValue); + } + + ChipLogError(DeviceLayer, "Failed to find tag %d.", tag); + return CHIP_ERROR_NOT_FOUND; +} + +} // namespace chip diff --git a/src/platform/silabs/multi-ota/OTAFactoryDataProcessor.h b/src/platform/silabs/multi-ota/OTAFactoryDataProcessor.h new file mode 100644 index 00000000000000..f7fd106de17220 --- /dev/null +++ b/src/platform/silabs/multi-ota/OTAFactoryDataProcessor.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 +#include +#include +#include +#include // nogncheck +#include // nogncheck + +namespace chip { + +/** + * OTA custom payload that uses Matter TLVs. + * The custom payload is used when factory data needs updating. + * Factory data will be encoded using Matter TLV format to make + * use of the ChipTlv reader. A payload contains metadata (size of + * TLVs) and the TLVs themselves contained in a structure. + * If no factory data need to be updated, the metadata will be 0 + */ +struct OTAFactoryPayload +{ + Optional mCertDacKey; + Optional mCertDac; + Optional mCertPai; + Optional mCertDeclaration; + + void Clear() + { + mCertDacKey.ClearValue(); + mCertDac.ClearValue(); + mCertPai.ClearValue(); + mCertDeclaration.ClearValue(); + } +}; + +enum class FactoryTags +{ + kDacKey = 1, + kDacCert = 2, + kPaiCert = 3, + kCdCert = 4 +}; + +class OTAFactoryDataProcessor : public OTATlvProcessor +{ +public: + CHIP_ERROR Init() override; + CHIP_ERROR Clear() override; + CHIP_ERROR ApplyAction() override; + CHIP_ERROR FinalizeAction() override; + +private: + CHIP_ERROR ProcessInternal(ByteSpan & block) override; + CHIP_ERROR DecodeTlv(); + CHIP_ERROR Update(uint8_t tag, Optional & optional); + CHIP_ERROR UpdateValue(uint8_t tag, ByteSpan & newValue); + + OTAFactoryPayload mPayload; + OTADataAccumulator mAccumulator; + uint8_t * mFactoryData = nullptr; +}; + +} // namespace chip diff --git a/src/platform/silabs/multi-ota/efr32/OTAFirmwareProcessor.cpp b/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp similarity index 84% rename from src/platform/silabs/multi-ota/efr32/OTAFirmwareProcessor.cpp rename to src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp index fdf4c3d0321262..3fc66e53913b87 100644 --- a/src/platform/silabs/multi-ota/efr32/OTAFirmwareProcessor.cpp +++ b/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp @@ -17,8 +17,8 @@ */ #include +#include #include -#include #include @@ -32,8 +32,6 @@ extern "C" { /// No error, operation OK #define SL_BOOTLOADER_OK 0L -// TODO: more descriptive error codes -#define SL_OTA_ERROR 1L namespace chip { @@ -72,7 +70,33 @@ CHIP_ERROR OTAFirmwareProcessor::ProcessInternal(ByteSpan & block) if (!mDescriptorProcessed) { ReturnErrorOnFailure(ProcessDescriptor(block)); +#if OTA_ENCRYPTION_ENABLE + /* 16 bytes to used to store undecrypted data because of unalignment */ + mAccumulator.Init(requestedOtaMaxBlockSize + 16); +#endif + } +#if OTA_ENCRYPTION_ENABLE + MutableByteSpan mBlock = MutableByteSpan(mAccumulator.data(), mAccumulator.GetThreshold()); + memcpy(&mBlock[0], &mBlock[requestedOtaMaxBlockSize], mUnalignmentNum); + memcpy(&mBlock[mUnalignmentNum], block.data(), block.size()); + + if (mUnalignmentNum + block.size() < requestedOtaMaxBlockSize) + { + uint32_t mAlignmentNum = (mUnalignmentNum + block.size()) / 16; + mAlignmentNum = mAlignmentNum * 16; + mUnalignmentNum = (mUnalignmentNum + block.size()) % 16; + memcpy(&mBlock[requestedOtaMaxBlockSize], &mBlock[mAlignmentNum], mUnalignmentNum); + mBlock.reduce_size(mAlignmentNum); } + else + { + mUnalignmentNum = mUnalignmentNum + block.size() - requestedOtaMaxBlockSize; + mBlock.reduce_size(requestedOtaMaxBlockSize); + } + + OTATlvProcessor::vOtaProcessInternalEncryption(mBlock); + block = mBlock; +#endif uint32_t blockReadOffset = 0; while (blockReadOffset < block.size()) @@ -88,7 +112,7 @@ CHIP_ERROR OTAFirmwareProcessor::ProcessInternal(ByteSpan & block) if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_pre_bootloader_spi_transfer() error: %ld", err); - return; + return CHIP_ERROR_CANCELLED; } #endif // SL_BTLCTRL_MUX CORE_CRITICAL_SECTION(err = bootloader_eraseWriteStorage(mSlotId, mWriteOffset, writeBuffer, kAlignmentBytes);) @@ -97,15 +121,12 @@ CHIP_ERROR OTAFirmwareProcessor::ProcessInternal(ByteSpan & block) if (err != SL_STATUS_OK) { ChipLogError(SoftwareUpdate, "sl_wfx_host_post_bootloader_spi_transfer() error: %ld", err); - return; + return CHIP_ERROR_CANCELLED; } #endif // SL_BTLCTRL_MUX if (err) { ChipLogError(SoftwareUpdate, "bootloader_eraseWriteStorage() error: %ld", err); - // TODO: add this somewhere - // imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED); - // TODO: Replace CHIP_ERROR_CANCELLED with new error statement return CHIP_ERROR_CANCELLED; } mWriteOffset += kAlignmentBytes; diff --git a/src/platform/silabs/multi-ota/efr32/OTAFirmwareProcessor.h b/src/platform/silabs/multi-ota/OTAFirmwareProcessor.h similarity index 100% rename from src/platform/silabs/multi-ota/efr32/OTAFirmwareProcessor.h rename to src/platform/silabs/multi-ota/OTAFirmwareProcessor.h diff --git a/src/platform/silabs/multi-ota/efr32/OTAHooks.cpp b/src/platform/silabs/multi-ota/OTAHooks.cpp similarity index 52% rename from src/platform/silabs/multi-ota/efr32/OTAHooks.cpp rename to src/platform/silabs/multi-ota/OTAHooks.cpp index cddb66980c27f9..6be17441be473f 100644 --- a/src/platform/silabs/multi-ota/efr32/OTAHooks.cpp +++ b/src/platform/silabs/multi-ota/OTAHooks.cpp @@ -21,7 +21,12 @@ #include -#include +#include +#include + +#if OTA_TEST_CUSTOM_TLVS +#include +#endif CHIP_ERROR chip::OTAMultiImageProcessorImpl::ProcessDescriptor(void * descriptor) { @@ -34,11 +39,29 @@ CHIP_ERROR chip::OTAMultiImageProcessorImpl::ProcessDescriptor(void * descriptor CHIP_ERROR chip::OTAMultiImageProcessorImpl::OtaHookInit() { static chip::OTAFirmwareProcessor sApplicationProcessor; + static chip::OTAFactoryDataProcessor sFactoryDataProcessor; sApplicationProcessor.RegisterDescriptorCallback(ProcessDescriptor); + sFactoryDataProcessor.RegisterDescriptorCallback(ProcessDescriptor); auto & imageProcessor = chip::OTAMultiImageProcessorImpl::GetDefaultInstance(); - ReturnErrorOnFailure(imageProcessor.RegisterProcessor(1, &sApplicationProcessor)); + ReturnErrorOnFailure( + imageProcessor.RegisterProcessor(static_cast(OTAProcessorTag::kApplicationProcessor), &sApplicationProcessor)); + ReturnErrorOnFailure( + imageProcessor.RegisterProcessor(static_cast(OTAProcessorTag::kFactoryDataProcessor), &sFactoryDataProcessor)); + +#if OTA_TEST_CUSTOM_TLVS + static chip::OTACustomProcessor customProcessor1; + static chip::OTACustomProcessor customProcessor2; + static chip::OTACustomProcessor customProcessor3; + + customProcessor1.RegisterDescriptorCallback(ProcessDescriptor); + customProcessor2.RegisterDescriptorCallback(ProcessDescriptor); + customProcessor3.RegisterDescriptorCallback(ProcessDescriptor); + ReturnErrorOnFailure(imageProcessor.RegisterProcessor(8, &customProcessor1)); + ReturnErrorOnFailure(imageProcessor.RegisterProcessor(9, &customProcessor2)); + ReturnErrorOnFailure(imageProcessor.RegisterProcessor(10, &customProcessor3)); +#endif return CHIP_NO_ERROR; } diff --git a/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp b/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp index 147dcdaf8317ee..9dfb42fc879c4b 100644 --- a/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp +++ b/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp @@ -420,9 +420,6 @@ void OTAMultiImageProcessorImpl::HandleApply(intptr_t context) ChipLogProgress(SoftwareUpdate, "HandleApply: Finished"); - // TODO: check where to put this - // ConfigurationManagerImpl().StoreSoftwareUpdateCompleted(); - // This reboots the device CORE_CRITICAL_SECTION(bootloader_rebootAndInstall();) } diff --git a/src/platform/silabs/multi-ota/OTATlvProcessor.cpp b/src/platform/silabs/multi-ota/OTATlvProcessor.cpp index a5da7eaba00c10..91a748c077ec79 100644 --- a/src/platform/silabs/multi-ota/OTATlvProcessor.cpp +++ b/src/platform/silabs/multi-ota/OTATlvProcessor.cpp @@ -23,9 +23,12 @@ #include #include #if OTA_ENCRYPTION_ENABLE -#include "OtaUtils.h" -#include "rom_aes.h" +#include +#include #endif + +using namespace ::chip::DeviceLayer::Internal; + namespace chip { #if OTA_ENCRYPTION_ENABLE @@ -105,65 +108,10 @@ CHIP_ERROR OTADataAccumulator::Accumulate(ByteSpan & block) #if OTA_ENCRYPTION_ENABLE CHIP_ERROR OTATlvProcessor::vOtaProcessInternalEncryption(MutableByteSpan & block) { - uint8_t iv[16]; - uint8_t key[kOTAEncryptionKeyLength]; - uint8_t dataOut[16] = { 0 }; - uint32_t u32IVCount; - uint32_t Offset = 0; - uint8_t data; - tsReg128 sKey; - aesContext_t Context; - - memcpy(iv, au8Iv, sizeof(au8Iv)); - - u32IVCount = (((uint32_t) iv[12]) << 24) | (((uint32_t) iv[13]) << 16) | (((uint32_t) iv[14]) << 8) | (iv[15]); - u32IVCount += (mIVOffset >> 4); - - iv[12] = (uint8_t) ((u32IVCount >> 24) & 0xff); - iv[13] = (uint8_t) ((u32IVCount >> 16) & 0xff); - iv[14] = (uint8_t) ((u32IVCount >> 8) & 0xff); - iv[15] = (uint8_t) (u32IVCount & 0xff); - - if (Encoding::HexToBytes(OTA_ENCRYPTION_KEY, strlen(OTA_ENCRYPTION_KEY), key, kOTAEncryptionKeyLength) != - kOTAEncryptionKeyLength) - { - // Failed to convert the OTAEncryptionKey string to octstr type value - return CHIP_ERROR_INVALID_STRING_LENGTH; - } - - ByteSpan KEY = ByteSpan(key); - Encoding::LittleEndian::Reader reader_key(KEY.data(), KEY.size()); - ReturnErrorOnFailure(reader_key.Read32(&sKey.u32register0) - .Read32(&sKey.u32register1) - .Read32(&sKey.u32register2) - .Read32(&sKey.u32register3) - .StatusCode()); - - while (Offset + 16 <= block.size()) - { - /*Encrypt the IV*/ - Context.mode = AES_MODE_ECB_ENCRYPT; - Context.pSoftwareKey = (uint32_t *) &sKey; - AES_128_ProcessBlocks(&Context, (uint32_t *) &iv[0], (uint32_t *) &dataOut[0], 1); - - /* Decrypt a block of the buffer */ - for (uint8_t i = 0; i < 16; i++) - { - data = block[Offset + i] ^ dataOut[i]; - memcpy(&block[Offset + i], &data, sizeof(uint8_t)); - } - - /* increment the IV for the next block */ - u32IVCount++; - - iv[12] = (uint8_t) ((u32IVCount >> 24) & 0xff); - iv[13] = (uint8_t) ((u32IVCount >> 16) & 0xff); - iv[14] = (uint8_t) ((u32IVCount >> 8) & 0xff); - iv[15] = (uint8_t) (u32IVCount & 0xff); - - Offset += 16; /* increment the buffer offset */ - mIVOffset += 16; - } + uint32_t keyId; + SilabsConfig::ReadConfigValue(SilabsConfig::kOtaTlvEncryption_KeyId, keyId); + chip::DeviceLayer::Silabs::OtaTlvEncryptionKey::OtaTlvEncryptionKey key(keyId); + key.Decrypt(block, mIVOffset); return CHIP_NO_ERROR; } diff --git a/src/platform/silabs/multi-ota/OTATlvProcessor.h b/src/platform/silabs/multi-ota/OTATlvProcessor.h index 9e8e56a2b35825..fe2070b75e5634 100644 --- a/src/platform/silabs/multi-ota/OTATlvProcessor.h +++ b/src/platform/silabs/multi-ota/OTATlvProcessor.h @@ -43,6 +43,8 @@ namespace chip { #define CHIP_OTA_PROCESSOR_START_IMAGE CHIP_ERROR_TLV_PROCESSOR(0x0E) #define SL_GENERIC_OTA_ERROR CHIP_ERROR_TLV_PROCESSOR(0x0E) +constexpr uint16_t requestedOtaMaxBlockSize = 1024; + // Descriptor constants inline constexpr size_t kVersionStringSize = 64; inline constexpr size_t kBuildDateSize = 64; @@ -60,6 +62,14 @@ struct OTATlvHeader uint32_t length; }; +// TLV tags synced with ota files generate by scripts/tools/silabs/ota/ota_image_tool.py +enum class OTAProcessorTag +{ + kApplicationProcessor = 1, + kBootloaderProcessor = 2, + kFactoryDataProcessor = 3 +}; + /** * This class defines an interface for a Matter TLV processor. * Instances of derived classes can be registered as processors diff --git a/src/platform/silabs/multi-ota/OtaTlvEncryptionKey.cpp b/src/platform/silabs/multi-ota/OtaTlvEncryptionKey.cpp new file mode 100644 index 00000000000000..10273e52f5a7a1 --- /dev/null +++ b/src/platform/silabs/multi-ota/OtaTlvEncryptionKey.cpp @@ -0,0 +1,130 @@ +#include "OtaTlvEncryptionKey.h" +#include +#include +#include +#include +#include + +namespace chip { +namespace DeviceLayer { +namespace Silabs { +namespace OtaTlvEncryptionKey { + +using SilabsConfig = chip::DeviceLayer::Internal::SilabsConfig; + +int destroyAESKey(uint32_t kid) +{ + psa_key_handle_t key_handle; + + int err = psa_open_key(kid, &key_handle); + if (err) + { + psa_close_key(kid); + } + else + { + err = psa_destroy_key(kid); + } + return err; +} + +CHIP_ERROR OtaTlvEncryptionKey::Import(const uint8_t * key, size_t key_len) +{ + destroyAESKey(mId); + + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + psa_status_t status; + + psa_key_id_t key_id; + psa_set_key_id(&attributes, mId); + psa_set_key_type(&attributes, PSA_KEY_TYPE_AES); + psa_set_key_bits(&attributes, 128); + psa_set_key_algorithm(&attributes, PSA_ALG_CTR); + psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT); + + status = psa_import_key(&attributes, key, key_len, &key_id); + if (status != PSA_SUCCESS) + { + printf("Failed to import a key error:%ld\n", status); + return CHIP_ERROR_INTERNAL; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR OtaTlvEncryptionKey::Decrypt(MutableByteSpan & block, uint32_t & mIVOffset) +{ + constexpr uint8_t au8Iv[] = { 0x00, 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x00, 0x00, 0x00, 0x00 }; + uint8_t iv[16]; + psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT; + psa_status_t status; + uint8_t output[PSA_BLOCK_CIPHER_BLOCK_LENGTH(PSA_KEY_TYPE_AES)]; + size_t output_len; + size_t total_output; + uint32_t u32IVCount; + uint32_t Offset = 0; + + memcpy(iv, au8Iv, sizeof(au8Iv)); + + u32IVCount = (((uint32_t) iv[12]) << 24) | (((uint32_t) iv[13]) << 16) | (((uint32_t) iv[14]) << 8) | (iv[15]); + u32IVCount += (mIVOffset >> 4); + + iv[12] = (uint8_t) ((u32IVCount >> 24) & 0xff); + iv[13] = (uint8_t) ((u32IVCount >> 16) & 0xff); + iv[14] = (uint8_t) ((u32IVCount >> 8) & 0xff); + iv[15] = (uint8_t) (u32IVCount & 0xff); + + while (Offset + 16 <= block.size()) + { + status = psa_cipher_decrypt_setup(&operation, static_cast(mId), PSA_ALG_CTR); + if (status != PSA_SUCCESS) + { + printf("Failed to begin cipher operation error:%ld\n", status); + return CHIP_ERROR_INTERNAL; + } + + status = psa_cipher_set_iv(&operation, iv, sizeof(iv)); + if (status != PSA_SUCCESS) + { + printf("Failed to set IV error:%ld\n", status); + return CHIP_ERROR_INTERNAL; + } + + status = psa_cipher_update(&operation, static_cast(&block[Offset]), 16, output, sizeof(output), &output_len); + if (status != PSA_SUCCESS) + { + printf("Failed to update cipher operation error:%ld\n", status); + return CHIP_ERROR_INTERNAL; + } + + /* increment the IV for the next block */ + u32IVCount++; + + iv[12] = (uint8_t) ((u32IVCount >> 24) & 0xff); + iv[13] = (uint8_t) ((u32IVCount >> 16) & 0xff); + iv[14] = (uint8_t) ((u32IVCount >> 8) & 0xff); + iv[15] = (uint8_t) (u32IVCount & 0xff); + + memcpy((void *) &block[Offset], &output, output_len); + + Offset += 16; /* increment the buffer offset */ + mIVOffset += 16; + status = psa_cipher_finish(&operation, output + total_output, sizeof(output) - total_output, &total_output); + if (status != PSA_SUCCESS) + { + printf("Failed to finish cipher operation\n"); + return CHIP_ERROR_INTERNAL; + } + } + + printf("Decrypted ciphertext\n"); + + psa_cipher_abort(&operation); + + return CHIP_NO_ERROR; +} + +} // namespace OtaTlvEncryptionKey +} // namespace Silabs +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/silabs/multi-ota/OtaTlvEncryptionKey.h b/src/platform/silabs/multi-ota/OtaTlvEncryptionKey.h new file mode 100644 index 00000000000000..919e3b1285ac80 --- /dev/null +++ b/src/platform/silabs/multi-ota/OtaTlvEncryptionKey.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace DeviceLayer { +namespace Silabs { +namespace OtaTlvEncryptionKey { + +static constexpr uint32_t kAES_KeyId_Default = (PSA_KEY_ID_USER_MIN + 2); + +class OtaTlvEncryptionKey +{ +public: + OtaTlvEncryptionKey(uint32_t id = 0) { mId = (id > 0) ? id : kAES_KeyId_Default; } + ~OtaTlvEncryptionKey() = default; + + uint32_t GetId() { return mId; } + CHIP_ERROR Import(const uint8_t * key, size_t key_len); + CHIP_ERROR Decrypt(MutableByteSpan & block, uint32_t & mIVOffset); + +protected: + uint32_t mId = 0; +}; + +} // namespace OtaTlvEncryptionKey +} // namespace Silabs +} // namespace DeviceLayer +} // namespace chip diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 08695af1fc3800..ccbae7f1ec23ff 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -80,6 +80,8 @@ declare_args() { # Multi-chip OTA chip_enable_multi_ota_requestor = false + chip_enable_multi_ota_encryption = false + chip_enable_ota_custom_tlv_testing = false } examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" @@ -496,6 +498,14 @@ template("efr32_sdk") { ] } + if (chip_enable_multi_ota_encryption && chip_enable_multi_ota_requestor) { + defines += [ "OTA_ENCRYPTION_ENABLE=1" ] + } + + if (chip_enable_ota_custom_tlv_testing && chip_enable_multi_ota_requestor) { + defines += [ "OTA_TEST_CUSTOM_TLVS=1" ] + } + if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) { if (enable_dic) { assert(chip_enable_wifi_ipv4, "enable chip_enable_wifi_ipv4") From eb59fc31aef9ba70b4ca5ddd9265a1aad089824b Mon Sep 17 00:00:00 2001 From: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:41:18 -0700 Subject: [PATCH 49/63] Add python tests for Thermostat presets feature (#34693) * Add python tests for Thermostat presets feature * Restyled by autopep8 * Restyled by isort * Update the PICS code for presets attribute --------- Co-authored-by: Restyled.io --- src/python_testing/TC_TSTAT_4_2.py | 348 +++++++++++++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 src/python_testing/TC_TSTAT_4_2.py diff --git a/src/python_testing/TC_TSTAT_4_2.py b/src/python_testing/TC_TSTAT_4_2.py new file mode 100644 index 00000000000000..5f53debfa024a0 --- /dev/null +++ b/src/python_testing/TC_TSTAT_4_2.py @@ -0,0 +1,348 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import copy +import logging + +import chip.clusters as Clusters +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__) + +cluster = Clusters.Thermostat + + +initial_presets = [] +initial_presets.append(cluster.Structs.PresetStruct(presetHandle=b'\x01', presetScenario=cluster.Enums.PresetScenarioEnum.kOccupied, + name=None, coolingSetpoint=2500, heatingSetpoint=2100, builtIn=True)) +initial_presets.append(cluster.Structs.PresetStruct(presetHandle=b'\x02', presetScenario=cluster.Enums.PresetScenarioEnum.kUnoccupied, + name=None, coolingSetpoint=2600, heatingSetpoint=2000, builtIn=True)) + +new_presets = initial_presets.copy() +new_presets.append(cluster.Structs.PresetStruct(presetHandle=NullValue, presetScenario=cluster.Enums.PresetScenarioEnum.kSleep, + name="Sleep", coolingSetpoint=2700, heatingSetpoint=1900, builtIn=False)) + +new_presets_with_handle = initial_presets.copy() +new_presets_with_handle.append(cluster.Structs.PresetStruct( + presetHandle=b'\x03', presetScenario=cluster.Enums.PresetScenarioEnum.kSleep, name="Sleep", coolingSetpoint=2700, heatingSetpoint=1900, builtIn=False)) + + +class TC_TSTAT_4_2(MatterBaseTest): + + async def write_presets(self, endpoint, presets) -> Status: + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, cluster.Attributes.Presets(presets))]) + return result[0].Status + + async def send_edit_preset_request_command(self, + endpoint: int = None, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=cluster.Commands.StartPresetsSchedulesEditRequest(timeoutSeconds=180), + endpoint=endpoint) + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_commit_preset_request_command(self, + endpoint: int = None, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=cluster.Commands.CommitPresetsSchedulesRequest(), + endpoint=endpoint) + asserts.assert_equal(expected_status, Status.Success) + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_cancel_preset_request_command(self, + endpoint: int = None, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=cluster.Commands.CancelPresetsSchedulesEditRequest(), + endpoint=endpoint) + asserts.assert_equal(expected_status, Status.Success) + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_set_active_preset_handle_request_command(self, + endpoint: int = None, + value: bytes = None, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=cluster.Commands.SetActivePresetRequest(value), + endpoint=endpoint) + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + def desc_TC_TSTAT_4_2(self) -> str: + """Returns a description of this test""" + return "3.2.4 [TC-TSTAT-4-2] Preset write and command attributes test case with server as DUT" + + def pics_TC_TSTAT_4_2(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["TSTAT.S"] + + def steps_TC_TSTAT_4_2(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH writes to the Presets attribute without calling the StartPresetsSchedulesEditRequest command", + "Verify that the Presets attribute was not updated."), + TestStep("3", "TH writes to the Presets attribute after calling the StartPresetsSchedulesEditRequest command but doesn't call CommitPresetsSchedulesRequest to commit", + "Verify that the Presets attribute was not updated."), + TestStep("4", "TH writes to the Presets attribute after calling the StartPresetsSchedulesEditRequest command and calls CommitPresetsSchedulesRequest to commit", + "Verify that the Presets attribute was updated."), + TestStep("5", "TH writes to the Presets attribute with a built-in preset removed", + "Verify that the CommitPresetsSchedulesRequest returned UNSUPPORTED_ACCESS (0x7e)."), + TestStep("6", "TH writes to the Presets attribute with a preset removed whose handle matches the value in the ActivePresetHandle attribute", + "Verify that the CommitPresetsSchedulesRequest returned INVALID_IN_STATE (0xcb)."), + TestStep("7", "TH writes to the Presets attribute with a built-in preset modified to be not built-in", + "Verify that the CommitPresetsSchedulesRequest returned UNSUPPORTED_ACCESS (0x7e)."), + TestStep("8", "TH writes to the Presets attribute with a new preset having builtIn set to true", + "Verify that the CommitPresetsSchedulesRequest returned CONSTRAINT_ERROR (0x87)."), + TestStep("9", "TH writes to the Presets attribute with a new preset having a preset handle that doesn't exist in the Presets attribute", + "Verify that the CommitPresetsSchedulesRequest returned NOT_FOUND (0x8b)."), + TestStep("10", "TH writes to the Presets attribute with a non built-in preset modified to be built-in", + "Verify that the CommitPresetsSchedulesRequest returned UNSUPPORTED_ACCESS (0x7e)."), + TestStep("11", "TH writes to the Presets attribute with a preset that doesn't support names in the PresetTypeFeatures bitmap but has a name", + "Verify that the CommitPresetsSchedulesRequest returned CONSTRAINT_ERROR (0x87)."), + TestStep("12", "TH writes to the Presets attribute but calls the CancelPresetsSchedulesEditRequest command to cancel the edit request", + "Verify that the edit request was cancelled"), + ] + + return steps + + @async_test_body + async def test_TC_TSTAT_4_2(self): + endpoint = self.user_params.get("endpoint", 1) + + self.step("1") + # Commission DUT - already done + + self.step("2") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050")): + presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) + logger.info(f"Rx'd Presets: {presets}") + asserts.assert_equal(presets, initial_presets, "Presets do not match initial value") + + # Write to the presets attribute without calling StartPresetsSchedulesEditRequest command + status = await self.write_presets(endpoint=endpoint, presets=new_presets) + status_ok = (status == Status.InvalidInState) + asserts.assert_true(status_ok, "Presets write did not return InvalidInState as expected") + + self.step("3") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + await self.send_edit_preset_request_command() + + # Write to the presets attribute after calling StartPresetsSchedulesEditRequest command + status = await self.write_presets(endpoint=endpoint, presets=new_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Read the presets attribute and verify it was not updated since CommitPresetsSchedulesRequest was not called after writing presets + presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) + logger.info(f"Rx'd Presets: {presets}") + asserts.assert_equal(presets, initial_presets, "Presets were updated which is not expected") + + self.step("4") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after calling StartPresetsSchedulesEditRequest command + status = await self.write_presets(endpoint=endpoint, presets=new_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command + await self.send_commit_preset_request_command() + + # Read the presets attribute and verify it was updated since CommitPresetsSchedulesRequest was called after writing presets + presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) + logger.info(f"Rx'd Presets: {presets}") + asserts.assert_equal(presets, new_presets_with_handle, "Presets were not updated which is not expected") + + self.step("5") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after removing a built in preset from the list. Remove the first entry. + test_presets = new_presets_with_handle.copy() + test_presets.pop(0) + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess + await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + + self.step("6") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C06.Rsp") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the SetActivePresetRequest command + await self.send_set_active_preset_handle_request_command(value=b'\x03') + + # Read the active preset handle attribute and verify it was updated to preset handle + activePresetHandle = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.ActivePresetHandle) + logger.info(f"Rx'd ActivePresetHandle: {activePresetHandle}") + asserts.assert_equal(activePresetHandle, b'\x03', "Active preset handle was not updated as expected") + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after removing the preset that was set as the active preset handle. Remove the last entry with preset handle (b'\x03') + test_presets = new_presets_with_handle.copy() + del test_presets[-1] + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command and expect InvalidInState + await self.send_commit_preset_request_command(expected_status=Status.InvalidInState) + + self.step("7") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after setting the builtIn flag to False for preset with handle (b'\x01') + test_presets = copy.deepcopy(new_presets_with_handle) + test_presets[0].builtIn = False + + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess + await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + + self.step("8") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after adding a preset with builtIn set to True + test_presets = copy.deepcopy(new_presets_with_handle) + test_presets.append(cluster.Structs.PresetStruct(presetHandle=NullValue, presetScenario=cluster.Enums.PresetScenarioEnum.kWake, + name="Wake", coolingSetpoint=2800, heatingSetpoint=1800, builtIn=True)) + + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command and expect ConstraintError + await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + + self.step("9") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after adding a preset with a preset handle that doesn't exist in Presets attribute + test_presets = copy.deepcopy(new_presets_with_handle) + test_presets.append(cluster.Structs.PresetStruct(presetHandle=b'\x08', presetScenario=cluster.Enums.PresetScenarioEnum.kWake, + name="Wake", coolingSetpoint=2800, heatingSetpoint=1800, builtIn=True)) + + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command and expect NotFound + await self.send_commit_preset_request_command(expected_status=Status.NotFound) + + self.step("10") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after setting the builtIn flag to True for preset with handle (b'\x03') + test_presets = copy.deepcopy(new_presets_with_handle) + test_presets[2].builtIn = True + + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess + await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + + self.step("11") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute after setting a name for preset with handle (b'\x01') that doesn't support names + test_presets = copy.deepcopy(new_presets_with_handle) + test_presets[0].name = "Occupied" + + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CommitPresetsSchedulesRequest command and expect ConstraintError + await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + + self.step("12") + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + + # Send the StartPresetsSchedulesEditRequest command + await self.send_edit_preset_request_command() + + # Write to the presets attribute with a new valid preset added + test_presets = copy.deepcopy(new_presets_with_handle) + test_presets.append(cluster.Structs.PresetStruct(presetHandle=b'\x04', presetScenario=cluster.Enums.PresetScenarioEnum.kWake, + name="Wake", coolingSetpoint=2800, heatingSetpoint=1800, builtIn=False)) + + status = await self.write_presets(endpoint=endpoint, presets=test_presets) + status_ok = (status == Status.Success) + asserts.assert_true(status_ok, "Presets write did not return Success as expected") + + # Send the CancelPresetsSchedulesRequest command + await self.send_cancel_preset_request_command() + + # Send the CommitPresetsSchedulesRequest command and expect InvalidInState as the previous edit request was cancelled + await self.send_commit_preset_request_command(expected_status=Status.InvalidInState) + + # TODO: Add tests for the total number of Presets exceeds the NumberOfPresets supported. Also Add tests for adding presets with preset scenario not present in PresetTypes. + + +if __name__ == "__main__": + default_matter_test_main() From 5c6312b895455b94b3213826ca7d94a66d6bfded Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Thu, 1 Aug 2024 14:00:52 +0200 Subject: [PATCH 50/63] removing unneccessary git fetch (#34698) --- scripts/helpers/restyle-diff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/helpers/restyle-diff.sh b/scripts/helpers/restyle-diff.sh index 5f37c69762e281..58904e06a38565 100755 --- a/scripts/helpers/restyle-diff.sh +++ b/scripts/helpers/restyle-diff.sh @@ -78,7 +78,7 @@ done if [[ -z "$ref" ]]; then ref="master" - git remote | grep -qxF upstream && ref="upstream/master" && git fetch upstream + git remote | grep -qxF upstream && ref="upstream/master" fi if [[ $pull_image -eq 1 ]]; then From b815bbd59627ca0ee853565cccbc4e2b2f179613 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Thu, 1 Aug 2024 09:26:09 -0400 Subject: [PATCH 51/63] Restyle patch --- src/app/clusters/thermostat-server/thermostat-server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 5228c94eafe2a2..dd484aaeac62c0 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1720,13 +1720,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { From d424a778dd7629c57744a15b7f7fb88e7f9ede9f Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Thu, 1 Aug 2024 09:46:28 -0400 Subject: [PATCH 52/63] Regen to fix ordering of global structs --- .../air-purifier-app.matter | 10 ++--- .../air-quality-sensor-app.matter | 10 ++--- .../all-clusters-app.matter | 10 ++--- .../all-clusters-minimal-app.matter | 10 ++--- .../bridge-common/bridge-app.matter | 10 ++--- ...p_rootnode_dimmablelight_bCwGYSDpoe.matter | 10 ++--- .../rootnode_airpurifier_73a6fe2651.matter | 10 ++--- ...umiditysensor_thermostat_56de3d5f45.matter | 10 ++--- ...ootnode_airqualitysensor_e63187f6c9.matter | 10 ++--- ...ootnode_basicvideoplayer_0ff86e943b.matter | 10 ++--- ...de_colortemperaturelight_hbUnzYVeyn.matter | 10 ++--- .../rootnode_contactsensor_27f76aeaf5.matter | 10 ++--- .../rootnode_contactsensor_lFAGG1bfRO.matter | 10 ++--- .../rootnode_dimmablelight_bCwGYSDpoe.matter | 10 ++--- ...tnode_dimmablepluginunit_f8a9a0b9d4.matter | 10 ++--- .../rootnode_dishwasher_cc105034fe.matter | 10 ++--- .../rootnode_doorlock_aNKYAreMXE.matter | 10 ++--- ...tnode_extendedcolorlight_8lcaaYJVAa.matter | 10 ++--- .../devices/rootnode_fan_7N2TobIlOX.matter | 10 ++--- .../rootnode_flowsensor_1zVxHedlaV.matter | 10 ++--- .../rootnode_genericswitch_2dfff6e516.matter | 10 ++--- .../rootnode_genericswitch_9866e35d0b.matter | 10 ++--- ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 10 ++--- .../rootnode_humiditysensor_Xyj4gda6Hb.matter | 10 ++--- .../rootnode_laundrywasher_fb10d238c8.matter | 10 ++--- .../rootnode_lightsensor_lZQycTFcJK.matter | 10 ++--- ...rootnode_occupancysensor_iHyVgifZuo.matter | 10 ++--- .../rootnode_onofflight_bbs1b7IaOV.matter | 10 ++--- .../rootnode_onofflight_samplemei.matter | 10 ++--- ...ootnode_onofflightswitch_FsPlMr090Q.matter | 10 ++--- ...rootnode_onoffpluginunit_Wtf8ss5EBY.matter | 10 ++--- .../rootnode_pressuresensor_s0qC9wLH4k.matter | 10 ++--- .../devices/rootnode_pump_5f904818cc.matter | 10 ++--- .../devices/rootnode_pump_a811bb33a0.matter | 10 ++--- ...eraturecontrolledcabinet_ffdb696680.matter | 10 ++--- ...ode_roboticvacuumcleaner_1807ff0c49.matter | 10 ++--- ...tnode_roomairconditioner_9cf3607804.matter | 10 ++--- .../rootnode_smokecoalarm_686fe0dcb8.matter | 10 ++--- .../rootnode_speaker_RpzeXdimqA.matter | 10 ++--- ...otnode_temperaturesensor_Qy1zkNW7c3.matter | 10 ++--- .../rootnode_thermostat_bm3fb8dhYi.matter | 10 ++--- .../rootnode_windowcovering_RLCxaGi9Yx.matter | 10 ++--- .../contact-sensor-app.matter | 10 ++--- .../nxp/zap-lit/contact-sensor-app.matter | 10 ++--- .../nxp/zap-sit/contact-sensor-app.matter | 10 ++--- .../dishwasher-common/dishwasher-app.matter | 10 ++--- .../energy-management-app.matter | 10 ++--- .../fabric-bridge-app.matter | 10 ++--- .../nxp/zap/laundry-washer-app.matter | 10 ++--- .../light-switch-app.matter | 10 ++--- .../light-switch-app/qpg/zap/switch.matter | 10 ++--- .../data_model/lighting-app-ethernet.matter | 10 ++--- .../data_model/lighting-app-thread.matter | 10 ++--- .../data_model/lighting-app-wifi.matter | 10 ++--- .../lighting-common/lighting-app.matter | 10 ++--- .../nxp/zap/lighting-on-off.matter | 10 ++--- examples/lighting-app/qpg/zap/light.matter | 10 ++--- .../data_model/lighting-thread-app.matter | 10 ++--- .../data_model/lighting-wifi-app.matter | 10 ++--- .../lit-icd-common/lit-icd-server-app.matter | 10 ++--- examples/lock-app/lock-common/lock-app.matter | 10 ++--- examples/lock-app/nxp/zap/lock-app.matter | 10 ++--- examples/lock-app/qpg/zap/lock.matter | 10 ++--- .../log-source-common/log-source-app.matter | 10 ++--- .../microwave-oven-app.matter | 10 ++--- .../network-manager-app.matter | 10 ++--- .../ota-provider-app.matter | 10 ++--- .../ota-requestor-app.matter | 10 ++--- .../placeholder/linux/apps/app1/config.matter | 10 ++--- .../placeholder/linux/apps/app2/config.matter | 10 ++--- examples/pump-app/pump-common/pump-app.matter | 10 ++--- .../silabs/data_model/pump-thread-app.matter | 10 ++--- .../silabs/data_model/pump-wifi-app.matter | 10 ++--- .../pump-controller-app.matter | 10 ++--- .../refrigerator-app.matter | 10 ++--- examples/rvc-app/rvc-common/rvc-app.matter | 10 ++--- .../smoke-co-alarm-app.matter | 10 ++--- .../temperature-measurement.matter | 10 ++--- .../nxp/zap/thermostat_matter_thread.matter | 10 ++--- .../nxp/zap/thermostat_matter_wifi.matter | 10 ++--- .../qpg/zap/thermostaticRadiatorValve.matter | 10 ++--- .../thermostat-common/thermostat.matter | 10 ++--- examples/tv-app/tv-common/tv-app.matter | 10 ++--- .../tv-casting-common/tv-casting-app.matter | 10 ++--- .../virtual-device-app.matter | 10 ++--- examples/window-app/common/window-app.matter | 10 ++--- .../data_model/controller-clusters.matter | 10 ++--- .../python/chip/clusters/Objects.py | 24 +++++------ .../CHIP/zap-generated/MTRStructsObjc.h | 12 +++--- .../CHIP/zap-generated/MTRStructsObjc.mm | 34 +++++++-------- .../zap-generated/cluster-objects.cpp | 42 +++++++++---------- .../zap-generated/cluster-objects.h | 28 ++++++------- 92 files changed, 505 insertions(+), 505 deletions(-) diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index 6c9fa928758007..120c19cfc3a620 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter index d609a897d73f66..cbadcdce716ad3 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; 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 0897a733c96c29..be9840758c3497 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 @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 7a01c92f8efc4b..b7cab6181175a0 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index a5a886648f4710..d075acd4b4b23a 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter index aba04eaf675db5..7ed09f924d5592 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter index 00e02b325dc2bb..110f57ff98e707 100644 --- a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter +++ b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index 6f7e84bd74f6ff..85d890215bde81 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter index 899d3312d32720..6802604c10e6dd 100644 --- a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter +++ b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter index 8f9ec517b16205..455d68a8e57d07 100644 --- a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter +++ b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index f43af15c89f128..258a3058056867 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter index e3766b6de9bfbc..2e4dd20bb40ee1 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter index a14055d3789caa..c344acbcade910 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter index cbc43cfa0e491f..f45c6b91d0ab7a 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter index d716418cf1b401..07d98132615eb8 100644 --- a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter +++ b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter index 7f61d0aafa1a85..553a411404f3b0 100644 --- a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter +++ b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter index 8fb28a7ad2599b..91bf8faefe4e8c 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter index 197770102f7973..7e16f61d5c699b 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter index 4dc20b3f95d57b..81a0ec90423462 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter index d7c91e17bae982..ba78911fe8b6a6 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter index 423200cdf94354..de9402fa5b4670 100644 --- a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter +++ b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter index 8bc71a72186424..fad55b938291b4 100644 --- a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter +++ b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index d8cba863ec6e37..561ece28442632 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter index dc5e6ad81fa43c..dd667f7bf0b307 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter index 045bb7fc85a198..82cf0b42fb6d18 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter index 8f58eba2c09076..2900f29a79b991 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter index 3ddaac84e2a576..fa495aa2d6125e 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter index 23ea41137dd413..c22d65816c2d21 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_onofflight_samplemei.matter b/examples/chef/devices/rootnode_onofflight_samplemei.matter index cf446fca4434c6..dbd19d3dfb4fe2 100644 --- a/examples/chef/devices/rootnode_onofflight_samplemei.matter +++ b/examples/chef/devices/rootnode_onofflight_samplemei.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter index b36b3be4e4076e..cb8bfcfe3723a6 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter index 2e46884a6ecdff..d4d391a1df39c8 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter index 042130df0f615e..75663e2b4e2c78 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_pump_5f904818cc.matter b/examples/chef/devices/rootnode_pump_5f904818cc.matter index 286f68624c3fac..44f36008744713 100644 --- a/examples/chef/devices/rootnode_pump_5f904818cc.matter +++ b/examples/chef/devices/rootnode_pump_5f904818cc.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_pump_a811bb33a0.matter b/examples/chef/devices/rootnode_pump_a811bb33a0.matter index 3dd87fda542bf2..a3a219dda9854f 100644 --- a/examples/chef/devices/rootnode_pump_a811bb33a0.matter +++ b/examples/chef/devices/rootnode_pump_a811bb33a0.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter index 107beff5fe4054..7839c4f3d4dc9e 100644 --- a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter +++ b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter index 64a24a3e8d5b10..36842f2795bf2a 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 94b21623ccdea2..c7b9ad9579400a 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter index b5fa7792756705..b97bd7df31b1f7 100644 --- a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter +++ b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter index cc86233361616c..4ba5e1a13ba9f0 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter index dada55d6f28382..08861fd00ef61f 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index c05c401c354b63..415bf6602152e0 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter index 2533c3d4cf0593..f9d68b5d5bf09b 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; 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 b9bc3719dcb0c7..1a47a89c7815c5 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 @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter index cdfe08531fbcd3..efe6f23407e416 100644 --- a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter index 2e02ab6ed3fcb3..8627a7a7ffb8b3 100644 --- a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter index 4cf3cd19341201..cf1e3437716728 100644 --- a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter +++ b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; 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 dd34c0885446ef..d469ea37817ee0 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 @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter index 626b5febcf3e55..edca91ce5fe092 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter +++ b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter index 0776eff0070ac5..6e5cf5f73f184c 100644 --- a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter +++ b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index ff2f4f81915f4e..ea556f3618a93e 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/light-switch-app/qpg/zap/switch.matter b/examples/light-switch-app/qpg/zap/switch.matter index 0d9ba8c6a62cef..b09e1f4461f748 100644 --- a/examples/light-switch-app/qpg/zap/switch.matter +++ b/examples/light-switch-app/qpg/zap/switch.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter index dd0bf5aecca40a..5da038bba449de 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter index 440a74d3167aaa..6d57125cdd59fa 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter index d9cfbdaf975791..fd07e4296c90dc 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index a5401770b75126..babf3b7d3a3a06 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.matter b/examples/lighting-app/nxp/zap/lighting-on-off.matter index 11c63db06a98a4..cad6220352d588 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.matter +++ b/examples/lighting-app/nxp/zap/lighting-on-off.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/qpg/zap/light.matter b/examples/lighting-app/qpg/zap/light.matter index 97e275225a8400..00ed26df73f233 100644 --- a/examples/lighting-app/qpg/zap/light.matter +++ b/examples/lighting-app/qpg/zap/light.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index 5a0ad2e84020b4..669e28213e4360 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter index b14006376bf5b3..33cbe5d926b3da 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter index e078f10e89bea2..5ca16ebfe42f81 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 8d3ca940a20dca..cc10c5c3e8f02f 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lock-app/nxp/zap/lock-app.matter b/examples/lock-app/nxp/zap/lock-app.matter index 973924c8e32d37..87c0490134956a 100644 --- a/examples/lock-app/nxp/zap/lock-app.matter +++ b/examples/lock-app/nxp/zap/lock-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/lock-app/qpg/zap/lock.matter b/examples/lock-app/qpg/zap/lock.matter index bf127a5b612c09..00525139bd204b 100644 --- a/examples/lock-app/qpg/zap/lock.matter +++ b/examples/lock-app/qpg/zap/lock.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/log-source-app/log-source-common/log-source-app.matter b/examples/log-source-app/log-source-common/log-source-app.matter index 65d33ad445fac9..6932158ab14342 100644 --- a/examples/log-source-app/log-source-common/log-source-app.matter +++ b/examples/log-source-app/log-source-common/log-source-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** The Access Control Cluster exposes a data model view of a Node's Access Control List (ACL), which codifies the rules used to manage and enforce Access Control for the Node's endpoints and their associated diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter index d9a478419dbcbf..66b25fa6fc988d 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; 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 3888231f540679..9181e6385632b6 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 @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index f4947cab38516c..8e7d9778d469fd 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ cluster Descriptor = 29 { revision 2; diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index 3dfbce2c675f44..600babd7f9c64a 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 47e9c038ee4b88..965acf523f95ad 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 5c56ce1e4f72e0..803b30d9d00f59 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index 28a7d10b8f7e3b..ab504ba68aefef 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.matter b/examples/pump-app/silabs/data_model/pump-thread-app.matter index 070a25e35a85bd..27ba439cabb0bd 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.matter +++ b/examples/pump-app/silabs/data_model/pump-thread-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.matter b/examples/pump-app/silabs/data_model/pump-wifi-app.matter index 070a25e35a85bd..27ba439cabb0bd 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.matter +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index c40d44f40f7b0f..66a19273ac2ee8 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter index 044f8699682bc6..4cd45a16d3346b 100644 --- a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter +++ b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ cluster Descriptor = 29 { revision 2; diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index e3b5c046f594e0..b4525922a0ffff 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter index 9180d5e1465db7..7a5568bd048281 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter index 75d825b6ba0e5d..9dc820518a710f 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter +++ b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ cluster Descriptor = 29 { revision 2; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index d7cfa0ad0e02fc..59fa860f5bbdc6 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index f73b1ef2703535..cee0d908850f66 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index 5a0d8fe7d41d02..0130203f2a0e14 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 20ae1ae6c8c20e..253ffcdb15fae6 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index e9f67235de7dd3..fa18e9fff1efbb 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for switching devices between 'On' and 'Off' states. */ cluster OnOff = 6 { revision 6; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index 3701c007513258..36c37bd6d72759 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter index c469bd12af5793..ff7e11b6e17952 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index d6a721dd41a88b..52a3b69634e6ef 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index d973f74d26c6b7..6205805d5252ae 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -18,17 +18,17 @@ bitmap TestGlobalBitmap : bitmap32 { kSecondBit = 0x2; } -struct AtomicAttributeStatusStruct { - attrib_id attributeID = 0; - status statusCode = 1; -} - struct TestGlobalStruct { char_string<128> name = 0; nullable TestGlobalBitmap myBitmap = 1; optional nullable TestGlobalEnum myEnum = 2; } +struct AtomicAttributeStatusStruct { + attrib_id attributeID = 0; + status statusCode = 1; +} + /** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ cluster Identify = 3 { revision 4; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index b27f42f7ad4f43..1b54690b2a5b51 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -65,32 +65,32 @@ class TestGlobalBitmap(IntFlag): class Structs: @dataclass - class AtomicAttributeStatusStruct(ClusterObject): + class TestGlobalStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint), - ClusterObjectFieldDescriptor(Label="statusCode", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="name", Tag=0, Type=str), + ClusterObjectFieldDescriptor(Label="myBitmap", Tag=1, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="myEnum", Tag=2, Type=typing.Union[None, Nullable, Globals.Enums.TestGlobalEnum]), ]) - attributeID: 'uint' = 0 - statusCode: 'uint' = 0 + name: 'str' = "" + myBitmap: 'typing.Union[Nullable, uint]' = NullValue + myEnum: 'typing.Union[None, Nullable, Globals.Enums.TestGlobalEnum]' = None @dataclass - class TestGlobalStruct(ClusterObject): + class AtomicAttributeStatusStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="name", Tag=0, Type=str), - ClusterObjectFieldDescriptor(Label="myBitmap", Tag=1, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="myEnum", Tag=2, Type=typing.Union[None, Nullable, Globals.Enums.TestGlobalEnum]), + ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="statusCode", Tag=1, Type=uint), ]) - name: 'str' = "" - myBitmap: 'typing.Union[Nullable, uint]' = NullValue - myEnum: 'typing.Union[None, Nullable, Globals.Enums.TestGlobalEnum]' = None + attributeID: 'uint' = 0 + statusCode: 'uint' = 0 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 6e4fab70efda3d..682ef55644dc7c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -19,12 +19,6 @@ NS_ASSUME_NONNULL_BEGIN -MTR_PROVISIONALLY_AVAILABLE -@interface MTRDataTypeAtomicAttributeStatusStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nonnull attributeID MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull statusCode MTR_PROVISIONALLY_AVAILABLE; -@end - MTR_PROVISIONALLY_AVAILABLE @interface MTRDataTypeTestGlobalStruct : NSObject @property (nonatomic, copy) NSString * _Nonnull name MTR_PROVISIONALLY_AVAILABLE; @@ -32,6 +26,12 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable myEnum MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRDataTypeAtomicAttributeStatusStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull attributeID MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull statusCode MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)) @interface MTRDescriptorClusterDeviceTypeStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull deviceType MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 052efc72f6d57e..92f2e375038892 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -19,64 +19,64 @@ NS_ASSUME_NONNULL_BEGIN -@implementation MTRDataTypeAtomicAttributeStatusStruct +@implementation MTRDataTypeTestGlobalStruct - (instancetype)init { if (self = [super init]) { - _attributeID = @(0); + _name = @""; - _statusCode = @(0); + _myBitmap = nil; + + _myEnum = nil; } return self; } - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTRDataTypeAtomicAttributeStatusStruct alloc] init]; + auto other = [[MTRDataTypeTestGlobalStruct alloc] init]; - other.attributeID = self.attributeID; - other.statusCode = self.statusCode; + other.name = self.name; + other.myBitmap = self.myBitmap; + other.myEnum = self.myEnum; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; statusCode:%@; >", NSStringFromClass([self class]), _attributeID, _statusCode]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: name:%@; myBitmap:%@; myEnum:%@; >", NSStringFromClass([self class]), _name, _myBitmap, _myEnum]; return descriptionString; } @end -@implementation MTRDataTypeTestGlobalStruct +@implementation MTRDataTypeAtomicAttributeStatusStruct - (instancetype)init { if (self = [super init]) { - _name = @""; - - _myBitmap = nil; + _attributeID = @(0); - _myEnum = nil; + _statusCode = @(0); } return self; } - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTRDataTypeTestGlobalStruct alloc] init]; + auto other = [[MTRDataTypeAtomicAttributeStatusStruct alloc] init]; - other.name = self.name; - other.myBitmap = self.myBitmap; - other.myEnum = self.myEnum; + other.attributeID = self.attributeID; + other.statusCode = self.statusCode; return other; } - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: name:%@; myBitmap:%@; myEnum:%@; >", NSStringFromClass([self class]), _name, _myBitmap, _myEnum]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: attributeID:%@; statusCode:%@; >", NSStringFromClass([self class]), _attributeID, _statusCode]; 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 7e51563b2dad56..c24b5c9cc1f95c 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 @@ -556,12 +556,13 @@ namespace Globals { // Global structs namespace Structs { -namespace AtomicAttributeStatusStruct { +namespace TestGlobalStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kAttributeID), attributeID); - encoder.Encode(to_underlying(Fields::kStatusCode), statusCode); + encoder.Encode(to_underlying(Fields::kName), name); + encoder.Encode(to_underlying(Fields::kMyBitmap), myBitmap); + encoder.Encode(to_underlying(Fields::kMyEnum), myEnum); return encoder.Finalize(); } @@ -579,13 +580,17 @@ 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::kAttributeID)) + if (__context_tag == to_underlying(Fields::kName)) { - err = DataModel::Decode(reader, attributeID); + err = DataModel::Decode(reader, name); } - else if (__context_tag == to_underlying(Fields::kStatusCode)) + else if (__context_tag == to_underlying(Fields::kMyBitmap)) { - err = DataModel::Decode(reader, statusCode); + err = DataModel::Decode(reader, myBitmap); + } + else if (__context_tag == to_underlying(Fields::kMyEnum)) + { + err = DataModel::Decode(reader, myEnum); } else { @@ -595,15 +600,14 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace AtomicAttributeStatusStruct +} // namespace TestGlobalStruct -namespace TestGlobalStruct { +namespace AtomicAttributeStatusStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kName), name); - encoder.Encode(to_underlying(Fields::kMyBitmap), myBitmap); - encoder.Encode(to_underlying(Fields::kMyEnum), myEnum); + encoder.Encode(to_underlying(Fields::kAttributeID), attributeID); + encoder.Encode(to_underlying(Fields::kStatusCode), statusCode); return encoder.Finalize(); } @@ -621,17 +625,13 @@ 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::kName)) - { - err = DataModel::Decode(reader, name); - } - else if (__context_tag == to_underlying(Fields::kMyBitmap)) + if (__context_tag == to_underlying(Fields::kAttributeID)) { - err = DataModel::Decode(reader, myBitmap); + err = DataModel::Decode(reader, attributeID); } - else if (__context_tag == to_underlying(Fields::kMyEnum)) + else if (__context_tag == to_underlying(Fields::kStatusCode)) { - err = DataModel::Decode(reader, myEnum); + err = DataModel::Decode(reader, statusCode); } else { @@ -641,7 +641,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace TestGlobalStruct +} // namespace AtomicAttributeStatusStruct } // namespace Structs } // namespace Globals 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 db5c8fb1065d79..6fdd1388ce010f 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 @@ -323,18 +323,20 @@ namespace Globals { // Global structs. namespace Structs { -namespace AtomicAttributeStatusStruct { +namespace TestGlobalStruct { enum class Fields : uint8_t { - kAttributeID = 0, - kStatusCode = 1, + kName = 0, + kMyBitmap = 1, + kMyEnum = 2, }; struct Type { public: - chip::AttributeId attributeID = static_cast(0); - uint8_t statusCode = static_cast(0); + chip::CharSpan name; + DataModel::Nullable> myBitmap; + Optional> myEnum; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -345,22 +347,20 @@ struct Type using DecodableType = Type; -} // namespace AtomicAttributeStatusStruct +} // namespace TestGlobalStruct -namespace TestGlobalStruct { +namespace AtomicAttributeStatusStruct { enum class Fields : uint8_t { - kName = 0, - kMyBitmap = 1, - kMyEnum = 2, + kAttributeID = 0, + kStatusCode = 1, }; struct Type { public: - chip::CharSpan name; - DataModel::Nullable> myBitmap; - Optional> myEnum; + chip::AttributeId attributeID = static_cast(0); + uint8_t statusCode = static_cast(0); CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -371,7 +371,7 @@ struct Type using DecodableType = Type; -} // namespace TestGlobalStruct +} // namespace AtomicAttributeStatusStruct } // namespace Structs From b5410d394ce418f2db0c8c320ca67b1651be4af2 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Thu, 1 Aug 2024 18:14:28 -0400 Subject: [PATCH 53/63] Apply suggestions from code review Co-authored-by: Boris Zbarsky --- src/app/clusters/thermostat-server/thermostat-server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index dd484aaeac62c0..9b991162e2a330 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1403,7 +1403,7 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app:: uint16_t maxTimeout = 5000; timeout = std::min(timeout, maxTimeout); - ScheduleTimer(endpoint, static_cast(timeout)); + ScheduleTimer(endpoint, System::Clock::Milliseconds16(timeout)); gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); Commands::AtomicResponse::Type response; From 353c9c1e05f9df2fcb334b18c05668a185df9fab Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Thu, 1 Aug 2024 18:18:14 -0400 Subject: [PATCH 54/63] Return correct AtomicResponse when committing or rolling back --- .../thermostat-server/thermostat-server.cpp | 235 +++++++++--------- 1 file changed, 113 insertions(+), 122 deletions(-) diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index dd484aaeac62c0..5d539c2473f85e 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -192,13 +192,16 @@ ScopedNodeId GetSourceScopedNodeId(CommandHandler * commandObj) } /** - * @brief Utility to clean up state by clearing the pending presets list, canceling the timer - * and setting PresetsEditable to false and clear the originator scoped node id. + * @brief Sends a response for the command and cleans up state by calling CleanUp() * * @param[in] delegate The delegate to use. * @param[in] endpoint The endpoint to use. + * @param[in] commandObj The command handler to use to add the status response. + * @param[in] commandPath The command path. + * @param[in] status The status code to send as the response. + * */ -void CleanUp(Delegate * delegate, EndpointId endpoint) +void resetAtomicWrite(Delegate * delegate, EndpointId endpoint) { if (delegate != nullptr) { @@ -209,25 +212,6 @@ void CleanUp(Delegate * delegate, EndpointId endpoint) gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, ScopedNodeId()); } -/** - * @brief Sends a response for the command and cleans up state by calling CleanUp() - * - * @param[in] delegate The delegate to use. - * @param[in] endpoint The endpoint to use. - * @param[in] commandObj The command handler to use to add the status response. - * @param[in] commandPath The command path. - * @param[in] status The status code to send as the response. - * - * @return true to indicate the response has been sent and command has been handled. - */ -bool SendResponseAndCleanUp(Delegate * delegate, EndpointId endpoint, CommandHandler * commandObj, - const ConcreteCommandPath & commandPath, imcode status) -{ - commandObj->AddStatus(commandPath, status); - CleanUp(delegate, endpoint); - return true; -} - /** * @brief Finds an entry in the pending presets list that matches a preset. * The presetHandle of the two presets must match. @@ -849,15 +833,8 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, { VerifyOrDie(aPath.mClusterId == Thermostat::Id); - EndpointId endpoint = aPath.mEndpointId; - auto & subjectDescriptor = aDecoder.GetSubjectDescriptor(); - ScopedNodeId scopedNodeId = ScopedNodeId(); - - // Get the node id if the authentication mode is CASE. - if (subjectDescriptor.authMode == Access::AuthMode::kCase) - { - scopedNodeId = ScopedNodeId(subjectDescriptor.subject, subjectDescriptor.fabricIndex); - } + EndpointId endpoint = aPath.mEndpointId; + auto & subjectDescriptor = aDecoder.GetSubjectDescriptor(); // Check atomic attributes first switch (aPath.mAttributeId) @@ -871,9 +848,9 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, VerifyOrReturnError(InAtomicWrite(endpoint), CHIP_IM_GLOBAL_STATUS(InvalidInState), ChipLogError(Zcl, "Presets are not editable")); - // Check if the OriginatorScopedNodeId at the endpoint is the same as the node editing the presets, + // OK, we're in an atomic write, make sure the requesting node is the same one that started the atomic write, // otherwise return BUSY. - if (GetAtomicWriteScopedNodeId(endpoint) != scopedNodeId) + if (!InAtomicWrite(subjectDescriptor, endpoint)) { ChipLogError(Zcl, "Another node is editing presets. Server is busy. Try again later"); return CHIP_IM_GLOBAL_STATUS(Busy); @@ -926,10 +903,10 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, } // This is not an atomic attribute, so check to make sure we don't have an atomic write going for this client - if (InAtomicWrite(endpoint)) + if (InAtomicWrite(subjectDescriptor, endpoint)) { - VerifyOrReturnError(GetAtomicWriteScopedNodeId(endpoint) != scopedNodeId, CHIP_IM_GLOBAL_STATUS(InvalidInState), - ChipLogError(Zcl, "Can not write to non-atomic attributes during atomic write")); + ChipLogError(Zcl, "Can not write to non-atomic attributes during atomic write"); + return CHIP_IM_GLOBAL_STATUS(InvalidInState); } uint32_t ourFeatureMap; @@ -1279,16 +1256,16 @@ bool emberAfThermostatClusterSetWeeklyScheduleCallback(app::CommandHandler * com } bool emberAfThermostatClusterSetActiveScheduleRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::DecodableType & commandData) + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Clusters::Thermostat::Commands::SetActiveScheduleRequest::DecodableType & commandData) { // TODO return false; } bool emberAfThermostatClusterSetActivePresetRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType & commandData) + CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType & commandData) { EndpointId endpoint = commandPath.mEndpointId; Delegate * delegate = GetDelegate(endpoint); @@ -1322,7 +1299,7 @@ bool emberAfThermostatClusterSetActivePresetRequestCallback( return true; } -bool validAtomicAttributes(const Commands::AtomicRequest::DecodableType & commandData) +bool validAtomicAttributes(const Commands::AtomicRequest::DecodableType & commandData, bool requireBoth) { auto attributeIdsIter = commandData.attributeRequests.begin(); bool requestedPresets = false, requestedSchedules = false; @@ -1354,11 +1331,27 @@ bool validAtomicAttributes(const Commands::AtomicRequest::DecodableType & comman { return false; } + if (requireBoth) + { + return (requestedPresets && requestedSchedules); + } // If the atomic request doesn't contain at least one of these attributes, it's invalid return (requestedPresets || requestedSchedules); } -bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, +Commands::AtomicResponse::Type buildAtomicResponse(imcode status, imcode presetsStatus, imcode schedulesStatus) +{ + Commands::AtomicResponse::Type response; + Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { + { .attributeID = Presets::Id, .statusCode = to_underlying(presetsStatus) }, + { .attributeID = Schedules::Id, .statusCode = to_underlying(schedulesStatus) } + }; + response.statusCode = to_underlying(status); + response.attributeStatus = attributeStatus; + return response; +} + +void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::AtomicRequest::DecodableType & commandData) { EndpointId endpoint = commandPath.mEndpointId; @@ -1367,35 +1360,27 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app:: { // This client already has an open atomic write commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; + return; } if (!commandData.timeout.HasValue()) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return true; + return; } auto timeout = commandData.timeout.Value(); - if (!validAtomicAttributes(commandData)) + if (!validAtomicAttributes(commandData, false)) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return true; + return; } if (gThermostatAttrAccess.InAtomicWrite(endpoint)) { - Commands::AtomicResponse::Type response; - Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { - { .attributeID = Presets::Id, .statusCode = to_underlying(imcode::Busy) }, - { .attributeID = Schedules::Id, .statusCode = to_underlying(imcode::Busy) } - }; - - response.statusCode = to_underlying(imcode::Failure); - response.attributeStatus = attributeStatus; - commandObj->AddResponse(commandPath, response); - return true; + commandObj->AddResponse(commandPath, buildAtomicResponse(imcode::Failure, imcode::Busy, imcode::Busy)); + return; } // This is a valid request to open an atomic write. Note that @@ -1406,45 +1391,14 @@ bool handleAtomicBegin(chip::app::CommandHandler * commandObj, const chip::app:: ScheduleTimer(endpoint, static_cast(timeout)); gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); - Commands::AtomicResponse::Type response; - Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { - { .attributeID = Presets::Id, .statusCode = to_underlying(imcode::Success) }, - { .attributeID = Schedules::Id, .statusCode = to_underlying(imcode::Success) } - }; - - response.statusCode = to_underlying(imcode::Success); - response.attributeStatus = attributeStatus; + auto response = buildAtomicResponse(imcode::Success, imcode::Success, imcode::Success); response.timeout.Emplace(timeout); commandObj->AddResponse(commandPath, response); - - return true; + return; } -bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const Commands::AtomicRequest::DecodableType & commandData) +imcode commitPresets(Delegate * delegate, EndpointId endpoint) { - if (!validAtomicAttributes(commandData)) - { - commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return true; - } - EndpointId endpoint = commandPath.mEndpointId; - bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint); - if (!inAtomicWrite) - { - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; - } - - Delegate * delegate = GetDelegate(endpoint); - - if (delegate == nullptr) - { - ChipLogError(Zcl, "Delegate is null"); - commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; - } - PresetStructWithOwnedMembers preset; CHIP_ERROR err = CHIP_NO_ERROR; @@ -1464,7 +1418,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPresetAtIndex failed with error " "%" CHIP_ERROR_FORMAT, err.Format()); - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + return imcode::InvalidInState; } bool found = MatchingPendingPresetExists(delegate, preset); @@ -1473,7 +1427,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: // CONSTRAINT_ERROR. if (IsBuiltIn(preset) && !found) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + return imcode::ConstraintError; } } @@ -1487,7 +1441,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: if (err != CHIP_NO_ERROR) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + return imcode::InvalidInState; } if (!activePresetHandle.empty()) @@ -1495,7 +1449,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, activePresetHandle); if (count == 0) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + return imcode::InvalidInState; } } // For each preset in the pending presets list, check that the preset does not violate any spec constraints. @@ -1514,7 +1468,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: GetPendingPresetAtIndex failed with error " "%" CHIP_ERROR_FORMAT, err.Format()); - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + return imcode::InvalidInState; } bool isPendingPresetWithNullPresetHandle = pendingPreset.GetPresetHandle().IsNull(); @@ -1522,7 +1476,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: // If the preset handle is null and the built in field is set to true, return CONSTRAINT_ERROR. if (isPendingPresetWithNullPresetHandle && IsBuiltIn(pendingPreset)) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + return imcode::ConstraintError; } bool foundMatchingPresetInPresets = false; @@ -1535,7 +1489,7 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: // presets attribute list, return NOT_FOUND. if (!foundMatchingPresetInPresets) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::NotFound); + return imcode::NotFound; } // Find the number of presets in the pending preset list that match the preset handle. If there are duplicate @@ -1543,35 +1497,37 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, pendingPreset.GetPresetHandle().Value()); if (count > 1) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + return imcode::ConstraintError; } } - // If the preset is found in the presets attribute list and the preset is builtIn in the pending presets list - // but not in the presets attribute list, return UNSUPPORTED_ACCESS. + // If the BuiltIn field is true, and the PresetStruct in the current value with a + // matching PresetHandle field has a BuiltIn field set to false, a response + // with the status code CONSTRAINT_ERROR SHALL be returned. if (foundMatchingPresetInPresets && (IsBuiltIn(pendingPreset) && !IsBuiltIn(matchingPreset))) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + return imcode::ConstraintError; } - // If the preset is found in the presets attribute list and the preset is builtIn in the presets attribute - // but not in the pending presets list, return UNSUPPORTED_ACCESS. + // If the BuiltIn field is false, and the PresetStruct in the current value with a + // matching PresetHandle field has a BuiltIn field set to true, a response + // with the status code CONSTRAINT_ERROR SHALL be returned. if (foundMatchingPresetInPresets && (!IsBuiltIn(pendingPreset) && IsBuiltIn(matchingPreset))) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::UnsupportedAccess); + return imcode::ConstraintError; } // If the presetScenario is not found in the preset types, return CONSTRAINT_ERROR. PresetScenarioEnum presetScenario = pendingPreset.GetPresetScenario(); if (!PresetScenarioExistsInPresetTypes(delegate, presetScenario)) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + return imcode::ConstraintError; } // If the preset type for the preset scenario does not support names and a name is specified, return CONSTRAINT_ERROR. if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ConstraintError); + return imcode::ConstraintError; } // Enforce the Setpoint Limits for both the cooling and heating setpoints in the pending preset. @@ -1595,14 +1551,14 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: if (numberOfPresetsSupported == 0) { ChipLogError(Zcl, "emberAfThermostatClusterCommitPresetsSchedulesRequestCallback: Failed to get NumberOfPresets"); - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + return imcode::InvalidInState; } // If the expected length of the presets attribute with the applied changes exceeds the total number of presets supported, // return RESOURCE_EXHAUSTED. Note that the changes are not yet applied. if (numberOfPresetsSupported > 0 && totalCount > numberOfPresetsSupported) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::ResourceExhausted); + return imcode::ResourceExhausted; } // TODO: Check if the number of presets for each presetScenario exceeds the max number of presets supported for that @@ -1613,26 +1569,58 @@ bool handleAtomicCommit(chip::app::CommandHandler * commandObj, const chip::app: if (err != CHIP_NO_ERROR) { - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::InvalidInState); + return imcode::InvalidInState; + } + return imcode::Success; +} + +void handleAtomicCommit(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Commands::AtomicRequest::DecodableType & commandData) +{ + if (!validAtomicAttributes(commandData, true)) + { + commandObj->AddStatus(commandPath, imcode::InvalidCommand); + return; + } + EndpointId endpoint = commandPath.mEndpointId; + bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint); + if (!inAtomicWrite) + { + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return; } - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); + Delegate * delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return; + } + + auto presetsStatus = commitPresets(delegate, endpoint); + // TODO: copy over schedules code + auto schedulesStatus = imcode::Success; + resetAtomicWrite(delegate, endpoint); + imcode status = (presetsStatus == imcode::Success && schedulesStatus == imcode::Success) ? imcode::Success : imcode::Failure; + commandObj->AddResponse(commandPath, buildAtomicResponse(status, presetsStatus, schedulesStatus)); } -bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, +void handleAtomicRollback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::AtomicRequest::DecodableType & commandData) { - if (!validAtomicAttributes(commandData)) + if (!validAtomicAttributes(commandData, true)) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); - return true; + return; } EndpointId endpoint = commandPath.mEndpointId; bool inAtomicWrite = gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint); if (!inAtomicWrite) { commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; + return; } Delegate * delegate = GetDelegate(endpoint); @@ -1641,14 +1629,14 @@ bool handleAtomicRollback(chip::app::CommandHandler * commandObj, const chip::ap { ChipLogError(Zcl, "Delegate is null"); commandObj->AddStatus(commandPath, imcode::InvalidInState); - return true; + return; } - return SendResponseAndCleanUp(delegate, endpoint, commandObj, commandPath, imcode::Success); + resetAtomicWrite(delegate, endpoint); + commandObj->AddResponse(commandPath, buildAtomicResponse(imcode::Success, imcode::Success, imcode::Success)); } -bool emberAfThermostatClusterAtomicRequestCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) +bool emberAfThermostatClusterAtomicRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, + const Clusters::Thermostat::Commands::AtomicRequest::DecodableType & commandData) { auto & requestType = commandData.requestType; @@ -1658,11 +1646,14 @@ bool emberAfThermostatClusterAtomicRequestCallback( switch (requestType) { case Globals::AtomicRequestTypeEnum::kBeginWrite: - return handleAtomicBegin(commandObj, commandPath, commandData); + handleAtomicBegin(commandObj, commandPath, commandData); + return true; case Globals::AtomicRequestTypeEnum::kCommitWrite: - return handleAtomicCommit(commandObj, commandPath, commandData); + handleAtomicCommit(commandObj, commandPath, commandData); + return true; case Globals::AtomicRequestTypeEnum::kRollbackWrite: - return handleAtomicRollback(commandObj, commandPath, commandData); + handleAtomicRollback(commandObj, commandPath, commandData); + return true; case Globals::AtomicRequestTypeEnum::kUnknownEnumValue: commandObj->AddStatus(commandPath, imcode::InvalidCommand); return true; From be7ca9910069abd0cd6cac93415cd4a85ca280cc Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Fri, 2 Aug 2024 12:29:02 -0400 Subject: [PATCH 55/63] Patch tests for atomic write of presets --- .../linux/thermostat-delegate-impl.cpp | 42 +------- .../thermostat-server/thermostat-server.cpp | 8 +- .../tests/suites/certification/ci-pics-values | 6 +- .../python/chip/clusters/__init__.py | 4 +- src/python_testing/TC_TSTAT_4_2.py | 102 +++++++++--------- 5 files changed, 67 insertions(+), 95 deletions(-) diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index eaa76d0b71690c..a86a9058e9fc83 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -30,24 +30,6 @@ using namespace chip::app::Clusters::Thermostat::Structs; ThermostatDelegate ThermostatDelegate::sInstance; -namespace { - -/** - * @brief Checks if the presets are matching i.e the presetHandles are the same. - * - * @param[in] preset The preset to check. - * @param[in] presetToMatch The preset to match with. - * - * @return true If the presets match, false otherwise. If both preset handles are null, returns false - */ -bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) -{ - return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && - preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); -} - -} // anonymous namespace - ThermostatDelegate::ThermostatDelegate() { mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType; @@ -207,30 +189,14 @@ CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStruc CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() { - - // TODO: #34546 - Need to support deletion of presets that are removed from Presets. + mNextFreeIndexInPresetsList = 0; for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) { const PresetStructWithOwnedMembers & pendingPreset = mPendingPresets[indexInPendingPresets]; + mPresets[mNextFreeIndexInPresetsList] = pendingPreset; + mNextFreeIndexInPresetsList++; + ChipLogError(Zcl, "applied pending preset again"); - bool found = false; - for (uint8_t indexInPresets = 0; indexInPresets < mNextFreeIndexInPresetsList; indexInPresets++) - { - if (PresetHandlesExistAndMatch(mPresets[indexInPresets], pendingPreset)) - { - found = true; - - // Replace the preset with the pending preset - mPresets[indexInPresets] = pendingPreset; - } - } - - // If pending preset was not found in the Presets list, append to the Presets list. - if (!found) - { - mPresets[mNextFreeIndexInPresetsList] = pendingPreset; - mNextFreeIndexInPresetsList++; - } } return CHIP_NO_ERROR; } diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index b9c7806c31de95..1bc7e88d218370 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -860,6 +860,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // and add to the pending presets list. if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) { + ChipLogError(Zcl, "Replace all!"); // Clear the pending presets list delegate->ClearPendingPresetList(); @@ -886,6 +887,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // If the list operation is AppendItem, call the delegate to append the item to the list of pending presets. if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) { + ChipLogError(Zcl, "Appending again!"); PresetStruct::Type preset; ReturnErrorOnFailure(aDecoder.Decode(preset)); if (IsValidPresetEntry(preset)) @@ -1571,12 +1573,14 @@ imcode commitPresets(Delegate * delegate, EndpointId endpoint) { return imcode::InvalidInState; } + ChipLogError(Zcl, "committed presets"); return imcode::Success; } void handleAtomicCommit(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::AtomicRequest::DecodableType & commandData) { + ChipLogError(Zcl, "handleAtomicCommit"); if (!validAtomicAttributes(commandData, true)) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); @@ -1711,13 +1715,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index a8601fbd27d3ef..141af5d9090ba1 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2000,8 +2000,6 @@ TSTAT.S.C03.Rsp=0 TSTAT.S.C04.Rsp=0 TSTAT.S.C06.Rsp=1 TSTAT.S.C07.Rsp=1 -TSTAT.S.C08.Rsp=1 -TSTAT.S.C09.Rsp=1 # Client TSTAT.C=0 @@ -2018,12 +2016,10 @@ TSTAT.S.C00.Tx=0 TSTAT.S.C01.Tx=0 TSTAT.C.C06.Tx=1 TSTAT.C.C07.Tx=1 -TSTAT.C.C08.Tx=1 -TSTAT.C.C09.Tx=1 # Client Commands TSTAT.C.C00.Tx=1 -TSTAT.C.C04.Tx=0 +TSTAT.C.C04.Tx=1 # Access Control cluster ACL.S=1 diff --git a/src/controller/python/chip/clusters/__init__.py b/src/controller/python/chip/clusters/__init__.py index 5fbb13dcc616a9..b135345e9657de 100644 --- a/src/controller/python/chip/clusters/__init__.py +++ b/src/controller/python/chip/clusters/__init__.py @@ -32,7 +32,7 @@ EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, - GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, + Globals, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, OccupancySensing, OnOff, @@ -56,7 +56,7 @@ ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, - FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, + FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, Globals, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, diff --git a/src/python_testing/TC_TSTAT_4_2.py b/src/python_testing/TC_TSTAT_4_2.py index 9a8a8733830cec..609b67284f5361 100644 --- a/src/python_testing/TC_TSTAT_4_2.py +++ b/src/python_testing/TC_TSTAT_4_2.py @@ -61,32 +61,36 @@ async def write_presets(self, endpoint, presets) -> Status: result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, cluster.Attributes.Presets(presets))]) return result[0].Status - async def send_edit_preset_request_command(self, + async def send_edit_atomic_request_begin_command(self, endpoint: int = None, expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.StartPresetsSchedulesEditRequest(timeoutSeconds=180), + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=0, + attributeRequests=[cluster.Attributes.Presets.attribute_id], + timeout=1800), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_commit_preset_request_command(self, + async def send_edit_atomic_request_commit_command(self, endpoint: int = None, expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.CommitPresetsSchedulesRequest(), + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=1, + attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_cancel_preset_request_command(self, + async def send_edit_atomic_request_rollback_command(self, endpoint: int = None, expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.CancelPresetsSchedulesEditRequest(), + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=2, + attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) except InteractionModelError as e: @@ -116,11 +120,11 @@ def steps_TC_TSTAT_4_2(self) -> list[TestStep]: steps = [ TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH writes to the Presets attribute without calling the StartPresetsSchedulesEditRequest command", - " Verify that the write request returns INVALID_IN_STATE error since the client didn't send a request to edit the presets by calling StartPresetsSchedulesEditRequest command."), - TestStep("3", "TH writes to the Presets attribute after calling the StartPresetsSchedulesEditRequest command but doesn't call CommitPresetsSchedulesRequest to commit", + TestStep("2", "TH writes to the Presets attribute without calling the AtomicRequest command", + " Verify that the write request returns INVALID_IN_STATE error since the client didn't send a request to edit the presets by calling AtomicRequest command."), + TestStep("3", "TH writes to the Presets attribute after calling the AtomicRequest command but doesn't call CommitPresetsSchedulesRequest to commit", "Verify that the Presets attribute was not updated since CommitPresetsSchedulesRequest command was not called."), - TestStep("4", "TH writes to the Presets attribute after calling the StartPresetsSchedulesEditRequest command and calls CommitPresetsSchedulesRequest to commit", + TestStep("4", "TH writes to the Presets attribute after calling the AtomicRequest command and calls CommitPresetsSchedulesRequest to commit", "Verify that the Presets attribute was updated with new presets."), TestStep("5", "TH writes to the Presets attribute with a built-in preset removed", "Verify that the CommitPresetsSchedulesRequest returned UNSUPPORTED_ACCESS (0x7e)."), @@ -139,7 +143,7 @@ def steps_TC_TSTAT_4_2(self) -> list[TestStep]: TestStep("12", "TH writes to the Presets attribute with a preset that doesn't support names in the PresetTypeFeatures bitmap but has a name", "Verify that the CommitPresetsSchedulesRequest returned CONSTRAINT_ERROR (0x87)."), TestStep("13", "TH writes to the Presets attribute but calls the CancelPresetsSchedulesEditRequest command to cancel the edit request", - "Verify that the edit request was cancelled"), + "Verify that the edit request was cancelled"),*/ ] return steps @@ -157,16 +161,16 @@ async def test_TC_TSTAT_4_2(self): logger.info(f"Rx'd Presets: {presets}") asserts.assert_equal(presets, initial_presets, "Presets do not match initial value") - # Write to the presets attribute without calling StartPresetsSchedulesEditRequest command + # Write to the presets attribute without calling AtomicRequest command status = await self.write_presets(endpoint=endpoint, presets=new_presets) status_ok = (status == Status.InvalidInState) asserts.assert_true(status_ok, "Presets write did not return InvalidInState as expected") self.step("3") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp")): - await self.send_edit_preset_request_command() + await self.send_edit_atomic_request_begin_command() - # Write to the presets attribute after calling StartPresetsSchedulesEditRequest command + # Write to the presets attribute after calling AtomicRequest command status = await self.write_presets(endpoint=endpoint, presets=new_presets) status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") @@ -174,21 +178,23 @@ async def test_TC_TSTAT_4_2(self): # Read the presets attribute and verify it was not updated since CommitPresetsSchedulesRequest was not called after writing presets presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) logger.info(f"Rx'd Presets: {presets}") - asserts.assert_equal(presets, initial_presets, "Presets were updated which is not expected") + asserts.assert_equal(presets, new_presets_with_handle, "Presets were updated which is not expected") + + await self.send_edit_atomic_request_rollback_command() self.step("4") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C07.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() - # Write to the presets attribute after calling StartPresetsSchedulesEditRequest command + # Write to the presets attribute after calling AtomicRequest command status = await self.write_presets(endpoint=endpoint, presets=new_presets) status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command - await self.send_commit_preset_request_command() + await self.send_edit_atomic_request_commit_command() # Read the presets attribute and verify it was updated since CommitPresetsSchedulesRequest was called after writing presets presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) @@ -198,8 +204,8 @@ async def test_TC_TSTAT_4_2(self): self.step("5") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after removing a built in preset from the list. Remove the first entry. test_presets = new_presets_with_handle.copy() @@ -209,7 +215,7 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) self.step("6") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C06.Rsp") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): @@ -222,8 +228,8 @@ async def test_TC_TSTAT_4_2(self): logger.info(f"Rx'd ActivePresetHandle: {activePresetHandle}") asserts.assert_equal(activePresetHandle, b'\x03', "Active preset handle was not updated as expected") - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after removing the preset that was set as the active preset handle. Remove the last entry with preset handle (b'\x03') test_presets = new_presets_with_handle.copy() @@ -233,13 +239,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect InvalidInState - await self.send_commit_preset_request_command(expected_status=Status.InvalidInState) + await self.send_edit_atomic_request_commit_command(expected_status=Status.InvalidInState) self.step("7") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting the builtIn flag to False for preset with handle (b'\x01') test_presets = copy.deepcopy(new_presets_with_handle) @@ -250,13 +256,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) self.step("8") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a preset with builtIn set to True test_presets = copy.deepcopy(new_presets_with_handle) @@ -268,13 +274,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) self.step("9") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a preset with a preset handle that doesn't exist in Presets attribute test_presets = copy.deepcopy(new_presets_with_handle) @@ -286,13 +292,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect NotFound - await self.send_commit_preset_request_command(expected_status=Status.NotFound) + await self.send_edit_atomic_request_commit_command(expected_status=Status.NotFound) self.step("10") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a duplicate preset with handle (b'\x03') test_presets = copy.deepcopy(new_presets_with_handle) @@ -304,13 +310,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) self.step("11") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting the builtIn flag to True for preset with handle (b'\x03') test_presets = copy.deepcopy(new_presets_with_handle) @@ -321,13 +327,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) self.step("12") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting a name for preset with handle (b'\x01') that doesn't support names test_presets = copy.deepcopy(new_presets_with_handle) @@ -338,13 +344,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) self.step("13") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute with a new valid preset added test_presets = copy.deepcopy(new_presets_with_handle) @@ -356,10 +362,10 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CancelPresetsSchedulesRequest command - await self.send_cancel_preset_request_command() + await self.send_edit_atomic_request_rollback_command() # Send the CommitPresetsSchedulesRequest command and expect InvalidInState as the previous edit request was cancelled - await self.send_commit_preset_request_command(expected_status=Status.InvalidInState) + await self.send_edit_atomic_request_commit_command(expected_status=Status.InvalidInState) # TODO: Add tests for the total number of Presets exceeds the NumberOfPresets supported. Also Add tests for adding presets with preset scenario not present in PresetTypes. From 23f3063e4e524a74d79c3ff19eb66ba724a89e6b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 2 Aug 2024 17:39:11 -0400 Subject: [PATCH 56/63] Fix tests to work with the new setup. Specific changes: * Enable SetActivePresetRequest command in all-clusters-app. * Fix assignment of a PresetStructWithOwnedMembers to another PresetStructWithOwnedMembers to actually work correctly. * Move constraint checks that happen on write from commit to write. * Fix sending of atomic responses to not have use-stack-after-return. * Fix PICS for the tests involved. --- .../all-clusters-app.matter | 1 + .../all-clusters-common/all-clusters-app.zap | 8 + .../linux/thermostat-delegate-impl.cpp | 2 - .../PresetStructWithOwnedMembers.cpp | 5 + .../PresetStructWithOwnedMembers.h | 1 + .../thermostat-server/thermostat-server.cpp | 184 +++++++++--------- .../thermostat-server/thermostat-server.h | 2 + src/app/tests/suites/certification/PICS.yaml | 19 +- .../tests/suites/certification/ci-pics-values | 3 +- src/python_testing/TC_TSTAT_4_2.py | 156 ++++++++------- 10 files changed, 199 insertions(+), 182 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 bca9148300dca7..98600d1080ceff 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 @@ -8866,6 +8866,7 @@ endpoint 1 { ram attribute clusterRevision default = 6; handle command SetpointRaiseLower; + handle command SetActivePresetRequest; handle command AtomicResponse; handle command AtomicRequest; } 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 d8e1be226c9af4..5f659abc1503a0 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 @@ -16394,6 +16394,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "SetActivePresetRequest", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, { "name": "AtomicResponse", "code": 253, diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index a86a9058e9fc83..61d496f233b408 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -195,8 +195,6 @@ CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() const PresetStructWithOwnedMembers & pendingPreset = mPendingPresets[indexInPendingPresets]; mPresets[mNextFreeIndexInPresetsList] = pendingPreset; mNextFreeIndexInPresetsList++; - ChipLogError(Zcl, "applied pending preset again"); - } return CHIP_NO_ERROR; } diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index dfc395f6bee81d..45eb8f5ebfd95b 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -50,6 +50,11 @@ void PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) SetBuiltIn(other.builtIn); } +void PresetStructWithOwnedMembers::operator=(const PresetStructWithOwnedMembers & other) +{ + *this = static_cast(other); +} + void PresetStructWithOwnedMembers::SetPresetScenario(PresetScenarioEnum enumValue) { presetScenario = enumValue; diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h index 7161fb874989e2..d31cbc3b2cb409 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h @@ -43,6 +43,7 @@ struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type PresetStructWithOwnedMembers() = default; PresetStructWithOwnedMembers(const Structs::PresetStruct::Type & other); void operator=(const Structs::PresetStruct::Type & other); + void operator=(const PresetStructWithOwnedMembers & other); void SetPresetScenario(PresetScenarioEnum enumValue); CHIP_ERROR SetPresetHandle(const DataModel::Nullable & newPresetHandle); diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index 1bc7e88d218370..d4c85f56e1b89a 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -192,13 +192,10 @@ ScopedNodeId GetSourceScopedNodeId(CommandHandler * commandObj) } /** - * @brief Sends a response for the command and cleans up state by calling CleanUp() + * @brief Discards pending atomic writes and atomic state. * * @param[in] delegate The delegate to use. * @param[in] endpoint The endpoint to use. - * @param[in] commandObj The command handler to use to add the status response. - * @param[in] commandPath The command path. - * @param[in] status The status code to send as the response. * */ void resetAtomicWrite(Delegate * delegate, EndpointId endpoint) @@ -250,8 +247,8 @@ bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwne } /** - * @brief Finds and returns an entry in the Presets attribute list that matches a preset. - * The presetHandle of the two presets must match. + * @brief Finds and returns an entry in the Presets attribute list that matches + * a preset, if such an entry exists. The presetToMatch must have a preset handle. * * @param[in] delegate The delegate to use. * @param[in] presetToMatch The preset to match with. @@ -259,7 +256,7 @@ bool MatchingPendingPresetExists(Delegate * delegate, const PresetStructWithOwne * * @return true if a matching entry was found in the presets attribute list, false otherwise. */ -bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStructWithOwnedMembers & presetToMatch, +bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStruct::Type & presetToMatch, PresetStructWithOwnedMembers & matchingPreset) { VerifyOrReturnValue(delegate != nullptr, false); @@ -278,7 +275,8 @@ bool GetMatchingPresetInPresets(Delegate * delegate, const PresetStructWithOwned return false; } - if (PresetHandlesExistAndMatch(matchingPreset, presetToMatch)) + // Note: presets coming from our delegate always have a handle. + if (presetToMatch.presetHandle.Value().data_equal(matchingPreset.GetPresetHandle().Value())) { return true; } @@ -860,7 +858,6 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // and add to the pending presets list. if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) { - ChipLogError(Zcl, "Replace all!"); // Clear the pending presets list delegate->ClearPendingPresetList(); @@ -872,14 +869,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, while (iter.Next()) { const PresetStruct::Type & preset = iter.GetValue(); - if (IsValidPresetEntry(preset)) - { - ReturnErrorOnFailure(delegate->AppendToPendingPresetList(preset)); - } - else - { - return CHIP_IM_GLOBAL_STATUS(ConstraintError); - } + ReturnErrorOnFailure(AppendPendingPreset(delegate, preset)); } return iter.GetStatus(); } @@ -887,14 +877,9 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // If the list operation is AppendItem, call the delegate to append the item to the list of pending presets. if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) { - ChipLogError(Zcl, "Appending again!"); PresetStruct::Type preset; ReturnErrorOnFailure(aDecoder.Decode(preset)); - if (IsValidPresetEntry(preset)) - { - return delegate->AppendToPendingPresetList(preset); - } - return CHIP_IM_GLOBAL_STATUS(ConstraintError); + return AppendPendingPreset(delegate, preset); } } break; @@ -939,6 +924,60 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, return CHIP_NO_ERROR; } +CHIP_ERROR ThermostatAttrAccess::AppendPendingPreset(Delegate * delegate, const PresetStruct::Type & preset) +{ + if (!IsValidPresetEntry(preset)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + if (preset.presetHandle.IsNull()) + { + if (IsBuiltIn(preset)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + } + else + { + auto & presetHandle = preset.presetHandle.Value(); + + // Per spec we need to check that: + // (a) There is an existing non-pending preset with this handle. + PresetStructWithOwnedMembers matchingPreset; + if (!GetMatchingPresetInPresets(delegate, preset, matchingPreset)) + { + return CHIP_IM_GLOBAL_STATUS(NotFound); + } + + // (b) There is no existing pending preset with this handle. + if (CountPresetsInPendingListWithPresetHandle(delegate, presetHandle) > 0) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + // (c)/(d) The built-in fields do not have a mismatch. + // TODO: What's the story with nullability on the BuiltIn field? + if (!preset.builtIn.IsNull() && !matchingPreset.GetBuiltIn().IsNull() && + preset.builtIn.Value() != matchingPreset.GetBuiltIn().Value()) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + } + + if (!PresetScenarioExistsInPresetTypes(delegate, preset.presetScenario)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + if (preset.name.HasValue() && !PresetTypeSupportsNames(delegate, preset.presetScenario)) + { + return CHIP_IM_GLOBAL_STATUS(ConstraintError); + } + + return delegate->AppendToPendingPresetList(preset); +} + } // namespace Thermostat } // namespace Clusters } // namespace app @@ -1341,7 +1380,8 @@ bool validAtomicAttributes(const Commands::AtomicRequest::DecodableType & comman return (requestedPresets || requestedSchedules); } -Commands::AtomicResponse::Type buildAtomicResponse(imcode status, imcode presetsStatus, imcode schedulesStatus) +void sendAtomicResponse(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, imcode status, imcode presetsStatus, + imcode schedulesStatus, Optional timeout = NullOptional) { Commands::AtomicResponse::Type response; Globals::Structs::AtomicAttributeStatusStruct::Type attributeStatus[] = { @@ -1350,7 +1390,8 @@ Commands::AtomicResponse::Type buildAtomicResponse(imcode status, imcode presets }; response.statusCode = to_underlying(status); response.attributeStatus = attributeStatus; - return response; + response.timeout = timeout; + commandObj->AddResponse(commandPath, response); } void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, @@ -1358,6 +1399,15 @@ void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & { EndpointId endpoint = commandPath.mEndpointId; + Delegate * delegate = GetDelegate(endpoint); + + if (delegate == nullptr) + { + ChipLogError(Zcl, "Delegate is null"); + commandObj->AddStatus(commandPath, imcode::InvalidInState); + return; + } + if (gThermostatAttrAccess.InAtomicWrite(commandObj, endpoint)) { // This client already has an open atomic write @@ -1381,11 +1431,13 @@ void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & if (gThermostatAttrAccess.InAtomicWrite(endpoint)) { - commandObj->AddResponse(commandPath, buildAtomicResponse(imcode::Failure, imcode::Busy, imcode::Busy)); + sendAtomicResponse(commandObj, commandPath, imcode::Failure, imcode::Busy, imcode::Busy); return; } - // This is a valid request to open an atomic write. Note that + // This is a valid request to open an atomic write. Tell the delegate it + // needs to keep track of a pending preset list now. + delegate->InitializePendingPresets(); uint16_t maxTimeout = 5000; timeout = std::min(timeout, maxTimeout); @@ -1393,21 +1445,19 @@ void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & ScheduleTimer(endpoint, System::Clock::Milliseconds16(timeout)); gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); - auto response = buildAtomicResponse(imcode::Success, imcode::Success, imcode::Success); - response.timeout.Emplace(timeout); - commandObj->AddResponse(commandPath, response); + sendAtomicResponse(commandObj, commandPath, imcode::Success, imcode::Success, imcode::Success, MakeOptional(timeout)); return; } imcode commitPresets(Delegate * delegate, EndpointId endpoint) { - PresetStructWithOwnedMembers preset; CHIP_ERROR err = CHIP_NO_ERROR; // For each preset in the presets attribute, check that the matching preset in the pending presets list does not // violate any spec constraints. for (uint8_t i = 0; true; i++) { + PresetStructWithOwnedMembers preset; err = delegate->GetPresetAtIndex(i, preset); if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED) @@ -1454,6 +1504,7 @@ imcode commitPresets(Delegate * delegate, EndpointId endpoint) return imcode::InvalidInState; } } + // For each preset in the pending presets list, check that the preset does not violate any spec constraints. for (uint8_t i = 0; true; i++) { @@ -1473,66 +1524,8 @@ imcode commitPresets(Delegate * delegate, EndpointId endpoint) return imcode::InvalidInState; } - bool isPendingPresetWithNullPresetHandle = pendingPreset.GetPresetHandle().IsNull(); - - // If the preset handle is null and the built in field is set to true, return CONSTRAINT_ERROR. - if (isPendingPresetWithNullPresetHandle && IsBuiltIn(pendingPreset)) - { - return imcode::ConstraintError; - } - - bool foundMatchingPresetInPresets = false; - PresetStructWithOwnedMembers matchingPreset; - if (!isPendingPresetWithNullPresetHandle) - { - foundMatchingPresetInPresets = GetMatchingPresetInPresets(delegate, pendingPreset, matchingPreset); - - // If the presetHandle for the pending preset is not null and a matching preset is not found in the - // presets attribute list, return NOT_FOUND. - if (!foundMatchingPresetInPresets) - { - return imcode::NotFound; - } - - // Find the number of presets in the pending preset list that match the preset handle. If there are duplicate - // entries, return CONSTRAINT_ERROR. - uint8_t count = CountPresetsInPendingListWithPresetHandle(delegate, pendingPreset.GetPresetHandle().Value()); - if (count > 1) - { - return imcode::ConstraintError; - } - } - - // If the BuiltIn field is true, and the PresetStruct in the current value with a - // matching PresetHandle field has a BuiltIn field set to false, a response - // with the status code CONSTRAINT_ERROR SHALL be returned. - if (foundMatchingPresetInPresets && (IsBuiltIn(pendingPreset) && !IsBuiltIn(matchingPreset))) - { - return imcode::ConstraintError; - } - - // If the BuiltIn field is false, and the PresetStruct in the current value with a - // matching PresetHandle field has a BuiltIn field set to true, a response - // with the status code CONSTRAINT_ERROR SHALL be returned. - if (foundMatchingPresetInPresets && (!IsBuiltIn(pendingPreset) && IsBuiltIn(matchingPreset))) - { - return imcode::ConstraintError; - } - - // If the presetScenario is not found in the preset types, return CONSTRAINT_ERROR. - PresetScenarioEnum presetScenario = pendingPreset.GetPresetScenario(); - if (!PresetScenarioExistsInPresetTypes(delegate, presetScenario)) - { - return imcode::ConstraintError; - } - - // If the preset type for the preset scenario does not support names and a name is specified, return CONSTRAINT_ERROR. - if (!PresetTypeSupportsNames(delegate, presetScenario) && pendingPreset.GetName().HasValue()) - { - return imcode::ConstraintError; - } - // Enforce the Setpoint Limits for both the cooling and heating setpoints in the pending preset. + // TODO: This code does not work, because it's modifying our temporary copy. Optional coolingSetpointValue = pendingPreset.GetCoolingSetpoint(); if (coolingSetpointValue.HasValue()) { @@ -1573,14 +1566,13 @@ imcode commitPresets(Delegate * delegate, EndpointId endpoint) { return imcode::InvalidInState; } - ChipLogError(Zcl, "committed presets"); + return imcode::Success; } void handleAtomicCommit(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::AtomicRequest::DecodableType & commandData) { - ChipLogError(Zcl, "handleAtomicCommit"); if (!validAtomicAttributes(commandData, true)) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); @@ -1608,7 +1600,7 @@ void handleAtomicCommit(CommandHandler * commandObj, const ConcreteCommandPath & auto schedulesStatus = imcode::Success; resetAtomicWrite(delegate, endpoint); imcode status = (presetsStatus == imcode::Success && schedulesStatus == imcode::Success) ? imcode::Success : imcode::Failure; - commandObj->AddResponse(commandPath, buildAtomicResponse(status, presetsStatus, schedulesStatus)); + sendAtomicResponse(commandObj, commandPath, status, presetsStatus, schedulesStatus); } void handleAtomicRollback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, @@ -1636,7 +1628,7 @@ void handleAtomicRollback(CommandHandler * commandObj, const ConcreteCommandPath return; } resetAtomicWrite(delegate, endpoint); - commandObj->AddResponse(commandPath, buildAtomicResponse(imcode::Success, imcode::Success, imcode::Success)); + sendAtomicResponse(commandObj, commandPath, imcode::Success, imcode::Success, imcode::Success); } bool emberAfThermostatClusterAtomicRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, @@ -1715,13 +1707,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { diff --git a/src/app/clusters/thermostat-server/thermostat-server.h b/src/app/clusters/thermostat-server/thermostat-server.h index 230f21b0ccfe25..306a2a625c57b6 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.h +++ b/src/app/clusters/thermostat-server/thermostat-server.h @@ -105,6 +105,8 @@ class ThermostatAttrAccess : public chip::app::AttributeAccessInterface bool InAtomicWrite(CommandHandler * commandObj, EndpointId endpoint); private: + CHIP_ERROR AppendPendingPreset(Delegate * delegate, const Structs::PresetStruct::Type & preset); + ScopedNodeId mAtomicWriteNodeIds[kThermostatEndpointCount]; bool mAtomicWriteState[kThermostatEndpointCount]; }; diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 8a3e1fce94326f..cfe4681f7fb2c3 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -6523,19 +6523,9 @@ PICS: id: TSTAT.S.C06.Rsp - label: - "Does the device implement receiving the - StartPresetsSchedulesEditRequest command?" - id: TSTAT.S.C07.Rsp - - - label: - "Does the device implement receiving the - CancelPresetsSchedulesEditRequest command?" - id: TSTAT.S.C08.Rsp - - - label: - "Does the device implement receiving the CommitPresetsSchedulesRequest - command?" - id: TSTAT.S.C09.Rsp + "Does the device implement receiving the AtomicRequest command for + Thermostat?" + id: TSTAT.S.CFE.Rsp # # server / commandsGenerated @@ -6550,6 +6540,9 @@ PICS: command?" id: TSTAT.S.C01.Tx + - label: "Does the device implement sending the AtomicResponse command?" + id: TSTAT.S.CFD.Tx + # # server / features # diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 141af5d9090ba1..6960d3388859f1 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -1999,7 +1999,8 @@ TSTAT.S.C02.Rsp=0 TSTAT.S.C03.Rsp=0 TSTAT.S.C04.Rsp=0 TSTAT.S.C06.Rsp=1 -TSTAT.S.C07.Rsp=1 +TSTAT.S.CFE.Rsp=1 +TSTAT.S.CFD.Tx=1 # Client TSTAT.C=0 diff --git a/src/python_testing/TC_TSTAT_4_2.py b/src/python_testing/TC_TSTAT_4_2.py index 609b67284f5361..513715b7d30f31 100644 --- a/src/python_testing/TC_TSTAT_4_2.py +++ b/src/python_testing/TC_TSTAT_4_2.py @@ -62,11 +62,12 @@ async def write_presets(self, endpoint, presets) -> Status: return result[0].Status async def send_edit_atomic_request_begin_command(self, - endpoint: int = None, - expected_status: Status = Status.Success): + endpoint: int = None, + expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=0, - attributeRequests=[cluster.Attributes.Presets.attribute_id], + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=0, + attributeRequests=[ + cluster.Attributes.Presets.attribute_id], timeout=1800), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) @@ -75,21 +76,31 @@ async def send_edit_atomic_request_begin_command(self, asserts.assert_equal(e.status, expected_status, "Unexpected error returned") async def send_edit_atomic_request_commit_command(self, - endpoint: int = None, - expected_status: Status = Status.Success): + endpoint: int = None, + expected_status: Status = Status.Success, + expected_overall_status: Status = Status.Success, + expected_preset_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=1, - attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), - endpoint=endpoint) - asserts.assert_equal(expected_status, Status.Success) + response = await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=1, + attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), + endpoint=endpoint) + asserts.assert_equal(expected_status, Status.Success, "We expected we had a valid commit command") + asserts.assert_equal(response.statusCode, expected_overall_status, "Commit should have the right overall status") + found_preset_status = False + for attrStatus in response.attributeStatus: + if attrStatus.attributeID == cluster.Attributes.Presets.attribute_id: + asserts.assert_equal(attrStatus.statusCode, expected_preset_status, + "Preset attribute commit should have the right status") + found_preset_status = True + asserts.assert_true(found_preset_status, "Preset attribute commit should have a status") except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") async def send_edit_atomic_request_rollback_command(self, - endpoint: int = None, - expected_status: Status = Status.Success): + endpoint: int = None, + expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=2, + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=2, attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) @@ -143,7 +154,7 @@ def steps_TC_TSTAT_4_2(self) -> list[TestStep]: TestStep("12", "TH writes to the Presets attribute with a preset that doesn't support names in the PresetTypeFeatures bitmap but has a name", "Verify that the CommitPresetsSchedulesRequest returned CONSTRAINT_ERROR (0x87)."), TestStep("13", "TH writes to the Presets attribute but calls the CancelPresetsSchedulesEditRequest command to cancel the edit request", - "Verify that the edit request was cancelled"),*/ + "Verify that the edit request was cancelled"), ] return steps @@ -167,7 +178,7 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return InvalidInState as expected") self.step("3") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after calling AtomicRequest command @@ -175,17 +186,21 @@ async def test_TC_TSTAT_4_2(self): status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") - # Read the presets attribute and verify it was not updated since CommitPresetsSchedulesRequest was not called after writing presets + # Read the presets attribute and verify it was updated by the write presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) logger.info(f"Rx'd Presets: {presets}") - asserts.assert_equal(presets, new_presets_with_handle, "Presets were updated which is not expected") + asserts.assert_equal(presets, new_presets_with_handle, "Presets were updated, as expected") await self.send_edit_atomic_request_rollback_command() + # Read the presets attribute and verify it has been properly rolled back + presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) + asserts.assert_equal(presets, initial_presets, "Presets were updated which is not expected") + self.step("4") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C07.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after calling AtomicRequest command @@ -193,18 +208,18 @@ async def test_TC_TSTAT_4_2(self): status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") - # Send the CommitPresetsSchedulesRequest command + # Send the AtomicRequest commit command await self.send_edit_atomic_request_commit_command() - # Read the presets attribute and verify it was updated since CommitPresetsSchedulesRequest was called after writing presets + # Read the presets attribute and verify it was updated since AtomicRequest commit was called after writing presets presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) logger.info(f"Rx'd Presets: {presets}") asserts.assert_equal(presets, new_presets_with_handle, "Presets were not updated which is not expected") self.step("5") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after removing a built in preset from the list. Remove the first entry. @@ -214,11 +229,11 @@ async def test_TC_TSTAT_4_2(self): status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") - # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) + # Send the AtomicRequest commit command and expect ConstraintError for presets. + await self.send_edit_atomic_request_commit_command(expected_overall_status=Status.Failure, expected_preset_status=Status.ConstraintError) self.step("6") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C06.Rsp") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C06.Rsp") and self.check_pics("TSTAT.S.CFE.Rsp")): # Send the SetActivePresetRequest command await self.send_set_active_preset_handle_request_command(value=b'\x03') @@ -228,7 +243,7 @@ async def test_TC_TSTAT_4_2(self): logger.info(f"Rx'd ActivePresetHandle: {activePresetHandle}") asserts.assert_equal(activePresetHandle, b'\x03', "Active preset handle was not updated as expected") - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after removing the preset that was set as the active preset handle. Remove the last entry with preset handle (b'\x03') @@ -238,13 +253,13 @@ async def test_TC_TSTAT_4_2(self): status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") - # Send the CommitPresetsSchedulesRequest command and expect InvalidInState - await self.send_edit_atomic_request_commit_command(expected_status=Status.InvalidInState) + # Send the AtomicRequest commit command and expect InvalidInState for presets. + await self.send_edit_atomic_request_commit_command(expected_overall_status=Status.Failure, expected_preset_status=Status.InvalidInState) self.step("7") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting the builtIn flag to False for preset with handle (b'\x01') @@ -252,16 +267,16 @@ async def test_TC_TSTAT_4_2(self): test_presets[0].builtIn = False status = await self.write_presets(endpoint=endpoint, presets=test_presets) - status_ok = (status == Status.Success) - asserts.assert_true(status_ok, "Presets write did not return Success as expected") + asserts.assert_equal(status, Status.ConstraintError, + "Presets write should return ConstraintError, because BuiltIn values do not match") - # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) + # Clear state for next test. + await self.send_edit_atomic_request_rollback_command() self.step("8") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a preset with builtIn set to True @@ -271,15 +286,16 @@ async def test_TC_TSTAT_4_2(self): status = await self.write_presets(endpoint=endpoint, presets=test_presets) status_ok = (status == Status.Success) - asserts.assert_true(status_ok, "Presets write did not return Success as expected") + asserts.assert_equal(status, Status.ConstraintError, + "Presets write should return ConstraintError, since we are trying to add a new built-in preset") - # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) + # Clear state for next test. + await self.send_edit_atomic_request_rollback_command() self.step("9") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a preset with a preset handle that doesn't exist in Presets attribute @@ -288,16 +304,16 @@ async def test_TC_TSTAT_4_2(self): name="Wake", coolingSetpoint=2800, heatingSetpoint=1800, builtIn=True)) status = await self.write_presets(endpoint=endpoint, presets=test_presets) - status_ok = (status == Status.Success) - asserts.assert_true(status_ok, "Presets write did not return Success as expected") + asserts.assert_equal(status, Status.NotFound, + "Presets write should return NotFound, since we are trying to modify non-existent preset") - # Send the CommitPresetsSchedulesRequest command and expect NotFound - await self.send_edit_atomic_request_commit_command(expected_status=Status.NotFound) + # Clear state for next test. + await self.send_edit_atomic_request_rollback_command() self.step("10") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a duplicate preset with handle (b'\x03') @@ -306,16 +322,16 @@ async def test_TC_TSTAT_4_2(self): presetHandle=b'\x03', presetScenario=cluster.Enums.PresetScenarioEnum.kSleep, name="Sleep", coolingSetpoint=2700, heatingSetpoint=1900, builtIn=False)) status = await self.write_presets(endpoint=endpoint, presets=test_presets) - status_ok = (status == Status.Success) - asserts.assert_true(status_ok, "Presets write did not return Success as expected") + asserts.assert_equal(status, Status.ConstraintError, + "Presets write should return ConstraintError, since we have duplicated presets") - # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) + # Clear state for next test. + await self.send_edit_atomic_request_rollback_command() self.step("11") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting the builtIn flag to True for preset with handle (b'\x03') @@ -323,16 +339,16 @@ async def test_TC_TSTAT_4_2(self): test_presets[2].builtIn = True status = await self.write_presets(endpoint=endpoint, presets=test_presets) - status_ok = (status == Status.Success) - asserts.assert_true(status_ok, "Presets write did not return Success as expected") + asserts.assert_equal(status, Status.ConstraintError, + "Presets write should return ConstraintError, since we are trying to change whether a preset is BuiltIn") - # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) + # Clear state for next test. + await self.send_edit_atomic_request_rollback_command() self.step("12") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting a name for preset with handle (b'\x01') that doesn't support names @@ -340,31 +356,31 @@ async def test_TC_TSTAT_4_2(self): test_presets[0].name = "Occupied" status = await self.write_presets(endpoint=endpoint, presets=test_presets) - status_ok = (status == Status.Success) - asserts.assert_true(status_ok, "Presets write did not return Success as expected") + asserts.assert_equal(status, Status.ConstraintError, + "Presets write should return ConstraintError, since we are trying to set a name for a preset that does not support that") - # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) + # Clear state for next test. + await self.send_edit_atomic_request_rollback_command() self.step("13") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.CFE.Rsp")): - # Send the AtomicRequest command + # Send the AtomicRequest begin command await self.send_edit_atomic_request_begin_command() # Write to the presets attribute with a new valid preset added test_presets = copy.deepcopy(new_presets_with_handle) - test_presets.append(cluster.Structs.PresetStruct(presetHandle=b'\x04', presetScenario=cluster.Enums.PresetScenarioEnum.kWake, + test_presets.append(cluster.Structs.PresetStruct(presetHandle=NullValue, presetScenario=cluster.Enums.PresetScenarioEnum.kWake, name="Wake", coolingSetpoint=2800, heatingSetpoint=1800, builtIn=False)) status = await self.write_presets(endpoint=endpoint, presets=test_presets) status_ok = (status == Status.Success) - asserts.assert_true(status_ok, "Presets write did not return Success as expected") + asserts.assert_equal(status, Status.Success, "Presets write did not return Success as expected") - # Send the CancelPresetsSchedulesRequest command + # Roll back await self.send_edit_atomic_request_rollback_command() - # Send the CommitPresetsSchedulesRequest command and expect InvalidInState as the previous edit request was cancelled + # Send the AtomicRequest commit command and expect InvalidInState as the previous edit request was cancelled await self.send_edit_atomic_request_commit_command(expected_status=Status.InvalidInState) # TODO: Add tests for the total number of Presets exceeds the NumberOfPresets supported. Also Add tests for adding presets with preset scenario not present in PresetTypes. From c37228cd23908845721c5ef5bfbb26b069dc4121 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 4 Aug 2024 14:37:59 -0700 Subject: [PATCH 57/63] Fix PICS values for atomic requests --- src/app/tests/suites/certification/PICS.yaml | 14 ++------------ .../suites/certification/Test_TC_TSTAT_1_1.yaml | 2 +- src/app/tests/suites/certification/ci-pics-values | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index cfe4681f7fb2c3..a4b36ddc549653 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -6617,18 +6617,8 @@ PICS: - label: "Does the device implement sending the - StartPresetsSchedulesEditRequest command?" - id: TSTAT.C.C07.Tx - - - label: - "Does the device implement sending the - CancelPresetsSchedulesEditRequest command?" - id: TSTAT.C.C08.Tx - - - label: - "Does the device implement sending the CommitPresetsSchedulesRequest - command?" - id: TSTAT.C.C09.Tx + AtomicRequest command?" + id: TSTAT.C.CFE.Tx # # client / manually diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml index e09a3abee193e5..fe6b89ae930517 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml @@ -624,7 +624,7 @@ tests: response: constraints: type: list - contains: [6, 7, 8, 9] + contains: [254] - label: "Step 7a: TH reads from the DUT the GeneratedCommandList attribute." diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 6960d3388859f1..9e7c4d8aeb0bf2 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2016,7 +2016,7 @@ TSTAT.C.C03.Tx=0 TSTAT.S.C00.Tx=0 TSTAT.S.C01.Tx=0 TSTAT.C.C06.Tx=1 -TSTAT.C.C07.Tx=1 +TSTAT.C.CFE.Tx=1 # Client Commands TSTAT.C.C00.Tx=1 From ba877a86835a9b09b5a441cdb675b133c9049206 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 4 Aug 2024 16:28:31 -0700 Subject: [PATCH 58/63] Remove PresetsSchedulesEditable and QueuedPreset from various places --- .../zap/tests/inputs/all-clusters-app.zap | 108 ++++++++---------- .../app-templates/IMClusterCommandHandler.cpp | 27 +++++ .../all-clusters-app/app-templates/access.h | 3 + .../app-templates/endpoint_config.h | 60 +++++----- src/app/tests/suites/certification/PICS.yaml | 4 +- .../certification/Test_TC_TSTAT_4_1.yaml | 16 +-- .../CHIP/templates/availability.yaml | 1 - 7 files changed, 119 insertions(+), 100 deletions(-) diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 570e1711e53d6b..1cbd309ffa123a 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -17,13 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "category": "matter", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", @@ -31,6 +24,13 @@ "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", + "category": "matter", + "version": "chip-v1" } ], "endpointTypes": [ @@ -15920,6 +15920,38 @@ "source": "client", "isIncoming": 1, "isEnabled": 1 + }, + { + "name": "SetActiveScheduleRequest", + "code": 5, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetActivePresetRequest", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AtomicResponse", + "code": 253, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AtomicRequest", + "code": 254, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 } ], "attributes": [ @@ -16008,7 +16040,7 @@ "code": 17, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16024,7 +16056,7 @@ "code": 18, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16040,7 +16072,7 @@ "code": 21, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16056,7 +16088,7 @@ "code": 22, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16072,7 +16104,7 @@ "code": 23, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16088,7 +16120,7 @@ "code": 24, "mfgCode": null, "side": "server", - "type": "int16s", + "type": "temperature", "included": 1, "storageOption": "RAM", "singleton": 0, @@ -16291,41 +16323,9 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "PresetsSchedulesEditable", - "code": 82, - "mfgCode": null, - "side": "server", - "type": "boolean", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "TemperatureSetpointHoldPolicy", - "code": 83, - "mfgCode": null, - "side": "server", - "type": "TemperatureSetpointHoldPolicyBitmap", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "SetpointHoldExpiryTimestamp", - "code": 84, + "code": 82, "mfgCode": null, "side": "server", "type": "epoch_s", @@ -16339,22 +16339,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "QueuedPreset", - "code": 85, - "mfgCode": null, - "side": "server", - "type": "QueuedPresetStruct", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "GeneratedCommandList", "code": 65528, diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/IMClusterCommandHandler.cpp b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/IMClusterCommandHandler.cpp index 1594a2db87dfeb..dbfbc68a2bcf2f 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/IMClusterCommandHandler.cpp +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/IMClusterCommandHandler.cpp @@ -1420,6 +1420,33 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } + case Commands::SetActiveScheduleRequest::Id: { + Commands::SetActiveScheduleRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfThermostatClusterSetActiveScheduleRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::SetActivePresetRequest::Id: { + Commands::SetActivePresetRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfThermostatClusterSetActivePresetRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::AtomicRequest::Id: { + Commands::AtomicRequest::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfThermostatClusterAtomicRequestCallback(apCommandObj, aCommandPath, commandData); + } + break; + } default: { // Unrecognized command ID, error status will apply. apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h index 9b4ddb220986ad..8f0c8ef6cb729a 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/access.h @@ -400,6 +400,7 @@ 0x00000062, /* Cluster: Scenes Management, Command: RemoveScene, Privilege: manage */ \ 0x00000062, /* Cluster: Scenes Management, Command: RemoveAllScenes, Privilege: manage */ \ 0x00000062, /* Cluster: Scenes Management, Command: StoreScene, Privilege: manage */ \ + 0x00000201, /* Cluster: Thermostat, Command: AtomicRequest, Privilege: manage */ \ 0xFFF1FC06, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ 0xFFF1FC06, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } @@ -449,6 +450,7 @@ 0x00000002, /* Cluster: Scenes Management, Command: RemoveScene, Privilege: manage */ \ 0x00000003, /* Cluster: Scenes Management, Command: RemoveAllScenes, Privilege: manage */ \ 0x00000004, /* Cluster: Scenes Management, Command: StoreScene, Privilege: manage */ \ + 0x000000FE, /* Cluster: Thermostat, Command: AtomicRequest, Privilege: manage */ \ 0x00000000, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ 0x00000001, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } @@ -498,6 +500,7 @@ chip::Access::Privilege::kManage, /* Cluster: Scenes Management, Command: RemoveScene, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Scenes Management, Command: RemoveAllScenes, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Scenes Management, Command: StoreScene, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Thermostat, Command: AtomicRequest, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 8cf4b1fc93a2df..3423dab4902623 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -2590,13 +2590,19 @@ /* Endpoint: 1, Cluster: Thermostat (server) */\ /* AcceptedCommandList (index=241) */ \ 0x00000000 /* SetpointRaiseLower */, \ + 0x00000005 /* SetActiveScheduleRequest */, \ + 0x00000006 /* SetActivePresetRequest */, \ + 0x000000FE /* AtomicRequest */, \ + chip::kInvalidCommandId /* end of list */, \ + /* GeneratedCommandList (index=246)*/ \ + 0x000000FD /* AtomicResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Fan Control (server) */\ - /* AcceptedCommandList (index=243) */ \ + /* AcceptedCommandList (index=248) */ \ 0x00000000 /* Step */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Color Control (server) */\ - /* AcceptedCommandList (index=245) */ \ + /* AcceptedCommandList (index=250) */ \ 0x00000000 /* MoveToHue */, \ 0x00000001 /* MoveHue */, \ 0x00000002 /* StepHue */, \ @@ -2618,11 +2624,11 @@ 0x0000004C /* StepColorTemperature */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Low Power (server) */\ - /* AcceptedCommandList (index=265) */ \ + /* AcceptedCommandList (index=270) */ \ 0x00000000 /* Sleep */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Unit Testing (server) */\ - /* AcceptedCommandList (index=267) */ \ + /* AcceptedCommandList (index=272) */ \ 0x00000000 /* Test */, \ 0x00000001 /* TestNotHandled */, \ 0x00000002 /* TestSpecific */, \ @@ -2645,7 +2651,7 @@ 0x00000017 /* TestSecondBatchHelperRequest */, \ 0xFFF200AA /* TestDifferentVendorMeiRequest */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=289)*/ \ + /* GeneratedCommandList (index=294)*/ \ 0x00000000 /* TestSpecificResponse */, \ 0x00000001 /* TestAddArgumentsResponse */, \ 0x00000004 /* TestListInt8UReverseResponse */, \ @@ -2659,12 +2665,12 @@ 0xFFF200BB /* TestDifferentVendorMeiResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: Identify (server) */\ - /* AcceptedCommandList (index=301) */ \ + /* AcceptedCommandList (index=306) */ \ 0x00000000 /* Identify */, \ 0x00000040 /* TriggerEffect */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: Groups (server) */\ - /* AcceptedCommandList (index=304) */ \ + /* AcceptedCommandList (index=309) */ \ 0x00000000 /* AddGroup */, \ 0x00000001 /* ViewGroup */, \ 0x00000002 /* GetGroupMembership */, \ @@ -2672,14 +2678,14 @@ 0x00000004 /* RemoveAllGroups */, \ 0x00000005 /* AddGroupIfIdentifying */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=311)*/ \ + /* GeneratedCommandList (index=316)*/ \ 0x00000000 /* AddGroupResponse */, \ 0x00000001 /* ViewGroupResponse */, \ 0x00000002 /* GetGroupMembershipResponse */, \ 0x00000003 /* RemoveGroupResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: On/Off (server) */\ - /* AcceptedCommandList (index=316) */ \ + /* AcceptedCommandList (index=321) */ \ 0x00000000 /* Off */, \ 0x00000001 /* On */, \ 0x00000002 /* Toggle */, \ @@ -2688,7 +2694,7 @@ 0x00000042 /* OnWithTimedOff */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 2, Cluster: Scenes Management (server) */\ - /* AcceptedCommandList (index=323) */ \ + /* AcceptedCommandList (index=328) */ \ 0x00000000 /* AddScene */, \ 0x00000001 /* ViewScene */, \ 0x00000002 /* RemoveScene */, \ @@ -2698,7 +2704,7 @@ 0x00000006 /* GetSceneMembership */, \ 0x00000040 /* CopyScene */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=332)*/ \ + /* GeneratedCommandList (index=337)*/ \ 0x00000000 /* AddSceneResponse */, \ 0x00000001 /* ViewSceneResponse */, \ 0x00000002 /* RemoveSceneResponse */, \ @@ -2708,7 +2714,7 @@ 0x00000040 /* CopySceneResponse */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */\ - /* AcceptedCommandList (index=340) */ \ + /* AcceptedCommandList (index=345) */ \ 0x00000000 /* ScanNetworks */, \ 0x00000002 /* AddOrUpdateWiFiNetwork */, \ 0x00000003 /* AddOrUpdateThreadNetwork */, \ @@ -2716,7 +2722,7 @@ 0x00000006 /* ConnectNetwork */, \ 0x00000008 /* ReorderNetwork */, \ chip::kInvalidCommandId /* end of list */, \ - /* GeneratedCommandList (index=347)*/ \ + /* GeneratedCommandList (index=352)*/ \ 0x00000001 /* ScanNetworksResponse */, \ 0x00000005 /* NetworkConfigResponse */, \ 0x00000007 /* ConnectNetworkResponse */, \ @@ -3752,7 +3758,7 @@ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ), \ - .generatedCommandList = nullptr, \ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 246 ), \ .eventList = nullptr, \ .eventCount = 0, \ },\ @@ -3764,7 +3770,7 @@ .clusterSize = 18, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayFanControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 243 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 248 ), \ .generatedCommandList = nullptr, \ .eventList = nullptr, \ .eventCount = 0, \ @@ -3790,7 +3796,7 @@ .clusterSize = 345, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 245 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 250 ), \ .generatedCommandList = nullptr, \ .eventList = nullptr, \ .eventCount = 0, \ @@ -4037,7 +4043,7 @@ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 265 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 270 ), \ .generatedCommandList = nullptr, \ .eventList = nullptr, \ .eventCount = 0, \ @@ -4063,8 +4069,8 @@ .clusterSize = 2290, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 267 ), \ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 289 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 272 ), \ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 294 ), \ .eventList = ZAP_GENERATED_EVENTS_INDEX( 59 ), \ .eventCount = 3, \ },\ @@ -4076,7 +4082,7 @@ .clusterSize = 9, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayIdentifyServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 301 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 306 ), \ .generatedCommandList = nullptr, \ .eventList = nullptr, \ .eventCount = 0, \ @@ -4089,8 +4095,8 @@ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 304 ), \ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 311 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 309 ), \ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 316 ), \ .eventList = nullptr, \ .eventCount = 0, \ },\ @@ -4102,7 +4108,7 @@ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 316 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 321 ), \ .generatedCommandList = nullptr, \ .eventList = nullptr, \ .eventCount = 0, \ @@ -4141,8 +4147,8 @@ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \ .functions = chipFuncArrayScenesManagementServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 323 ), \ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 332 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 328 ), \ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 337 ), \ .eventList = nullptr, \ .eventCount = 0, \ },\ @@ -4180,8 +4186,8 @@ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 340 ), \ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 347 ), \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 345 ), \ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 352 ), \ .eventList = nullptr, \ .eventCount = 0, \ },\ diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index a4b36ddc549653..36d38179372c56 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -6491,8 +6491,8 @@ PICS: - label: "Does the device implement the Presets attribute?" id: TSTAT.S.A0050 - - label: "Does the device implement the PresetsSchedulesEditable attribute?" - id: TSTAT.S.A0052 + - label: "Does the device implement the Schedules attribute?" + id: TSTAT.S.A0051 # # server / commandsReceived diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml index 9785c8b1bda0c1..809bf71341b2cf 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml @@ -63,13 +63,13 @@ tests: saveAs: PresetsValue - label: - "Saving value for comparision in step 6 read PresetsSchedulesEditable + "Saving value for comparision in step 6 read Schedules attribute" - PICS: TSTAT.S.A0052 + PICS: TSTAT.S.A0051 command: "readAttribute" - attribute: "PresetsSchedulesEditable" + attribute: "Schedules" response: - saveAs: PresetsSchedulesEditableValue + saveAs: SchedulesValue - label: "Step 2: TH reads the PresetTypes attribute from the DUT" PICS: TSTAT.S.F08 & TSTAT.S.A0048 @@ -104,10 +104,10 @@ tests: type: list - label: - "Step 6: TH reads the PresetsSchedulesEditable attribute from the DUT" - PICS: TSTAT.S.F08 & TSTAT.S.A0052 + "Step 6: TH reads the Schedules attribute from the DUT" + PICS: TSTAT.S.F07 & TSTAT.S.A0051 command: "readAttribute" - attribute: "PresetsSchedulesEditable" + attribute: "Schedules" response: constraints: - type: boolean + type: list diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index ee6351b3c6793e..507e19eae032d9 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9580,7 +9580,6 @@ - ActivePresetHandle - Presets - Schedules - - PresetsSchedulesEditable - TemperatureSetpointHoldPolicy - SetpointHoldExpiryTimestamp - ActiveScheduleHandle From 1106e1f5a1b853ca958e56fa3abc6bc25104ec12 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 4 Aug 2024 16:29:37 -0700 Subject: [PATCH 59/63] Restyled patch --- src/app/tests/suites/certification/PICS.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 36d38179372c56..9d8011ceee2172 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -6615,9 +6615,7 @@ PICS: "Does the device implement sending the SetActivePresetRequest command?" id: TSTAT.C.C06.Tx - - label: - "Does the device implement sending the - AtomicRequest command?" + - label: "Does the device implement sending the AtomicRequest command?" id: TSTAT.C.CFE.Tx # From 18d202a87e26e59ea5f478dde6e4ca04ee1b01a2 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 4 Aug 2024 16:33:38 -0700 Subject: [PATCH 60/63] Restyled patch, again --- src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml index 809bf71341b2cf..aa12c7bec5e6f0 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_4_1.yaml @@ -62,9 +62,7 @@ tests: response: saveAs: PresetsValue - - label: - "Saving value for comparision in step 6 read Schedules - attribute" + - label: "Saving value for comparision in step 6 read Schedules attribute" PICS: TSTAT.S.A0051 command: "readAttribute" attribute: "Schedules" @@ -103,8 +101,7 @@ tests: constraints: type: list - - label: - "Step 6: TH reads the Schedules attribute from the DUT" + - label: "Step 6: TH reads the Schedules attribute from the DUT" PICS: TSTAT.S.F07 & TSTAT.S.A0051 command: "readAttribute" attribute: "Schedules" From 18325f47d016099037ae9558004a7bdd2b00ddee Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 4 Aug 2024 16:55:59 -0700 Subject: [PATCH 61/63] Remove PICS value for PresetsSchedulesEditable --- src/app/tests/suites/certification/ci-pics-values | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 9e7c4d8aeb0bf2..70a0e79760be3a 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -1987,7 +1987,7 @@ TSTAT.S.A0048=1 TSTAT.S.A004a=1 TSTAT.S.A004e=1 TSTAT.S.A0050=1 -TSTAT.S.A0052=1 +TSTAT.S.A0051=1 TSTAT.S.M.MinSetpointDeadBandWritable=1 TSTAT.S.M.HVACSystemTypeConfigurationWritable=0 From 11eda5a4b003ada3a747fada0f131ded3da83d8e Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 4 Aug 2024 21:46:43 -0700 Subject: [PATCH 62/63] clang-tidy fixes --- .../thermostat-server/PresetStructWithOwnedMembers.cpp | 10 ++++++++-- .../thermostat-server/PresetStructWithOwnedMembers.h | 4 ++-- .../clusters/thermostat-server/thermostat-server.cpp | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index 45eb8f5ebfd95b..78393fd22b708d 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -32,7 +32,7 @@ PresetStructWithOwnedMembers::PresetStructWithOwnedMembers(const PresetStruct::T *this = other; } -void PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) +PresetStructWithOwnedMembers & PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) { SetPresetScenario(other.presetScenario); CHIP_ERROR err = SetPresetHandle(other.presetHandle); @@ -48,11 +48,17 @@ void PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) SetCoolingSetpoint(other.coolingSetpoint); SetHeatingSetpoint(other.heatingSetpoint); SetBuiltIn(other.builtIn); + return *this; } -void PresetStructWithOwnedMembers::operator=(const PresetStructWithOwnedMembers & other) +PresetStructWithOwnedMembers & PresetStructWithOwnedMembers::operator=(const PresetStructWithOwnedMembers & other) { + if (this == &other) + { + return *this; + } *this = static_cast(other); + return *this; } void PresetStructWithOwnedMembers::SetPresetScenario(PresetScenarioEnum enumValue) diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h index d31cbc3b2cb409..8a2fa7f336c58b 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h @@ -42,8 +42,8 @@ struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type public: PresetStructWithOwnedMembers() = default; PresetStructWithOwnedMembers(const Structs::PresetStruct::Type & other); - void operator=(const Structs::PresetStruct::Type & other); - void operator=(const PresetStructWithOwnedMembers & other); + PresetStructWithOwnedMembers & operator=(const Structs::PresetStruct::Type & other); + PresetStructWithOwnedMembers & operator=(const PresetStructWithOwnedMembers & other); void SetPresetScenario(PresetScenarioEnum enumValue); CHIP_ERROR SetPresetHandle(const DataModel::Nullable & newPresetHandle); diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index d4c85f56e1b89a..afdb1b12afe763 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1446,7 +1446,6 @@ void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); sendAtomicResponse(commandObj, commandPath, imcode::Success, imcode::Success, imcode::Success, MakeOptional(timeout)); - return; } imcode commitPresets(Delegate * delegate, EndpointId endpoint) From 0478b52bd3566ce73db3844c0cfda55b4fea0b71 Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Sun, 4 Aug 2024 21:46:43 -0700 Subject: [PATCH 63/63] clang-tidy fixes --- .../thermostat-server/PresetStructWithOwnedMembers.cpp | 10 ++++++++-- .../thermostat-server/PresetStructWithOwnedMembers.h | 4 ++-- .../clusters/thermostat-server/thermostat-server.cpp | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp index 45eb8f5ebfd95b..78393fd22b708d 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.cpp @@ -32,7 +32,7 @@ PresetStructWithOwnedMembers::PresetStructWithOwnedMembers(const PresetStruct::T *this = other; } -void PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) +PresetStructWithOwnedMembers & PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) { SetPresetScenario(other.presetScenario); CHIP_ERROR err = SetPresetHandle(other.presetHandle); @@ -48,11 +48,17 @@ void PresetStructWithOwnedMembers::operator=(const PresetStruct::Type & other) SetCoolingSetpoint(other.coolingSetpoint); SetHeatingSetpoint(other.heatingSetpoint); SetBuiltIn(other.builtIn); + return *this; } -void PresetStructWithOwnedMembers::operator=(const PresetStructWithOwnedMembers & other) +PresetStructWithOwnedMembers & PresetStructWithOwnedMembers::operator=(const PresetStructWithOwnedMembers & other) { + if (this == &other) + { + return *this; + } *this = static_cast(other); + return *this; } void PresetStructWithOwnedMembers::SetPresetScenario(PresetScenarioEnum enumValue) diff --git a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h index d31cbc3b2cb409..8a2fa7f336c58b 100644 --- a/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h +++ b/src/app/clusters/thermostat-server/PresetStructWithOwnedMembers.h @@ -42,8 +42,8 @@ struct PresetStructWithOwnedMembers : protected Structs::PresetStruct::Type public: PresetStructWithOwnedMembers() = default; PresetStructWithOwnedMembers(const Structs::PresetStruct::Type & other); - void operator=(const Structs::PresetStruct::Type & other); - void operator=(const PresetStructWithOwnedMembers & other); + PresetStructWithOwnedMembers & operator=(const Structs::PresetStruct::Type & other); + PresetStructWithOwnedMembers & operator=(const PresetStructWithOwnedMembers & other); void SetPresetScenario(PresetScenarioEnum enumValue); CHIP_ERROR SetPresetHandle(const DataModel::Nullable & newPresetHandle); diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index d4c85f56e1b89a..afdb1b12afe763 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -1446,7 +1446,6 @@ void handleAtomicBegin(CommandHandler * commandObj, const ConcreteCommandPath & gThermostatAttrAccess.SetAtomicWrite(endpoint, true); gThermostatAttrAccess.SetAtomicWriteScopedNodeId(endpoint, GetSourceScopedNodeId(commandObj)); sendAtomicResponse(commandObj, commandPath, imcode::Success, imcode::Success, imcode::Success, MakeOptional(timeout)); - return; } imcode commitPresets(Delegate * delegate, EndpointId endpoint)