diff --git a/examples/chip-tool-darwin/templates/tests.js b/examples/chip-tool-darwin/templates/tests.js index 87e68b38512571..cc6504c5d57934 100644 --- a/examples/chip-tool-darwin/templates/tests.js +++ b/examples/chip-tool-darwin/templates/tests.js @@ -95,8 +95,19 @@ function getTests() 'Test_TC_FLW_2_2', ]; + const GeneralCommissioning = [ + 'Test_TC_GC_1_1', + ]; + const IlluminanceMeasurement = [ 'Test_TC_ILL_1_1', + 'Test_TC_ILL_2_1', + ]; + + const Identify = [ + 'Test_TC_I_1_1', + 'Test_TC_I_2_1', + 'Test_TC_I_2_3', ]; const OccupancySensing = [ @@ -117,6 +128,17 @@ function getTests() const MediaControl = [ 'Test_TC_MC_1_1', + 'Test_TC_MC_1_2', + 'Test_TC_MC_1_3', + 'Test_TC_MC_1_4', + 'Test_TC_MC_1_5', + 'Test_TC_MC_1_6', + 'Test_TC_MC_1_7', + 'Test_TC_MC_1_8', + 'Test_TC_MC_1_9', + 'Test_TC_MC_1_10', + 'Test_TC_MC_1_11', + 'Test_TC_MC_1_12', 'Test_TC_MC_2_1', 'Test_TC_MC_3_1', 'Test_TC_MC_3_2', @@ -140,6 +162,11 @@ function getTests() 'Test_TC_MC_7_2', 'Test_TC_MC_8_1', 'Test_TC_MC_9_1', + 'Test_TC_MC_10_1', + ]; + + const ModeSelect = [ + 'Test_TC_MOD_1_1', ]; const OnOff = [ @@ -151,6 +178,7 @@ function getTests() const PowerSource = [ 'Test_TC_PS_1_1', + 'Test_TC_PS_2_1', ]; const PressureMeasurement = [ @@ -163,6 +191,7 @@ function getTests() 'Test_TC_PCC_2_1', 'Test_TC_PCC_2_2', 'Test_TC_PCC_2_3', + 'Test_TC_PCC_2_4', ]; const RelativeHumidityMeasurement = [ @@ -196,6 +225,7 @@ function getTests() const ThreadNetworkDiagnostics = [ 'Test_TC_DIAG_TH_NW_1_1', + 'Test_TC_DIAG_TH_NW_1_2', ]; const WiFiNetworkDiagnostics = [ @@ -258,9 +288,12 @@ function getTests() ElectricalMeasurement, // EthernetNetworkDiagnostics, // FlowMeasurement, // + GeneralCommissioning, // IlluminanceMeasurement, // + Identify, // LevelControl, // MediaControl, // + ModeSelect, // OccupancySensing, // OnOff, // PowerSource, // diff --git a/examples/chip-tool/templates/tests/tests.js b/examples/chip-tool/templates/tests/tests.js index b7e490f1862554..53d546e21bbd8b 100644 --- a/examples/chip-tool/templates/tests/tests.js +++ b/examples/chip-tool/templates/tests/tests.js @@ -92,7 +92,6 @@ function getManualTests() ]; const GeneralCommissioning = [ - 'Test_TC_GC_1_1', 'Test_TC_GC_1_2', 'Test_TC_GC_1_3', ]; @@ -105,11 +104,9 @@ function getManualTests() const Identify = [ 'Test_TC_I_2_2', - 'Test_TC_I_2_3', ]; const IlluminanceMeasurement = [ - 'Test_TC_ILL_2_1', 'Test_TC_ILL_2_2', ]; @@ -136,7 +133,6 @@ function getManualTests() 'Test_TC_MC_4_1', 'Test_TC_MC_8_2', 'Test_TC_MC_9_2', - 'Test_TC_MC_10_1', 'Test_TC_MC_10_2', 'Test_TC_MC_10_3', 'Test_TC_MC_10_4', @@ -147,7 +143,7 @@ function getManualTests() const MultipleFabrics = [ 'Test_TC_MF_1_1', 'Test_TC_MF_1_2', - 'Test_TC_MF_1_4', + 'Test_TC_MF_1_3', 'Test_TC_MF_1_5', 'Test_TC_MF_1_6', 'Test_TC_MF_1_7', @@ -175,7 +171,6 @@ function getManualTests() ]; const ModeSelect = [ - 'Test_TC_MOD_1_1', 'Test_TC_MOD_1_2', 'Test_TC_MOD_2_1', 'Test_TC_MOD_2_2', @@ -354,13 +349,19 @@ function getTests() 'Test_TC_FLW_2_2', ]; + const GeneralCommissioning = [ + 'Test_TC_GC_1_1', + ]; + const Identify = [ 'Test_TC_I_1_1', 'Test_TC_I_2_1', + 'Test_TC_I_2_3', ]; const IlluminanceMeasurement = [ 'Test_TC_ILL_1_1', + 'Test_TC_ILL_2_1', ]; const OccupancySensing = [ @@ -415,6 +416,15 @@ function getTests() 'Test_TC_MC_7_2', 'Test_TC_MC_8_1', 'Test_TC_MC_9_1', + 'Test_TC_MC_10_1', + ]; + + const ModeSelect = [ + 'Test_TC_MOD_1_1', + ]; + + const MultipleFabrics = [ + 'Test_TC_MF_1_4', ]; const OnOff = [ @@ -571,10 +581,13 @@ function getTests() ElectricalMeasurement, // EthernetNetworkDiagnostics, // FlowMeasurement, // + GeneralCommissioning, // Identify, // IlluminanceMeasurement, // LevelControl, // MediaControl, // + ModeSelect, // + MultipleFabrics, // OccupancySensing, // OnOff, // PowerSource, // diff --git a/src/app/tests/suites/certification/Test_TC_GC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_GC_1_1.yaml index 25743a81b90f03..019539c2b8a2f3 100644 --- a/src/app/tests/suites/certification/Test_TC_GC_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_GC_1_1.yaml @@ -18,136 +18,58 @@ name: config: nodeId: 0x12344321 - cluster: "Basic" + cluster: "General Commissioning" endpoint: 0 tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + - label: "TH1 reads the BreadCrumb Attribute from the DUT" - verification: - "sudo ./chip-tool generalcommissioning read breadcrumb 1 0 - [1641376645.102405][5256:5261] CHIP:DMG: SuppressResponse = true, - [1641376645.102463][5256:5261] CHIP:DMG: } - [1641376645.102766][5256:5261] CHIP:TOO: - GeneralCommissioning.Breadcrumb response: 0 - [1641376645.103077][5256:5261] CHIP:EM: Sending Standalone Ack for - MessageCounter:11018859 on exchange 10683i" - disabled: true + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 0 - label: "TH1 writes the BreadCrumb attribute as 1 to the DUT" - verification: - "sudo ./chip-tool generalcommissioning write breadcrumb 1 1 0 - [1641377644.773752][5343:5348] CHIP:TOO: Default Success Response - [1641377644.773871][5343:5348] CHIP:DMG: WriteClient moving to - [Uninitiali] [1641377644.773951][5343:5348] CHIP:EM: Sending - Standalone Ack for MessageCounter:11887576 on exchange 44232i" - disabled: true + command: "writeAttribute" + attribute: "Breadcrumb" + arguments: + value: 1 - - label: "TH1 reads the BreadCrumb Attribute from the DUT" - verification: - "sudo ./chip-tool generalcommissioning read breadcrumb 1 0 - [1641377664.389415][5352:5357] CHIP:DMG: SuppressResponse = true, - [1641377664.389459][5352:5357] CHIP:DMG: } - [1641377664.389716][5352:5357] CHIP:TOO: - GeneralCommissioning.Breadcrumb response: 1 - [1641377664.389834][5352:5357] CHIP:EM: Sending Standalone Ack for - MessageCounter:16174261 on exchange 35502i" - disabled: true + - label: "TH1 reads the BreadCrumb attribute from the DUT" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 1 - label: "TH1 reads the RegulatoryConfig attribute from the DUT" - verification: - "ubuntu@ubuntu:~/apps$ sudo ./chip-tool generalcommissioning read - regulatory-config 1 0 [1646201945.126360][2860:2865] CHIP:DMG: - SuppressResponse = true, [1646201945.126404][2860:2865] CHIP:DMG: - InteractionModelRevision = 1 [1646201945.126437][2860:2865] CHIP:DMG: - } [1646201945.126644][2860:2865] CHIP:TOO: Endpoint: 0 Cluster: - 0x0000_0030 Attribute 0x0000_0002 DataVersion: 1894223167 - [1646201945.126728][2860:2865] CHIP:TOO: RegulatoryConfig: 0 - [1646201945.126810][2860:2865] CHIP:EM: Sending Standalone Ack for - MessageCounter:2750188 on exchange 60766ii" - disabled: true + command: "readAttribute" + attribute: "RegulatoryConfig" + response: + constraints: + minValue: 0 + maxValue: 2 - label: "TH1 reads the LocationCapability attribute from the DUT" - verification: - "ubuntu@ubuntu:~/apps$ sudo ./chip-tool generalcommissioning read - location-capability 1 0 [1646201921.080496][2848:2853] CHIP:DMG: - SuppressResponse = true, [1646201921.080530][2848:2853] CHIP:DMG: - InteractionModelRevision = 1 [1646201921.080561][2848:2853] CHIP:DMG: - } [1646201921.080735][2848:2853] CHIP:TOO: Endpoint: 0 Cluster: - 0x0000_0030 Attribute 0x0000_0003 DataVersion: 1894223167 - [1646201921.080821][2848:2853] CHIP:TOO: LocationCapability: 0 - [1646201921.080903][2848:2853] CHIP:EM: Sending Standalone Ack for - MessageCounter:13587220 on exchange 43838ii" - disabled: true + command: "readAttribute" + attribute: "LocationCapability" + response: + constraints: + minValue: 0 + maxValue: 2 - label: "TH1 reads BasicCommissioningInfo attribute from DUT" - verification: - "ubuntu@ubuntu:~/apps$ sudo ./chip-tool generalcommissioning read - basic-commissioning-info 1 0 [1646201777.003556][2827:2832] CHIP:TOO: - Endpoint: 0 Cluster: 0x0000_0030 Attribute 0x0000_0001 DataVersion: - 1894223167 [1646201777.006423][2827:2832] CHIP:TOO: - BasicCommissioningInfo: { [1646201777.006478][2827:2832] CHIP:TOO: - FailSafeExpiryLengthSeconds: 60 [1646201777.006512][2827:2832] - CHIP:TOO: } [1646201777.007955][2827:2832] CHIP:EM: Sending Standalone - Ack for MessageCounter:14137789 on exchange 43228i" - disabled: true - - - label: "TH1 reads the AttributeList attribute from the DUT" - verification: - "sudo ./chip-tool generalcommissioning read attribute-list 1 0 - [1641378711.789000][5430:5435] CHIP:DMG: SuppressResponse = true, - [1641378711.789043][5430:5435] CHIP:DMG: } - [1641378711.790083][5430:5435] CHIP:TOO: - GeneralCommissioning.AttributeList response: 7 entries - [1641378711.790287][5430:5435] CHIP:TOO: [1]: 0 - [1641378711.790336][5430:5435] CHIP:TOO: [2]: 1 - [1641378711.790382][5430:5435] CHIP:TOO: [3]: 2 - [1641378711.790427][5430:5435] CHIP:TOO: [4]: 3 - [1641378711.790473][5430:5435] CHIP:TOO: [5]: 65531 - [1641378711.790518][5430:5435] CHIP:TOO: [6]: 65532 - [1641378711.790563][5430:5435] CHIP:TOO: [7]: 65533 - [1641378711.790659][5430:5435] CHIP:EM: Sending Standalone Ack for - MessageCounter:1179640 on exchange 62007i" - disabled: true - - - label: "TH1 reads the ClusterRevision attribute from the DUT" - verification: - "sudo ./chip-tool generalcommissioning read cluster-revision 1 0 - [1641378927.454404][5451:5457] CHIP:DMG: SuppressResponse = true, - [1641378927.454442][5451:5457] CHIP:DMG: } - [1641378927.454658][5451:5457] CHIP:TOO: - GeneralCommissioning.ClusterRevision response: 1 - [1641378927.454758][5451:5457] CHIP:EM: Sending Standalone Ack for - MessageCounter:9230518 on exchange 10269i" - disabled: true - - - label: "TH1 reads server-generated-command-list attribute from the DUT" - verification: - "ubuntu@ubuntu:~/apps$ sudo ./chip-tool generalcommissioning read - server-generated-command-list 1 0 [1646202241.425632][2879:2884] - CHIP:DMG: SuppressResponse = true,[1646202241.425668][2879:2884] - CHIP:DMG: InteractionModelRevision = 1 [1646202241.425702][2879:2884] - CHIP:DMG: } [1646202241.426186][2879:2884] CHIP:TOO: Endpoint: 0 - Cluster: 0x0000_0030 Attribute 0x0000_FFF8 DataVersion: 1894223167 - [1646202241.426293][2879:2884] CHIP:TOO: GeneratedCommandList: 2 - entries [1646202241.426379][2879:2884] CHIP:TOO: [1]: - 1[1646202241.426420][2879:2884] CHIP:TOO: [2]: 5 - [1646202241.426512][2879:2884] CHIP:EM: Sending Standalone Ack for - MessageCounter:14519287 on exchange 9374i" - disabled: true - - - label: "TH1 reads client-generated-command-list attribute from the DUT" - verification: - "ubuntu@ubuntu:~/apps$ sudo ./chip-tool generalcommissioning read - client-generated-command-list 1 0 [1646202324.586100][2908:2913] - CHIP:DMG: SuppressResponse = true, [1646202324.586156][2908:2913] - CHIP:DMG: InteractionModelRevision = 1 [1646202324.586198][2908:2913] - CHIP:DMG: } [1646202324.587108][2908:2913] CHIP:TOO: Endpoint: 0 - Cluster: 0x0000_0030 Attribute 0x0000_FFF9 DataVersion: 1894223167 - [1646202324.587242][2908:2913] CHIP:TOO: AcceptedCommandList: 4 - entries [1646202324.587385][2908:2913] CHIP:TOO: [1]: 0 - [1646202324.587438][2908:2913] CHIP:TOO: [2]: 2 - [1646202324.587546][2908:2913] CHIP:TOO: [3]: 3 - [1646202324.587575][2908:2913] CHIP:TOO: [4]: 4 - [1646202324.587707][2908:2913] CHIP:EM: Sending Standalone Ack for - MessageCounter:7277571 on exchange 24863i" disabled: true + command: "readAttribute" + attribute: "BasicCommissioningInfo" + response: + constraints: + type: uint16 + minValue: 0 + maxValue: 65535 diff --git a/src/app/tests/suites/certification/Test_TC_ILL_2_1.yaml b/src/app/tests/suites/certification/Test_TC_ILL_2_1.yaml index aff5bb31175b0c..1d7b7859c88114 100644 --- a/src/app/tests/suites/certification/Test_TC_ILL_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_ILL_2_1.yaml @@ -16,37 +16,48 @@ name: 69.2.1. [TC-ILL-2.1] Attributes with server as DUT config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Illuminance Measurement" + endpoint: 1 tests: - - label: "Commission DUT to TH" - verification: "" - disabled: true - - - label: - "Test Harness Client reads MinMeasuredValue and MaxMeasuredValue from - Server DUT" - verification: - "./chip-tool illuminancemeasurement read min-measured-value 1 1 - ./chip-tool illuminancemeasurement read max-measured-value 1 1" - disabled: true - - - label: - "Note the values of the MinMeasuredValue (I min) and MaxMeasuredValue - (I max) attributes." - verification: "" - disabled: true - - - label: "Test Harness Client reads MeasuredValue from Server DUT" - verification: "./chip-tool illuminancemeasurement read measured-value 1 1" - disabled: true - - - label: "TH reads the Tolerance attribute from the DUT" - verification: "./chip-tool illuminancemeasurement read tolerance 1 1" - disabled: true - - - label: "TH reads the LightSensorType attribute from the DUT" - verification: - "./chip-tool illuminancemeasurement read light-sensor-type 1 1" - disabled: true + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads MinMeasuredValue attribute from DUT" + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + constraints: + type: uint16 + minValue: 1 + maxValue: 65533 + + - label: "TH reads MaxMeasuredValue attribute from DUT" + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + constraints: + type: uint16 + minValue: 2 + maxValue: 65534 + + - label: "TH reads Tolerance attribute from DUT" + command: "readAttribute" + attribute: "Tolerance" + response: + constraints: + type: uint16 + minValue: 0 + maxValue: 2048 + + - label: "TH reads LightSensorType attribute from DUT" + command: "readAttribute" + attribute: "LightSensorType" + response: + constraints: + type: enum8 diff --git a/src/app/tests/suites/certification/Test_TC_I_2_3.yaml b/src/app/tests/suites/certification/Test_TC_I_2_3.yaml index 5b485ea3827915..9e864e4ae15584 100644 --- a/src/app/tests/suites/certification/Test_TC_I_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_I_2_3.yaml @@ -16,440 +16,222 @@ name: 57.2.3. [TC-I-2.3] Secondary functionality with server as DUT config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Identify" + endpoint: 1 tests: - - label: "Commission DUT to TH" - verification: "" - disabled: true + - label: "1.Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0x00 (blink) and the effect variant field set to 0x00 - (default)." - verification: - "./chip-tool identify trigger-effect 0 0 1 1 CHIP:EM: Flushed pending - ack for MessageCounter:1227491753 on exchange 19185i - [1635610688.408485][3693:3698] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 19186i - [1635610688.408543][3693:3698] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 19186i - [1635610688.408576][3693:3698] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 19186i [1635610688.408623][3693:3698] - CHIP:DMG: InvokeCommand = [1635610688.408657][3693:3698] CHIP:DMG: { - [1635610688.408686][3693:3698] CHIP:DMG: CommandList = - [1635610688.408721][3693:3698] CHIP:DMG: [ - [1635610688.408754][3693:3698] CHIP:DMG: CommandDataIB = - [1635610688.408794][3693:3698] CHIP:DMG: { - [1635610688.408831][3693:3698] CHIP:DMG: CommandPathIB = - [1635610688.408917][3693:3698] CHIP:DMG: { - [1635610688.408965][3693:3698] CHIP:DMG: EndpointId = 0x1, - [1635610688.409044][3693:3698] CHIP:DMG: ClusterId = 0x0, - [1635610688.409093][3693:3698] CHIP:DMG: CommandId = 0x40, - [1635610688.409135][3693:3698] CHIP:DMG: }, - [1635610688.409182][3693:3698] CHIP:DMG: - [1635610688.409251][3693:3698] CHIP:DMG: StatusIB = - [1635610688.409298][3693:3698] CHIP:DMG: { - [1635610688.409374][3693:3698] CHIP:DMG: status = 0x85, - [1635610688.409418][3693:3698] CHIP:DMG: }, - [1635610688.409462][3693:3698] CHIP:DMG: - [1635610688.409499][3693:3698] CHIP:DMG: }, - [1635610688.409576][3693:3698] CHIP:DMG: - [1635610688.409609][3693:3698] CHIP:DMG: ], - [1635610688.409647][3693:3698] CHIP:DMG: - [1635610688.409713][3693:3698] CHIP:DMG: } - [1635610688.409771][3693:3698] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610688.409808][3693:3698] CHIP:TOO: Default Failure - Response: 0x85 [1635610688.409902][3693:3698] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610688.409944][3693:3698] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 19186i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0x00 blink and the effect variant field set to 0x00 + default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Manually check DUT executes a blink effect" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT executes a blink effect" + + - label: + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0x01 breathe and the effect variant field set to 0x00 + default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 1 + - name: "EffectVariant" + value: 0 + + - label: "check DUT executes a breathe effect" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT executes a breathe effect" + + - label: + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0x02 okay and the effect variant field set to 0x00 + default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 2 + - name: "EffectVariant" + value: 0 + + - label: "check DUT executes an okay effect" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT executes an okay effect" - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0x01 (breathe) and the effect variant field set to 0x00 - (default)." - verification: - "./chip-tool identify trigger-effect 1 0 1 1 CHIP:EM: Flushed pending - ack for MessageCounter:1227491755 on exchange 49192i - [1635610759.207089][3701:3706] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 49193i - [1635610759.207152][3701:3706] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 49193i - [1635610759.207189][3701:3706] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 49193i [1635610759.207239][3701:3706] - CHIP:DMG: InvokeCommand = [1635610759.207277][3701:3706] CHIP:DMG: { - [1635610759.207323][3701:3706] CHIP:DMG: CommandList = - [1635610759.207362][3701:3706] CHIP:DMG: [ - [1635610759.207413][3701:3706] CHIP:DMG: CommandDataIB = - [1635610759.207456][3701:3706] CHIP:DMG: { - [1635610759.207494][3701:3706] CHIP:DMG: CommandPathIB = - [1635610759.207664][3701:3706] CHIP:DMG: { - [1635610759.207725][3701:3706] CHIP:DMG: EndpointId = 0x1, - [1635610759.207791][3701:3706] CHIP:DMG: ClusterId = 0x0, - [1635610759.207846][3701:3706] CHIP:DMG: CommandId = 0x40, - [1635610759.207892][3701:3706] CHIP:DMG: }, - [1635610759.207961][3701:3706] CHIP:DMG: - [1635610759.208003][3701:3706] CHIP:DMG: StatusIB = - [1635610759.208059][3701:3706] CHIP:DMG: { - [1635610759.208109][3701:3706] CHIP:DMG: status = 0x85, - [1635610759.208193][3701:3706] CHIP:DMG: }, - [1635610759.208240][3701:3706] CHIP:DMG: - [1635610759.208280][3701:3706] CHIP:DMG: }, - [1635610759.208338][3701:3706] CHIP:DMG: - [1635610759.208374][3701:3706] CHIP:DMG: ], - [1635610759.208416][3701:3706] CHIP:DMG: - [1635610759.208461][3701:3706] CHIP:DMG: } - [1635610759.208522][3701:3706] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610759.208576][3701:3706] CHIP:TOO: Default Failure - Response: 0x85 [1635610759.208651][3701:3706] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610759.208709][3701:3706] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 49193i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0x0b channel change and the effect variant field set to + 0x00 default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 11 + - name: "EffectVariant" + value: 0 + + - label: "check DUT executes a channel change effect" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT executes a channel change effect" - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0x02 (okay) and the effect variant field set to 0x00 - (default)." - verification: - "./chip-tool identify trigger-effect 2 0 1 1 CHIP:EM: Flushed pending - ack for MessageCounter:1227491757 on exchange 2957i - [1635610776.032805][3707:3712] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 2958i - [1635610776.032869][3707:3712] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 2958i - [1635610776.032906][3707:3712] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 2958i [1635610776.032959][3707:3712] - CHIP:DMG: InvokeCommand = [1635610776.032997][3707:3712] CHIP:DMG: { - [1635610776.033045][3707:3712] CHIP:DMG: CommandList = - [1635610776.033085][3707:3712] CHIP:DMG: [ - [1635610776.033136][3707:3712] CHIP:DMG: CommandDataIB = - [1635610776.033178][3707:3712] CHIP:DMG: { - [1635610776.033232][3707:3712] CHIP:DMG: CommandPathIB = - [1635610776.033285][3707:3712] CHIP:DMG: { - [1635610776.033343][3707:3712] CHIP:DMG: EndpointId = 0x1, - [1635610776.033406][3707:3712] CHIP:DMG: ClusterId = 0x0, - [1635610776.033452][3707:3712] CHIP:DMG: CommandId = 0x40, - [1635610776.033506][3707:3712] CHIP:DMG: }, - [1635610776.033557][3707:3712] CHIP:DMG: - [1635610776.033611][3707:3712] CHIP:DMG: StatusIB = - [1635610776.033663][3707:3712] CHIP:DMG: { - [1635610776.033722][3707:3712] CHIP:DMG: status = 0x85, - [1635610776.033784][3707:3712] CHIP:DMG: }, - [1635610776.033833][3707:3712] CHIP:DMG: - [1635610776.033886][3707:3712] CHIP:DMG: }, - [1635610776.033933][3707:3712] CHIP:DMG: - [1635610776.033981][3707:3712] CHIP:DMG: ], - [1635610776.034023][3707:3712] CHIP:DMG: - [1635610776.034070][3707:3712] CHIP:DMG: } - [1635610776.034144][3707:3712] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610776.034185][3707:3712] CHIP:TOO: Default Failure - Response: 0x85 [1635610776.034267][3707:3712] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610776.034312][3707:3712] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 2958i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0x01 breathe and the effect variant field set to 0x00 + default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 1 + - name: "EffectVariant" + value: 0 + + - label: "check DUT executes a breathe effect" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT executes a breathe effect" - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0x0b (channel change) and the effect variant field set to - 0x00 (default)." - verification: - "./chip-tool identify trigger-effect 11 0 1 1 CHIP:EM: Flushed pending - ack for MessageCounter:1227491759 on exchange 64944i - [1635610789.012888][3713:3718] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 64945i - [1635610789.012948][3713:3718] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 64945i - [1635610789.012983][3713:3718] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 64945i [1635610789.013031][3713:3718] - CHIP:DMG: InvokeCommand = [1635610789.013065][3713:3718] CHIP:DMG: { - [1635610789.013094][3713:3718] CHIP:DMG: CommandList = - [1635610789.013129][3713:3718] CHIP:DMG: [ - [1635610789.013161][3713:3718] CHIP:DMG: CommandDataIB = - [1635610789.013250][3713:3718] CHIP:DMG: { - [1635610789.013320][3713:3718] CHIP:DMG: CommandPathIB = - [1635610789.013399][3713:3718] CHIP:DMG: { - [1635610789.013479][3713:3718] CHIP:DMG: EndpointId = 0x1, - [1635610789.013561][3713:3718] CHIP:DMG: ClusterId = 0x0, - [1635610789.013643][3713:3718] CHIP:DMG: CommandId = 0x40, - [1635610789.013687][3713:3718] CHIP:DMG: }, - [1635610789.013804][3713:3718] CHIP:DMG: - [1635610789.013874][3713:3718] CHIP:DMG: StatusIB = - [1635610789.013921][3713:3718] CHIP:DMG: { - [1635610789.013996][3713:3718] CHIP:DMG: status = 0x85, - [1635610789.014070][3713:3718] CHIP:DMG: }, - [1635610789.014111][3713:3718] CHIP:DMG: - [1635610789.014177][3713:3718] CHIP:DMG: }, - [1635610789.014284][3713:3718] CHIP:DMG: - [1635610789.014321][3713:3718] CHIP:DMG: ], - [1635610789.014394][3713:3718] CHIP:DMG: - [1635610789.014459][3713:3718] CHIP:DMG: } - [1635610789.014519][3713:3718] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610789.014580][3713:3718] CHIP:TOO: Default Failure - Response: 0x85 [1635610789.014703][3713:3718] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610789.014746][3713:3718] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 64945i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0xfe finish effect and the effect variant field set to + 0x00 default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 254 + - name: "EffectVariant" + value: 0 - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0x01 (breathe) and the effect variant field set to 0x00 - (default)." - verification: - "./chip-tool identify trigger-effect 1 0 1 1 CHIP:EM: Flushed pending - ack for MessageCounter:1227491761 on exchange 24930i - [1635610798.117653][3720:3725] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 24931i - [1635610798.117701][3720:3725] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 24931i - [1635610798.117727][3720:3725] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 24931i [1635610798.117766][3720:3725] - CHIP:DMG: InvokeCommand = [1635610798.117793][3720:3725] CHIP:DMG: { - [1635610798.117816][3720:3725] CHIP:DMG: CommandList = - [1635610798.117843][3720:3725] CHIP:DMG: [ - [1635610798.117868][3720:3725] CHIP:DMG: CommandDataIB = - [1635610798.117900][3720:3725] CHIP:DMG: { - [1635610798.117929][3720:3725] CHIP:DMG: CommandPathIB = - [1635610798.117963][3720:3725] CHIP:DMG: { - [1635610798.118000][3720:3725] CHIP:DMG: EndpointId = 0x1, - [1635610798.118074][3720:3725] CHIP:DMG: ClusterId = 0x0, - [1635610798.118111][3720:3725] CHIP:DMG: CommandId = 0x40, - [1635610798.118170][3720:3725] CHIP:DMG: }, - [1635610798.118236][3720:3725] CHIP:DMG: - [1635610798.118268][3720:3725] CHIP:DMG: StatusIB = - [1635610798.118304][3720:3725] CHIP:DMG: { - [1635610798.118357][3720:3725] CHIP:DMG: status = 0x85, - [1635610798.118391][3720:3725] CHIP:DMG: }, - [1635610798.118425][3720:3725] CHIP:DMG: - [1635610798.118477][3720:3725] CHIP:DMG: }, - [1635610798.118542][3720:3725] CHIP:DMG: - [1635610798.118571][3720:3725] CHIP:DMG: ], - [1635610798.118601][3720:3725] CHIP:DMG: - [1635610798.118650][3720:3725] CHIP:DMG: } - [1635610798.118699][3720:3725] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610798.118728][3720:3725] CHIP:TOO: Default Failure - Response: 0x85 [1635610798.118920][3720:3725] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610798.118981][3720:3725] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 24931i" - disabled: true + "Manually check DUT stops the breathe effect after the current effect + sequence" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "DUT stops the breathe effect after the current effect + sequence" - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0xfe (finish effect) and the effect variant field set to - 0x00 (default)." - verification: - "./chip-tool identify trigger-effect 254 0 1 1 CHIP:EM: Flushed - pending ack for MessageCounter:1227491763 on exchange 48728i - [1635610807.211077][3727:3732] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 48729i - [1635610807.211138][3727:3732] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 48729i - [1635610807.211175][3727:3732] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 48729i [1635610807.211226][3727:3732] - CHIP:DMG: InvokeCommand = [1635610807.211264][3727:3732] CHIP:DMG: { - [1635610807.211296][3727:3732] CHIP:DMG: CommandList = - [1635610807.211339][3727:3732] CHIP:DMG: [ - [1635610807.211374][3727:3732] CHIP:DMG: CommandDataIB = - [1635610807.211460][3727:3732] CHIP:DMG: { - [1635610807.211500][3727:3732] CHIP:DMG: CommandPathIB = - [1635610807.211587][3727:3732] CHIP:DMG: { - [1635610807.211641][3727:3732] CHIP:DMG: EndpointId = 0x1, - [1635610807.211728][3727:3732] CHIP:DMG: ClusterId = 0x0, - [1635610807.211811][3727:3732] CHIP:DMG: CommandId = 0x40, - [1635610807.211891][3727:3732] CHIP:DMG: }, - [1635610807.211976][3727:3732] CHIP:DMG: - [1635610807.212055][3727:3732] CHIP:DMG: StatusIB = - [1635610807.212181][3727:3732] CHIP:DMG: { - [1635610807.212234][3727:3732] CHIP:DMG: status = 0x85, - [1635610807.212315][3727:3732] CHIP:DMG: }, - [1635610807.212399][3727:3732] CHIP:DMG: - [1635610807.212440][3727:3732] CHIP:DMG: }, - [1635610807.212581][3727:3732] CHIP:DMG: - [1635610807.212620][3727:3732] CHIP:DMG: ], - [1635610807.212699][3727:3732] CHIP:DMG: - [1635610807.212767][3727:3732] CHIP:DMG: } - [1635610807.212866][3727:3732] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610807.212940][3727:3732] CHIP:TOO: Default Failure - Response: 0x85 [1635610807.213045][3727:3732] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610807.213089][3727:3732] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 48729i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0x01 breathe and the effect variant field set to 0x00 + default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 1 + - name: "EffectVariant" + value: 0 + + - label: "Manually check DUT executes a breathe effect" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT executes a breathe effect" - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0x01 (breathe) and the effect variant field set to 0x00 - (default)." - verification: - "./chip-tool identify trigger-effect 1 0 1 1 CHIP:EM: Flushed pending - ack for MessageCounter:1227491765 on exchange 1621i - [1635610817.958201][3733:3738] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 1622i - [1635610817.958266][3733:3738] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 1622i - [1635610817.958304][3733:3738] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 1622i [1635610817.958355][3733:3738] - CHIP:DMG: InvokeCommand = [1635610817.958393][3733:3738] CHIP:DMG: { - [1635610817.958425][3733:3738] CHIP:DMG: CommandList = - [1635610817.958463][3733:3738] CHIP:DMG: [ - [1635610817.958498][3733:3738] CHIP:DMG: CommandDataIB = - [1635610817.958583][3733:3738] CHIP:DMG: { - [1635610817.958660][3733:3738] CHIP:DMG: CommandPathIB = - [1635610817.958733][3733:3738] CHIP:DMG: { - [1635610817.958787][3733:3738] CHIP:DMG: EndpointId = 0x1, - [1635610817.958870][3733:3738] CHIP:DMG: ClusterId = 0x0, - [1635610817.958927][3733:3738] CHIP:DMG: CommandId = 0x40, - [1635610817.959031][3733:3738] CHIP:DMG: }, - [1635610817.959193][3733:3738] CHIP:DMG: - [1635610817.959237][3733:3738] CHIP:DMG: StatusIB = - [1635610817.959313][3733:3738] CHIP:DMG: { - [1635610817.959360][3733:3738] CHIP:DMG: status = 0x0, - [1635610817.959444][3733:3738] CHIP:DMG: }, - [1635610817.959524][3733:3738] CHIP:DMG: - [1635610817.959594][3733:3738] CHIP:DMG: }, - [1635610817.959644][3733:3738] CHIP:DMG: - [1635610817.959679][3733:3738] CHIP:DMG: ], - [1635610817.959761][3733:3738] CHIP:DMG: - [1635610817.959794][3733:3738] CHIP:DMG: } - [1635610817.959917][3733:3738] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610817.959960][3733:3738] CHIP:TOO: Default success - Response: 0x0 [1635610817.960064][3733:3738] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610817.960253][3733:3738] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 1622i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0xff stop effect and the effect variant field set to 0x00 + default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 255 + - name: "EffectVariant" + value: 0 + + - label: "Check DUT stops the breathe effect as soon as possible." + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT stops the breathe effect as soon as possible" - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0xff (stop effect) and the effect variant field set to - 0x00 (default)." - verification: - "./chip-tool identify trigger-effect 255 0 1 1 CHIP:EM: Flushed - pending ack for MessageCounter:1227491767 on exchange 56449i - [1635610825.761513][3740:3745] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 56450i - [1635610825.761576][3740:3745] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 56450i - [1635610825.761612][3740:3745] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 56450i [1635610825.761661][3740:3745] - CHIP:DMG: InvokeCommand = [1635610825.761699][3740:3745] CHIP:DMG: { - [1635610825.761730][3740:3745] CHIP:DMG: CommandList = - [1635610825.761768][3740:3745] CHIP:DMG: [ - [1635610825.761803][3740:3745] CHIP:DMG: CommandDataIB = - [1635610825.761894][3740:3745] CHIP:DMG: { - [1635610825.761960][3740:3745] CHIP:DMG: CommandPathIB = - [1635610825.762008][3740:3745] CHIP:DMG: { - [1635610825.762086][3740:3745] CHIP:DMG: EndpointId = 0x1, - [1635610825.762138][3740:3745] CHIP:DMG: ClusterId = 0x0, - [1635610825.762227][3740:3745] CHIP:DMG: CommandId = 0x40, - [1635610825.762305][3740:3745] CHIP:DMG: }, - [1635610825.762358][3740:3745] CHIP:DMG: - [1635610825.762456][3740:3745] CHIP:DMG: StatusIB = - [1635610825.762512][3740:3745] CHIP:DMG: { - [1635610825.762586][3740:3745] CHIP:DMG: status = 0x85, - [1635610825.762636][3740:3745] CHIP:DMG: }, - [1635610825.762717][3740:3745] CHIP:DMG: - [1635610825.762761][3740:3745] CHIP:DMG: }, - [1635610825.762844][3740:3745] CHIP:DMG: - [1635610825.762912][3740:3745] CHIP:DMG: ], - [1635610825.762957][3740:3745] CHIP:DMG: - [1635610825.762989][3740:3745] CHIP:DMG: } - [1635610825.763078][3740:3745] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610825.763119][3740:3745] CHIP:TOO: Default Failure - Response: 0x85 [1635610825.763248][3740:3745] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610825.763293][3740:3745] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 56450i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0x00 blink and the effect variant field set to 0x42 + unknown" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 0 + - name: "EffectVariant" + value: 66 + + - label: "Check DUT executes a blink effect." + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "DUT executes a blink effect" - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0x00 (blink) and the effect variant field set to 0x42 - (unknown)." - verification: - "./chip-tool identify trigger-effect 0 66 1 1 CHIP:EM: Flushed pending - ack for MessageCounter:1227491769 on exchange 39087i - [1635610859.943177][3746:3751] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 39088i - [1635610859.943242][3746:3751] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 39088i - [1635610859.943278][3746:3751] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 39088i [1635610859.943329][3746:3751] - CHIP:DMG: InvokeCommand = [1635610859.943367][3746:3751] CHIP:DMG: { - [1635610859.943399][3746:3751] CHIP:DMG: CommandList = - [1635610859.943435][3746:3751] CHIP:DMG: [ - [1635610859.943471][3746:3751] CHIP:DMG: CommandDataIB = - [1635610859.943556][3746:3751] CHIP:DMG: { - [1635610859.943632][3746:3751] CHIP:DMG: CommandPathIB = - [1635610859.943713][3746:3751] CHIP:DMG: { - [1635610859.943809][3746:3751] CHIP:DMG: EndpointId = 0x1, - [1635610859.943856][3746:3751] CHIP:DMG: ClusterId = 0x0, - [1635610859.943897][3746:3751] CHIP:DMG: CommandId = 0x40, - [1635610859.943974][3746:3751] CHIP:DMG: }, - [1635610859.944026][3746:3751] CHIP:DMG: - [1635610859.944065][3746:3751] CHIP:DMG: StatusIB = - [1635610859.944166][3746:3751] CHIP:DMG: { - [1635610859.944238][3746:3751] CHIP:DMG: status = 0x85, - [1635610859.944313][3746:3751] CHIP:DMG: }, - [1635610859.944362][3746:3751] CHIP:DMG: - [1635610859.944403][3746:3751] CHIP:DMG: }, - [1635610859.944447][3746:3751] CHIP:DMG: - [1635610859.944481][3746:3751] CHIP:DMG: ], - [1635610859.944566][3746:3751] CHIP:DMG: - [1635610859.944599][3746:3751] CHIP:DMG: } - [1635610859.944727][3746:3751] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610859.944801][3746:3751] CHIP:TOO: Default Failure - Response: 0x85 [1635610859.944903][3746:3751] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610859.944973][3746:3751] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 39088i" - disabled: true + "TH sends TriggerEffect command to DUT with the effect identifier + field set to 0xff stop effect and the effect variant field set to 0x00 + default" + command: "TriggerEffect" + arguments: + values: + - name: "EffectIdentifier" + value: 255 + - name: "EffectVariant" + value: 0 - label: - "TH sends TriggerEffect command to DUT, with the effect identifier - field set to 0xff (stop effect) and the effect variant field set to - 0x00 (default)." - verification: - "./chip-tool identify trigger-effect 255 0 1 1 CHIP:EM: Flushed - pending ack for MessageCounter:1227491771 on exchange 37044i - [1635610873.859371][3754:3759] CHIP:EM: Received message of type 0x9 - with protocolId (0, 1) and MessageCounter:1 on exchange 37045i - [1635610873.859433][3754:3759] CHIP:EM: Rxd Ack; Removing - MessageCounter:0 from Retrans Table on exchange 37045i - [1635610873.859470][3754:3759] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 37045i [1635610873.859522][3754:3759] - CHIP:DMG: InvokeCommand = [1635610873.859560][3754:3759] CHIP:DMG: { - [1635610873.859592][3754:3759] CHIP:DMG: CommandList = - [1635610873.859630][3754:3759] CHIP:DMG: [ - [1635610873.859667][3754:3759] CHIP:DMG: CommandDataIB = - [1635610873.859712][3754:3759] CHIP:DMG: { - [1635610873.859751][3754:3759] CHIP:DMG: CommandPathIB = - [1635610873.859802][3754:3759] CHIP:DMG: { - [1635610873.859854][3754:3759] CHIP:DMG: EndpointId = 0x1, - [1635610873.859905][3754:3759] CHIP:DMG: ClusterId = 0x0, - [1635610873.859959][3754:3759] CHIP:DMG: CommandId = 0x40, - [1635610873.860005][3754:3759] CHIP:DMG: }, - [1635610873.860057][3754:3759] CHIP:DMG: - [1635610873.860098][3754:3759] CHIP:DMG: StatusIB = - [1635610873.860171][3754:3759] CHIP:DMG: { - [1635610873.860209][3754:3759] CHIP:DMG: status = 0x85, - [1635610873.860245][3754:3759] CHIP:DMG: }, - [1635610873.860282][3754:3759] CHIP:DMG: - [1635610873.860313][3754:3759] CHIP:DMG: }, - [1635610873.860358][3754:3759] CHIP:DMG: - [1635610873.860393][3754:3759] CHIP:DMG: ], - [1635610873.860434][3754:3759] CHIP:DMG: - [1635610873.860467][3754:3759] CHIP:DMG: } - [1635610873.860527][3754:3759] CHIP:DMG: Received Command Response - Status for Endpoint=1 Cluster=0x0000_0000 Command=0x0000_0040 - Status=0x85 [1635610873.860568][3754:3759] CHIP:TOO: Default Failure - Response: 0x85 [1635610873.860636][3754:3759] CHIP:DMG: ICR moving to - [AwaitingDe] [1635610873.860683][3754:3759] CHIP:EM: Sending - Standalone Ack for MessageCounter:1 on exchange 37045i" - disabled: true + "Check DUT stops any effect that may be still running as soon as + possible" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "DUT stops any effect that may be still running as soon as + possible" diff --git a/src/app/tests/suites/certification/Test_TC_MC_10_1.yaml b/src/app/tests/suites/certification/Test_TC_MC_10_1.yaml index b0f4e0e0218867..dbe3d29914626b 100644 --- a/src/app/tests/suites/certification/Test_TC_MC_10_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_MC_10_1.yaml @@ -16,124 +16,28 @@ name: 18.12.1. [TC-MC-10.1] Read Content Launcher Attributes (DUT as Server) config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Content Launcher" + endpoint: 1 tests: - - label: "DUT reads the AcceptHeader attribute from the TH" - verification: - "./chip-tool contentlauncher read accept-header 1 1 [1646143737358] - [87142:3768651] CHIP: [EM] Received message of type 0x5 with - protocolId (0, 1) and MessageCounter:13527854 on exchange 7150i - [1646143737358] [87142:3768651] CHIP: [EM] Found matching exchange: - 7150i, Delegate: 0x600002c2c1e0 [1646143737358] [87142:3768651] CHIP: - [EM] Rxd Ack; Removing MessageCounter:3132467 from Retrans Table on - exchange 7150i [1646143737358] [87142:3768651] CHIP: [EM] Removed CHIP - MessageCounter:3132467 from RetransTable on exchange 7150i - [1646143737358] [87142:3768651] CHIP: [DMG] ReportDataMessage = - [1646143737358] [87142:3768651] CHIP: [DMG] { [1646143737358] - [87142:3768651] CHIP: [DMG] AttributeReportIBs = [1646143737358] - [87142:3768651] CHIP: [DMG] [ [1646143737358] [87142:3768651] CHIP: - [DMG] AttributeReportIB = [1646143737358] [87142:3768651] CHIP: [DMG] - { [1646143737358] [87142:3768651] CHIP: [DMG] AttributeDataIB = - [1646143737358] [87142:3768651] CHIP: [DMG] { [1646143737358] - [87142:3768651] CHIP: [DMG] DataVersion = 0x4cfe3732, [1646143737358] - [87142:3768651] CHIP: [DMG] AttributePathIB = [1646143737358] - [87142:3768651] CHIP: [DMG] { [1646143737358] [87142:3768651] CHIP: - [DMG] Endpoint = 0x1, [1646143737358] [87142:3768651] CHIP: [DMG] - Cluster = 0x50a, [1646143737358] [87142:3768651] CHIP: [DMG] Attribute - = 0x0000_0000, [1646143737358] [87142:3768651] CHIP: [DMG] } - [1646143737358] [87142:3768651] CHIP: [DMG] [1646143737358] - [87142:3768651] CHIP: [DMG] Data = [ [1646143737358] [87142:3768651] - CHIP: [DMG] [1646143737358] [87142:3768651] CHIP: [DMG] ], - [1646143737358] [87142:3768651] CHIP: [DMG] }, [1646143737358] - [87142:3768651] CHIP: [DMG] [1646143737358] [87142:3768651] CHIP: - [DMG] }, [1646143737358] [87142:3768651] CHIP: [DMG] [1646143737358] - [87142:3768651] CHIP: [DMG] AttributeReportIB = [1646143737358] - [87142:3768651] CHIP: [DMG] { [1646143737358] [87142:3768651] CHIP: - [DMG] AttributeDataIB = [1646143737358] [87142:3768651] CHIP: [DMG] { - [1646143737358] [87142:3768651] CHIP: [DMG] DataVersion = 0x4cfe3732, - [1646143737358] [87142:3768651] CHIP: [DMG] AttributePathIB = - [1646143737358] [87142:3768651] CHIP: [DMG] { [1646143737358] - [87142:3768651] CHIP: [DMG] Endpoint = 0x1, [1646143737358] - [87142:3768651] CHIP: [DMG] Cluster = 0x50a, [1646143737358] - [87142:3768651] CHIP: [DMG] Attribute = 0x0000_0000, [1646143737358] - [87142:3768651] CHIP: [DMG] ListIndex = Null, [1646143737358] - [87142:3768651] CHIP: [DMG] } [1646143737358] [87142:3768651] CHIP: - [DMG] [1646143737358] [87142:3768651] CHIP: [DMG] Data = 'example', - [1646143737358] [87142:3768651] CHIP: [DMG] }, [1646143737358] - [87142:3768651] CHIP: [DMG] [1646143737358] [87142:3768651] CHIP: - [DMG] }, [1646143737358] [87142:3768651] CHIP: [DMG] [1646143737358] - [87142:3768651] CHIP: [DMG] AttributeReportIB = [1646143737358] - [87142:3768651] CHIP: [DMG] { [1646143737358] [87142:3768651] CHIP: - [DMG] AttributeDataIB = [1646143737358] [87142:3768651] CHIP: [DMG] { - [1646143737358] [87142:3768651] CHIP: [DMG] DataVersion = 0x4cfe3732, - [1646143737358] [87142:3768651] CHIP: [DMG] AttributePathIB = - [1646143737358] [87142:3768651] CHIP: [DMG] { [1646143737358] - [87142:3768651] CHIP: [DMG] Endpoint = 0x1, [1646143737358] - [87142:3768651] CHIP: [DMG] Cluster = 0x50a, [1646143737358] - [87142:3768651] CHIP: [DMG] Attribute = 0x0000_0000, [1646143737358] - [87142:3768651] CHIP: [DMG] ListIndex = Null, [1646143737358] - [87142:3768651] CHIP: [DMG] } [1646143737358] [87142:3768651] CHIP: - [DMG] [1646143737358] [87142:3768651] CHIP: [DMG] Data = 'example', - [1646143737358] [87142:3768651] CHIP: [DMG] }, [1646143737358] - [87142:3768651] CHIP: [DMG] [1646143737358] [87142:3768651] CHIP: - [DMG] }, [1646143737358] [87142:3768651] CHIP: [DMG] [1646143737358] - [87142:3768651] CHIP: [DMG] ], [1646143737358] [87142:3768651] CHIP: - [DMG] [1646143737358] [87142:3768651] CHIP: [DMG] SuppressResponse = - true, [1646143737358] [87142:3768651] CHIP: [DMG] - InteractionModelRevision = 1 [1646143737358] [87142:3768651] CHIP: - [DMG] } [1646143737359] [87142:3768651] CHIP: [TOO] Endpoint: 1 - Cluster: 0x0000_050A Attribute 0x0000_0000 DataVersion: 1291728690 - [1646143737360] [87142:3768651] CHIP: [TOO] AcceptHeader: 2 entries - [1646143737360] [87142:3768651] CHIP: [TOO] [1]: example - [1646143737360] [87142:3768651] CHIP: [TOO] [2]: example - [1646143737360] [87142:3768651] CHIP: [EM] Sending Standalone Ack for - MessageCounter:13527854 on exchange 7150i [1646143737360] - [87142:3768651] CHIP: [IN] Prepared secure message 0x700006cf2560 to - 0x0000000000000001 (1) of type 0x10 and protocolId (0, 0) on exchange - 7150i with MessageCounter:3132468. [1646143737360] [87142:3768651] - CHIP: [IN] Sending encrypted msg 0x700006cf2560 with - MessageCounter:3132468 to 0x0000000000000001 (1) at monotonic time: - 431018215 msec" - disabled: true + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId - - label: "DUT reads the SupportedStreamingProtocols attribute from the TH" - verification: - "./chip-tool contentlauncher read supported-streaming-protocols 1 1 - [1646143780978] [87181:3769324] CHIP: [EM] Received message of type - 0x5 with protocolId (0, 1) and MessageCounter:6010019 on exchange - 62038i [1646143780978] [87181:3769324] CHIP: [EM] Found matching - exchange: 62038i, Delegate: 0x6000028213b0 [1646143780978] - [87181:3769324] CHIP: [EM] Rxd Ack; Removing MessageCounter:16473900 - from Retrans Table on exchange 62038i [1646143780978] [87181:3769324] - CHIP: [EM] Removed CHIP MessageCounter:16473900 from RetransTable on - exchange 62038i [1646143780978] [87181:3769324] CHIP: [DMG] - ReportDataMessage = [1646143780978] [87181:3769324] CHIP: [DMG] { - [1646143780978] [87181:3769324] CHIP: [DMG] AttributeReportIBs = - [1646143780978] [87181:3769324] CHIP: [DMG] [ [1646143780978] - [87181:3769324] CHIP: [DMG] AttributeReportIB = [1646143780978] - [87181:3769324] CHIP: [DMG] { [1646143780978] [87181:3769324] CHIP: - [DMG] AttributeDataIB = [1646143780978] [87181:3769324] CHIP: [DMG] { - [1646143780979] [87181:3769324] CHIP: [DMG] DataVersion = 0x4cfe3732, - [1646143780979] [87181:3769324] CHIP: [DMG] AttributePathIB = - [1646143780979] [87181:3769324] CHIP: [DMG] { [1646143780979] - [87181:3769324] CHIP: [DMG] Endpoint = 0x1, [1646143780979] - [87181:3769324] CHIP: [DMG] Cluster = 0x50a, [1646143780979] - [87181:3769324] CHIP: [DMG] Attribute = 0x0000_0001, [1646143780979] - [87181:3769324] CHIP: [DMG] } [1646143780979] [87181:3769324] CHIP: - [DMG] [1646143780979] [87181:3769324] CHIP: [DMG] Data = 0, - [1646143780979] [87181:3769324] CHIP: [DMG] }, [1646143780979] - [87181:3769324] CHIP: [DMG] [1646143780979] [87181:3769324] CHIP: - [DMG] }, [1646143780979] [87181:3769324] CHIP: [DMG] [1646143780979] - [87181:3769324] CHIP: [DMG] ], [1646143780979] [87181:3769324] CHIP: - [DMG] [1646143780979] [87181:3769324] CHIP: [DMG] SuppressResponse = - true, [1646143780979] [87181:3769324] CHIP: [DMG] - InteractionModelRevision = 1 [1646143780979] [87181:3769324] CHIP: - [DMG] } [1646143780979] [87181:3769324] CHIP: [TOO] Endpoint: 1 - Cluster: 0x0000_050A Attribute 0x0000_0001 DataVersion: 1291728690 - [1646143780980] [87181:3769324] CHIP: [TOO] - SupportedStreamingProtocols: 0 [1646143780980] [87181:3769324] CHIP: - [EM] Sending Standalone Ack for MessageCounter:6010019 on exchange - 62038i" - disabled: true + - label: "TH reads the AcceptHeader attribute from the DUT" + command: "readAttribute" + attribute: "AcceptHeader" + response: + constraints: + type: list + + - label: "TH reads the SupportedStreamingProtocols attribute from the DUT" + command: "readAttribute" + attribute: "SupportedStreamingProtocols" + response: + constraints: + type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_MF_1_4.yaml b/src/app/tests/suites/certification/Test_TC_MF_1_4.yaml index 9a54b76881bac0..6a64358874ad6f 100644 --- a/src/app/tests/suites/certification/Test_TC_MF_1_4.yaml +++ b/src/app/tests/suites/certification/Test_TC_MF_1_4.yaml @@ -16,398 +16,143 @@ name: 22.1.4. [TC-MF-1.4] Node Behavior using BCM [DUT - Commissionee] config: nodeId: 0x12344321 - cluster: "Basic" + nodeId2: + type: NODE_ID + defaultValue: 0xCAFE endpoint: 0 + discriminator: + type: INT16U + defaultValue: 3840 + payload: + type: CHAR_STRING + defaultValue: "MT:-24J0AFN00KA0648G00" # This value needs to be generated automatically tests: + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + - label: "TH_CR1 starts a commissioning process with DUT_CE" - verification: - "1. Provision the device using 1st python controller on the raspi (use - above instructions) " - disabled: true + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH_CR1 opens a commissioning window on DUT_CE" + cluster: "AdministratorCommissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 120 - label: - "If (PICS_MF_BCM) TH_CR1 opens a commissioning window on DUT_CE using - a commissioning timeout of PIXIT_COMM_WIN seconds using BCM" - verification: - "On 1st controller, using chip tool open commissioning window using - BCM ./chip-tool administratorcommissioning - open-basic-commissioning-window 500 1 0 [1635865295.457120][3918:3923] - CHIP:DMG: InvokeCommand = [1635865295.457189][3918:3923] CHIP:DMG: { - [1635865295.457248][3918:3923] CHIP:DMG: CommandList = - [1635865295.457310][3918:3923] CHIP:DMG: [ - [1635865295.457372][3918:3923] CHIP:DMG: CommandDataIB = - [1635865295.457483][3918:3923] CHIP:DMG: { - [1635865295.457550][3918:3923] CHIP:DMG: CommandPathIB = - [1635865295.457622][3918:3923] CHIP:DMG: { - [1635865295.457695][3918:3923] CHIP:DMG: EndpointId = 0x0, - [1635865295.457770][3918:3923] CHIP:DMG: ClusterId = 0x3c, - [1635865295.457844][3918:3923] CHIP:DMG: CommandId = 0x1, - [1635865295.457913][3918:3923] CHIP:DMG: }, - [1635865295.457989][3918:3923] CHIP:DMG: - [1635865295.458054][3918:3923] CHIP:DMG: StatusIB = - [1635865295.458122][3918:3923] CHIP:DMG: { - [1635865295.458192][3918:3923] CHIP:DMG: status = 0x0, - [1635865295.458261][3918:3923] CHIP:DMG: }, - [1635865295.458331][3918:3923] CHIP:DMG: - [1635865295.458387][3918:3923] CHIP:DMG: }, - [1635865295.458459][3918:3923] CHIP:DMG: - [1635865295.458516][3918:3923] CHIP:DMG: ], - [1635865295.458585][3918:3923] CHIP:DMG: - [1635865295.458638][3918:3923] CHIP:DMG: } - [1635865295.458735][3918:3923] CHIP:DMG: Received Command Response - Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0001 - Status=0x0 [1635865295.458802][3918:3923] CHIP:TOO: Default Success - Response" - disabled: true + "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "writeAttribute" + cluster: "Basic" + attribute: "NodeLabel" + arguments: + value: "chiptest" - label: - "TH_CR1 writes and reads the Basic Information Clusters NodeLabel - mandatory attribute of DUT_CE" - verification: - "On 1st controller, using chip tool, write and read Basic Information - Clusters NodeLabel mandatory attribute of DUT_CE ./chip-tool basic - write node-label te5new 1 0 [1635865352.166872][3925:3930] CHIP:DMG: - WriteResponse = [1635865352.166936][3925:3930] CHIP:DMG: { - [1635865352.166970][3925:3930] CHIP:DMG: AttributeStatusList = - [1635865352.167031][3925:3930] CHIP:DMG: [ - [1635865352.167064][3925:3930] CHIP:DMG: AttributeStatusIB = - [1635865352.167105][3925:3930] CHIP:DMG: { - [1635865352.167168][3925:3930] CHIP:DMG: AttributePath = - [1635865352.167236][3925:3930] CHIP:DMG: { - [1635865352.167279][3925:3930] CHIP:DMG: FieldTag = 0x0000_0005, - [1635865352.167347][3925:3930] CHIP:DMG: NodeId = 0x0, - [1635865352.167399][3925:3930] CHIP:DMG: ClusterId = 0x28, - [1635865352.167467][3925:3930] CHIP:DMG: EndpointId = 0x0, - [1635865352.167533][3925:3930] CHIP:DMG: } - [1635865352.167582][3925:3930] CHIP:DMG: - [1635865352.167623][3925:3930] CHIP:DMG: StatusIB = - [1635865352.167683][3925:3930] CHIP:DMG: { - [1635865352.167734][3925:3930] CHIP:DMG: status = 0x0, - [1635865352.167799][3925:3930] CHIP:DMG: }, - [1635865352.167846][3925:3930] CHIP:DMG: - [1635865352.167889][3925:3930] CHIP:DMG: }, - [1635865352.167936][3925:3930] CHIP:DMG: - [1635865352.167980][3925:3930] CHIP:DMG: ], - [1635865352.168030][3925:3930] CHIP:DMG: - [1635865352.168221][3925:3930] CHIP:DMG: } - [1635865352.168320][3925:3930] CHIP:ZCL: WriteResponse: - [1635865352.168363][3925:3930] CHIP:ZCL: status: Success (0x0000) - [1635865352.168410][3925:3930] CHIP:TOO: Default Success Response - ./chip-tool basic read node-label 1 0 [1635865391.357044][3934:3939] - CHIP:DMG: ReportData = [1635865391.357075][3934:3939] CHIP:DMG: { - [1635865391.357103][3934:3939] CHIP:DMG: AttributeDataList = - [1635865391.357138][3934:3939] CHIP:DMG: [ - [1635865391.357167][3934:3939] CHIP:DMG: AttributeDataElement = - [1635865391.357223][3934:3939] CHIP:DMG: { - [1635865391.357258][3934:3939] CHIP:DMG: AttributePath = - [1635865391.357317][3934:3939] CHIP:DMG: { - [1635865391.357362][3934:3939] CHIP:DMG: NodeId = 0x1, - [1635865391.357454][3934:3939] CHIP:DMG: EndpointId = 0x0, - [1635865391.357533][3934:3939] CHIP:DMG: ClusterId = 0x28, - [1635865391.357633][3934:3939] CHIP:DMG: FieldTag = 0x0000_0005, - [1635865391.357697][3934:3939] CHIP:DMG: } - [1635865391.357741][3934:3939] CHIP:DMG: - [1635865391.357792][3934:3939] CHIP:DMG: Data = 'te5new', - [1635865391.357870][3934:3939] CHIP:DMG: DataElementVersion = 0x0, - [1635865391.357939][3934:3939] CHIP:DMG: }, - [1635865391.357981][3934:3939] CHIP:DMG: - [1635865391.358026][3934:3939] CHIP:DMG: ], - [1635865391.358065][3934:3939] CHIP:DMG: - [1635865391.358095][3934:3939] CHIP:DMG: } - [1635865391.358236][3934:3939] CHIP:ZCL: ReadAttributesResponse: - [1635865391.358267][3934:3939] CHIP:ZCL: ClusterId: 0x0000_0028 - [1635865391.358311][3934:3939] CHIP:ZCL: attributeId: 0x0000_0005 - [1635865391.358337][3934:3939] CHIP:ZCL: status: Success (0x0000) - [1635865391.358400][3934:3939] CHIP:ZCL: attribute TLV Type: 0x0c - [1635865391.358435][3934:3939] CHIP:TOO: CharString attribute - Response: te5new" - disabled: true + "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "readAttribute" + cluster: "Basic" + attribute: "NodeLabel" + response: + constraints: + type: string + maxLength: 32 + value: "chiptest" + + - label: "Commission from beta" + identity: "beta" + cluster: "CommissionerCommands" + command: "PairWithQRCode" + arguments: + values: + - name: "nodeId" + value: nodeId2 + - name: "payload" + value: payload - label: "TH_CR2 starts a commissioning process with DUT_CE" - verification: - "1. On 2nd controller, using chip-tool connect to the accessory - ./chip-tool pairing onnetwork 1 20202021" - disabled: true + identity: "beta" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId2 - - label: "TH_CR1 reads the list of Fabrics on DUT_CE" - verification: - "On first controller, using chip tool read fabrics list ./chip-tool - operationalcredentials read fabrics-list 1 0 - [1635865583.364833][3951:3956] CHIP:DMG: ReportData = - [1635865583.364869][3951:3956] CHIP:DMG: { - [1635865583.364899][3951:3956] CHIP:DMG: AttributeDataList = - [1635865583.364938][3951:3956] CHIP:DMG: [ - [1635865583.364971][3951:3956] CHIP:DMG: AttributeDataElement = - [1635865583.365009][3951:3956] CHIP:DMG: { - [1635865583.365043][3951:3956] CHIP:DMG: AttributePath = - [1635865583.365111][3951:3956] CHIP:DMG: { - [1635865583.365168][3951:3956] CHIP:DMG: NodeId = 0x1, - [1635865583.365208][3951:3956] CHIP:DMG: EndpointId = 0x0, - [1635865583.365271][3951:3956] CHIP:DMG: ClusterId = 0x3e, - [1635865583.365335][3951:3956] CHIP:DMG: FieldTag = 0x0000_0001, - [1635865583.365371][3951:3956] CHIP:DMG: } - [1635865583.365441][3951:3956] CHIP:DMG: - [1635865583.365516][3951:3956] CHIP:DMG: Data = [ - [1635865583.365564][3951:3956] CHIP:DMG: - [1635865583.365625][3951:3956] CHIP:DMG: { - [1635865583.365689][3951:3956] CHIP:DMG: 0x0 = 1, - [1635865583.365755][3951:3956] CHIP:DMG: 0x1 = [ - [1635865583.365814][3951:3956] CHIP:DMG: 0x4, 0x9e, 0x26, 0x54, 0x2, - 0x45, 0x18, 0xca, 0x68, 0x9c, 0xa0, 0x77, 0xef, 0xb4, 0x37, 0x0, 0xce, - 0xb7, 0x15, 0x8d, 0x4a, 0xc7, 0x6a, 0x67, 0x31, 0xf2, 0xba, 0x52, - 0x8f, 0xb9, 0xfd, 0x93, 0xed, 0xc0, 0xdc, 0xce, 0xf7, 0x9d, 0x3, 0x3b, - 0xc8, 0x63, 0 [1635865583.365863][3951:3956] CHIP:DMG: ] - [1635865583.365929][3951:3956] CHIP:DMG: 0x2 = 30024, - [1635865583.365969][3951:3956] CHIP:DMG: 0x3 = 0, - [1635865583.366048][3951:3956] CHIP:DMG: 0x4 = 1, - [1635865583.366266][3951:3956] CHIP:DMG: 0x5 = ', - [1635865583.366411][3951:3956] CHIP:DMG: }, - [1635865583.366502][3951:3956] CHIP:DMG: { - [1635865583.366570][3951:3956] CHIP:DMG: 0x0 = 2, - [1635865583.366682][3951:3956] CHIP:DMG: 0x1 = [ - [1635865583.366814][3951:3956] CHIP:DMG: 0x4, 0x5b, 0x93, 0x38, 0xab, - 0x50, 0x6, 0x85, 0xc0, 0x50, 0xfe, 0x7d, 0x6c, 0xeb, 0x9d, 0xbd, 0x55, - 0x90, 0x5e, 0x4f, 0x54, 0xed, 0x94, 0x21, 0xc0, 0x8d, 0x9d, 0x4f, - 0x60, 0x48, 0xdb, 0x38, 0x4a, 0xf4, 0xe2, 0xa3, 0xf9, 0xd0, 0x55, - 0xd5, 0x63, 0xd0, [1635865583.366901][3951:3956] CHIP:DMG: ] - [1635865583.366970][3951:3956] CHIP:DMG: 0x2 = 45896, - [1635865583.367068][3951:3956] CHIP:DMG: 0x3 = 0, - [1635865583.367123][3951:3956] CHIP:DMG: 0x4 = 2, - [1635865583.367272][3951:3956] CHIP:DMG: 0x5 = '', - [1635865583.367358][3951:3956] CHIP:DMG: }, - [1635865583.367499][3951:3956] CHIP:DMG: ], - [1635865583.367581][3951:3956] CHIP:DMG: DataElementVersion = 0x0, - [1635865583.367653][3951:3956] CHIP:DMG: }, - [1635865583.367720][3951:3956] CHIP:DMG: - [1635865583.367764][3951:3956] CHIP:DMG: ], - [1635865583.367829][3951:3956] CHIP:DMG: - [1635865583.367871][3951:3956] CHIP:DMG: } - [1635865583.368097][3951:3956] CHIP:ZCL: ReadAttributesResponse: - [1635865583.368144][3951:3956] CHIP:ZCL: ClusterId: 0x0000_003E - [1635865583.368188][3951:3956] CHIP:ZCL: attributeId: 0x0000_0001 - [1635865583.368228][3951:3956] CHIP:ZCL: status: Success (0x0000) - [1635865583.368319][3951:3956] CHIP:ZCL: attribute TLV Type: 0x16 - [1635865583.368389][3951:3956] CHIP:TOO: - OnOperationalCredentialsFabricsListListAttributeResponse: 2 entries - [1635865583.368513][3951:3956] CHIP:TOO: FabricDescriptor[1]: - [1635865583.368555][3951:3956] CHIP:TOO: fabricIndex: 1 - [1635865583.368593][3951:3956] CHIP:ZCL: RootPublicKey: 65 - [1635865583.368630][3951:3956] CHIP:TOO: vendorId: 30024 - [1635865583.368665][3951:3956] CHIP:TOO: fabricId: 0 - [1635865583.368696][3951:3956] CHIP:TOO: nodeId: 1 - [1635865583.368729][3951:3956] CHIP:ZCL: Label: - [1635865583.368777][3951:3956] CHIP:TOO: FabricDescriptor[2]: - [1635865583.368816][3951:3956] CHIP:TOO: fabricIndex: 2 - [1635865583.368862][3951:3956] CHIP:ZCL: RootPublicKey: 65 - [1635865583.368895][3951:3956] CHIP:TOO: vendorId: 45896 - [1635865583.368971][3951:3956] CHIP:TOO: fabricId: 0 - [1635865583.369011][3951:3956] CHIP:TOO: nodeId: 2" - disabled: true + - label: "Query fabrics list" + command: "readAttribute" + cluster: "Operational Credentials" + attribute: "Fabrics" + response: + value: [{ Label: "", nodeId: nodeId }] + constraints: + type: list - - label: "TH_CR2 reads the list of Fabrics on DUT_CE" - verification: - "On second controller, using chip tool read fabrics list ./chip-tool - operationalcredentials read fabrics-list 2 0 - [1635865632.342329][6067:6072] CHIP:DMG: ReportData = - [1635865632.342404][6067:6072] CHIP:DMG: { - [1635865632.342434][6067:6072] CHIP:DMG: AttributeDataList = - [1635865632.342485][6067:6072] CHIP:DMG: [ - [1635865632.342524][6067:6072] CHIP:DMG: AttributeDataElement = - [1635865632.342567][6067:6072] CHIP:DMG: { - [1635865632.342610][6067:6072] CHIP:DMG: AttributePath = - [1635865632.342665][6067:6072] CHIP:DMG: { - [1635865632.342715][6067:6072] CHIP:DMG: NodeId = 0x2, - [1635865632.342908][6067:6072] CHIP:DMG: EndpointId = 0x0, - [1635865632.343032][6067:6072] CHIP:DMG: ClusterId = 0x3e, - [1635865632.343088][6067:6072] CHIP:DMG: FieldTag = 0x0000_0001, - [1635865632.343138][6067:6072] CHIP:DMG: } - [1635865632.343248][6067:6072] CHIP:DMG: - [1635865632.343311][6067:6072] CHIP:DMG: Data = [ - [1635865632.343451][6067:6072] CHIP:DMG: - [1635865632.343507][6067:6072] CHIP:DMG: { - [1635865632.343559][6067:6072] CHIP:DMG: 0x0 = 1, - [1635865632.343611][6067:6072] CHIP:DMG: 0x1 = [ - [1635865632.343674][6067:6072] CHIP:DMG: 0x4, 0x9e, 0x26, 0x54, 0x2, - 0x45, 0x18, 0xca, 0x68, 0x9c, 0xa0, 0x77, 0xef, 0xb4, 0x37, 0x0, 0xce, - 0xb7, 0x15, 0x8d, 0x4a, 0xc7, 0x6a, 0x67, 0x31, 0xf2, 0xba, 0x52, - 0x8f, 0xb9, 0xfd, 0x93, 0xed, 0xc0, 0xdc, 0xce, 0xf7, 0x9d, 0x3, 0x3b, - 0xc8, 0x63, 0 [1635865632.343784][6067:6072] CHIP:DMG: ] - [1635865632.344026][6067:6072] CHIP:DMG: 0x2 = 30024, - [1635865632.344261][6067:6072] CHIP:DMG: 0x3 = 0, - [1635865632.344518][6067:6072] CHIP:DMG: 0x4 = 1, - [1635865632.344584][6067:6072] CHIP:DMG: 0x5 = '', - [1635865632.344755][6067:6072] CHIP:DMG: }, - [1635865632.344959][6067:6072] CHIP:DMG: { - [1635865632.345007][6067:6072] CHIP:DMG: 0x0 = 2, - [1635865632.345229][6067:6072] CHIP:DMG: 0x1 = [ - [1635865632.345471][6067:6072] CHIP:DMG: 0x4, 0x5b, 0x93, 0x38, 0xab, - 0x50, 0x6, 0x85, 0xc0, 0x50, 0xfe, 0x7d, 0x6c, 0xeb, 0x9d, 0xbd, 0x55, - 0x90, 0x5e, 0x4f, 0x54, 0xed, 0x94, 0x21, 0xc0, 0x8d, 0x9d, 0x4f, - 0x60, 0x48, 0xdb, 0x38, 0x4a, 0xf4, 0xe2, 0xa3, 0xf9, 0xd0, 0x55, - 0xd5, 0x63, 0xd0, [1635865632.345519][6067:6072] CHIP:DMG: ] - [1635865632.345706][6067:6072] CHIP:DMG: 0x2 = 45896, - [1635865632.345929][6067:6072] CHIP:DMG: 0x3 = 0, - [1635865632.346157][6067:6072] CHIP:DMG: 0x4 = 2, - [1635865632.346383][6067:6072] CHIP:DMG: 0x5 = '', - [1635865632.346611][6067:6072] CHIP:DMG: }, - [1635865632.346838][6067:6072] CHIP:DMG: ], - [1635865632.347060][6067:6072] CHIP:DMG: DataElementVersion = 0x0, - [1635865632.347139][6067:6072] CHIP:DMG: }, - [1635865632.347249][6067:6072] CHIP:DMG: - [1635865632.347281][6067:6072] CHIP:DMG: ], - [1635865632.347323][6067:6072] CHIP:DMG: - [1635865632.347352][6067:6072] CHIP:DMG: } - [1635865632.347473][6067:6072] CHIP:ZCL: ReadAttributesResponse: - [1635865632.347502][6067:6072] CHIP:ZCL: ClusterId: 0x0000_003E - [1635865632.347534][6067:6072] CHIP:ZCL: attributeId: 0x0000_0001 - [1635865632.347562][6067:6072] CHIP:ZCL: status: Success (0x0000) - [1635865632.347590][6067:6072] CHIP:ZCL: attribute TLV Type: 0x16 - [1635865632.347640][6067:6072] CHIP:TOO: - OnOperationalCredentialsFabricsListListAttributeResponse: 2 entries - [1635865632.347721][6067:6072] CHIP:TOO: FabricDescriptor[1]: - [1635865632.347752][6067:6072] CHIP:TOO: fabricIndex: 1 - [1635865632.347779][6067:6072] CHIP:ZCL: RootPublicKey: 65 - [1635865632.347806][6067:6072] CHIP:TOO: vendorId: 30024 - [1635865632.347832][6067:6072] CHIP:TOO: fabricId: 0 - [1635865632.347859][6067:6072] CHIP:TOO: nodeId: 1 - [1635865632.347884][6067:6072] CHIP:ZCL: Label: - [1635865632.347922][6067:6072] CHIP:TOO: FabricDescriptor[2]: - [1635865632.347949][6067:6072] CHIP:TOO: fabricIndex: 2 - [1635865632.347972][6067:6072] CHIP:ZCL: RootPublicKey: 65 - [1635865632.347997][6067:6072] CHIP:TOO: vendorId: 45896 - [1635865632.348023][6067:6072] CHIP:TOO: fabricId: 0 - [1635865632.348049][6067:6072] CHIP:TOO: nodeId: 2" - disabled: true + - label: "Query fabrics list" + identity: "beta" + command: "readAttribute" + cluster: "Operational Credentials" + attribute: "Fabrics" + response: + value: [{ Label: "", nodeId: nodeId2 }] + constraints: + type: list - - label: "" - verification: - "1. Verify if the DUT is broadcasting using $ avahi-browse -rt - _matter._tcp" - disabled: true + - label: + "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "writeAttribute" + cluster: "Basic" + attribute: "NodeLabel" + arguments: + value: "chiptest" + + - label: + "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "readAttribute" + cluster: "Basic" + attribute: "NodeLabel" + response: + constraints: + type: string + maxLength: 32 + value: "chiptest" - label: - "TH_CR1 writes and reads the Basic Information Clusters NodeLabel - mandatory attribute of DUT_CE" - verification: - "On 1st controller, using chip tool, write and read Basic Information - Clusters NodeLabel mandatory attribute of DUT_CE ./chip-tool basic - write user-label te5new 1 0 1635866078.503500][3977:3982] CHIP:DMG: - WriteResponse = [1635866078.503533][3977:3982] CHIP:DMG: { - [1635866078.503566][3977:3982] CHIP:DMG: AttributeStatusList = - [1635866078.503604][3977:3982] CHIP:DMG: [ - [1635866078.503640][3977:3982] CHIP:DMG: AttributeStatusIB = - [1635866078.503686][3977:3982] CHIP:DMG: { - [1635866078.503721][3977:3982] CHIP:DMG: AttributePath = - [1635866078.503769][3977:3982] CHIP:DMG: { - [1635866078.503815][3977:3982] CHIP:DMG: FieldTag = 0x0000_0005, - [1635866078.503862][3977:3982] CHIP:DMG: NodeId = 0x0, - [1635866078.503908][3977:3982] CHIP:DMG: ClusterId = 0x28, - [1635866078.503952][3977:3982] CHIP:DMG: EndpointId = 0x0, - [1635866078.503994][3977:3982] CHIP:DMG: } - [1635866078.504041][3977:3982] CHIP:DMG: - [1635866078.504081][3977:3982] CHIP:DMG: StatusIB = - [1635866078.504123][3977:3982] CHIP:DMG: { - [1635866078.504164][3977:3982] CHIP:DMG: status = 0x0, - [1635866078.504210][3977:3982] CHIP:DMG: }, - [1635866078.504256][3977:3982] CHIP:DMG: - [1635866078.504294][3977:3982] CHIP:DMG: }, - [1635866078.504338][3977:3982] CHIP:DMG: - [1635866078.504370][3977:3982] CHIP:DMG: ], - [1635866078.504413][3977:3982] CHIP:DMG: - [1635866078.504445][3977:3982] CHIP:DMG: } - [1635866078.504520][3977:3982] CHIP:ZCL: WriteResponse: - [1635866078.504555][3977:3982] CHIP:ZCL: status: Success (0x0000) - [1635866078.504593][3977:3982] CHIP:TOO: Default Success Response - ./chip-tool basic read user-label 1 0 [1635866121.659967][3984:3989] - CHIP:DMG: ReportData = [1635866121.660011][3984:3989] CHIP:DMG: { - [1635866121.660047][3984:3989] CHIP:DMG: AttributeDataList = - [1635866121.660090][3984:3989] CHIP:DMG: [ - [1635866121.660126][3984:3989] CHIP:DMG: AttributeDataElement = - [1635866121.660194][3984:3989] CHIP:DMG: { - [1635866121.660259][3984:3989] CHIP:DMG: AttributePath = - [1635866121.660310][3984:3989] CHIP:DMG: { - [1635866121.660363][3984:3989] CHIP:DMG: NodeId = 0x1, - [1635866121.660440][3984:3989] CHIP:DMG: EndpointId = 0x0, - [1635866121.660489][3984:3989] CHIP:DMG: ClusterId = 0x28, - [1635866121.660565][3984:3989] CHIP:DMG: FieldTag = 0x0000_0005, - [1635866121.660619][3984:3989] CHIP:DMG: } - [1635866121.660696][3984:3989] CHIP:DMG: - [1635866121.660746][3984:3989] CHIP:DMG: Data = 'te5new', - [1635866121.660825][3984:3989] CHIP:DMG: DataElementVersion = 0x0, - [1635866121.660865][3984:3989] CHIP:DMG: }, - [1635866121.660934][3984:3989] CHIP:DMG: - [1635866121.660975][3984:3989] CHIP:DMG: ], - [1635866121.661023][3984:3989] CHIP:DMG: - [1635866121.661082][3984:3989] CHIP:DMG: } - [1635866121.661200][3984:3989] CHIP:ZCL: ReadAttributesResponse: - [1635866121.661240][3984:3989] CHIP:ZCL: ClusterId: 0x0000_0028 - [1635866121.661282][3984:3989] CHIP:ZCL: attributeId: 0x0000_0005 - [1635866121.661313][3984:3989] CHIP:ZCL: status: Success (0x0000) - [1635866121.661348][3984:3989] CHIP:ZCL: attribute TLV Type: 0x0c - [1635866121.661476][3984:3989] CHIP:TOO: CharString attribute - Response: te5new" - disabled: true + "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + identity: "beta" + command: "writeAttribute" + cluster: "Basic" + attribute: "NodeLabel" + arguments: + value: "chiptest" - label: - "TH_CR2 writes and reads the Basic Information Clusters NodeLabel - mandatory attribute of DUT_CE" - verification: - "On 2nd controller, using chip tool, write and read Basic Information - Clusters NodeLabel mandatory attribute of DUT_CE ./chip-tool basic - write user-label te5new 2 0 [1635866189.702833][6110:6115] CHIP:DMG: - WriteResponse = [1635866189.702874][6110:6115] CHIP:DMG: { - [1635866189.702929][6110:6115] CHIP:DMG: AttributeStatusList = - [1635866189.702966][6110:6115] CHIP:DMG: [ - [1635866189.703022][6110:6115] CHIP:DMG: AttributeStatusIB = - [1635866189.703092][6110:6115] CHIP:DMG: { - [1635866189.703163][6110:6115] CHIP:DMG: AttributePath = - [1635866189.703242][6110:6115] CHIP:DMG: { - [1635866189.703306][6110:6115] CHIP:DMG: FieldTag = 0x0000_0005, - [1635866189.703353][6110:6115] CHIP:DMG: NodeId = 0x0, - [1635866189.703408][6110:6115] CHIP:DMG: ClusterId = 0x28, - [1635866189.703504][6110:6115] CHIP:DMG: EndpointId = 0x0, - [1635866189.703574][6110:6115] CHIP:DMG: } - [1635866189.703624][6110:6115] CHIP:DMG: - [1635866189.703676][6110:6115] CHIP:DMG: StatusIB = - [1635866189.703757][6110:6115] CHIP:DMG: { - [1635866189.703797][6110:6115] CHIP:DMG: status = 0x0, - [1635866189.703859][6110:6115] CHIP:DMG: }, - [1635866189.703935][6110:6115] CHIP:DMG: - [1635866189.703972][6110:6115] CHIP:DMG: }, - [1635866189.704035][6110:6115] CHIP:DMG: - [1635866189.704072][6110:6115] CHIP:DMG: ], - [1635866189.704116][6110:6115] CHIP:DMG: - [1635866189.704164][6110:6115] CHIP:DMG: } - [1635866189.704313][6110:6115] CHIP:ZCL: WriteResponse: - [1635866189.704383][6110:6115] CHIP:ZCL: status: Success (0x0000) - [1635866189.704435][6110:6115] CHIP:TOO: Default Success Response - ./chip-tool basic read user-label 2 0 [1635866228.009768][6121:6126] - CHIP:DMG: ReportData = [1635866228.009831][6121:6126] CHIP:DMG: { - [1635866228.009866][6121:6126] CHIP:DMG: AttributeDataList = - [1635866228.009906][6121:6126] CHIP:DMG: [ - [1635866228.009939][6121:6126] CHIP:DMG: AttributeDataElement = - [1635866228.009999][6121:6126] CHIP:DMG: { - [1635866228.010048][6121:6126] CHIP:DMG: AttributePath = - [1635866228.010124][6121:6126] CHIP:DMG: { - [1635866228.010201][6121:6126] CHIP:DMG: NodeId = 0x2, - [1635866228.010293][6121:6126] CHIP:DMG: EndpointId = 0x0, - [1635866228.010372][6121:6126] CHIP:DMG: ClusterId = 0x28, - [1635866228.010437][6121:6126] CHIP:DMG: FieldTag = 0x0000_0005, - [1635866228.010501][6121:6126] CHIP:DMG: } - [1635866228.010572][6121:6126] CHIP:DMG: - [1635866228.010618][6121:6126] CHIP:DMG: Data = 'te5new', - [1635866228.010690][6121:6126] CHIP:DMG: DataElementVersion = 0x0, - [1635866228.010752][6121:6126] CHIP:DMG: }, - [1635866228.010818][6121:6126] CHIP:DMG: - [1635866228.010857][6121:6126] CHIP:DMG: ], - [1635866228.010903][6121:6126] CHIP:DMG: - [1635866228.010937][6121:6126] CHIP:DMG: } - [1635866228.011043][6121:6126] CHIP:ZCL: ReadAttributesResponse: - [1635866228.011077][6121:6126] CHIP:ZCL: ClusterId: 0x0000_0028 - [1635866228.011113][6121:6126] CHIP:ZCL: attributeId: 0x0000_0005 - [1635866228.011146][6121:6126] CHIP:ZCL: status: Success (0x0000) - [1635866228.011178][6121:6126] CHIP:ZCL: attribute TLV Type: 0x0c - [1635866228.011216][6121:6126] CHIP:TOO: CharString attribute - Response: te5new" - disabled: true + "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + identity: "beta" + command: "readAttribute" + cluster: "Basic" + attribute: "NodeLabel" + response: + constraints: + type: string + maxLength: 32 + value: "chiptest" diff --git a/src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml b/src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml index 8885ad83594f64..3edc85f75ae884 100644 --- a/src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_MOD_1_1.yaml @@ -16,45 +16,61 @@ name: 78.1.1. [TC-MOD-1.1] Global attributes with server as DUT config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Mode Select" + endpoint: 1 tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + - label: "TH reads the ClusterRevision attribute from the DUT" - verification: - "./chip-tool modeselect read cluster-revision 1 1 - [1645775623.658997][3277:3282] CHIP:TOO: ClusterRevision: 1" - disabled: true + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: uint16 - label: "TH reads the FeatureMap attribute from the DUT" - verification: "Not currently supported" disabled: true + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 1 + constraints: + type: map8 - label: "TH reads the AttributeList attribute from the DUT" - verification: - "./chip-tool modeselect read attribute-list 1 1 - [1645775832.872856][3304:3309] CHIP:TOO: AttributeList: 7 entries - [1645775832.872963][3304:3309] CHIP:TOO: [1]: 0 - [1645775832.872990][3304:3309] CHIP:TOO: [2]: 1 - [1645775832.873015][3304:3309] CHIP:TOO: [3]: 2 - [1645775832.873040][3304:3309] CHIP:TOO: [4]: 3 - [1645775832.873070][3304:3309] CHIP:TOO: [5]: 4 - [1645775832.873101][3304:3309] CHIP:TOO: [6]: 65531 - [1645775832.873132][3304:3309] CHIP:TOO: [7]: 65533 *NOTE* : This - sample attribute list reflects the currently implemented attributes on - the all-clusters-app." - disabled: true + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list - - label: "TH reads the CommandList attribute from the DUT" - verification: - "./chip-tool modeselect read client-generated-command-list 1 1 - [1645776597.295794][4635:4640] CHIP:TOO: AcceptedCommandList: 1 - entries [1645776597.295853][4635:4640] CHIP:TOO: [1]: 0" + #issue #11053 disabled steps below Global attributes missing from YAML framework + - label: "Read the global attribute: EventList" disabled: true + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list - - label: "TH reads the EventList attribute from the DUT" - verification: - "./chip-tool modeselect read server-generated-command-list 1 1 - [1645776667.509100][4643:4648] CHIP:TOO: GeneratedCommandList: 0 - entries" - disabled: true + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + constraints: + type: list diff --git a/src/darwin/Framework/CHIP/templates/tests/tests.js b/src/darwin/Framework/CHIP/templates/tests/tests.js index 5d33a2b078cac4..0047412c3c1c43 100644 --- a/src/darwin/Framework/CHIP/templates/tests/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests/tests.js @@ -95,13 +95,19 @@ function getTests() 'Test_TC_FLW_2_2', ]; + const GeneralCommissioning = [ + 'Test_TC_GC_1_1', + ]; + const Identify = [ 'Test_TC_I_1_1', 'Test_TC_I_2_1', + 'Test_TC_I_2_3', ]; const IlluminanceMeasurement = [ 'Test_TC_ILL_1_1', + 'Test_TC_ILL_2_1', ]; const OccupancySensing = [ @@ -156,6 +162,11 @@ function getTests() 'Test_TC_MC_7_2', 'Test_TC_MC_8_1', 'Test_TC_MC_9_1', + 'Test_TC_MC_10_1', + ]; + + const ModeSelect = [ + 'Test_TC_MOD_1_1', ]; const OnOff = [ @@ -279,10 +290,12 @@ function getTests() ElectricalMeasurement, // EthernetNetworkDiagnostics, // FlowMeasurement, // + GeneralCommissioning, // Identify, // IlluminanceMeasurement, // LevelControl, // MediaControl, // + ModeSelect, // OccupancySensing, // OnOff, // PowerSource, // diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 2b37aac716bf21..cf01ef490e1c0c 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -12854,6 +12854,149 @@ - (void)testSendClusterTest_TC_FLW_2_2_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_GC_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_GC_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH1 reads the BreadCrumb Attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb Attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_GC_1_1_000002_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH1 writes the BreadCrumb attribute as 1 to the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + id breadcrumbArgument; + breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; + [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH1 writes the BreadCrumb attribute as 1 to the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_GC_1_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH1 reads the BreadCrumb attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedLongLongValue], 1ULL); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_GC_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH1 reads the RegulatoryConfig attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeRegulatoryConfigWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the RegulatoryConfig attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 2); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_GC_1_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH1 reads the LocationCapability attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeLocationCapabilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the LocationCapability attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 2); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_I_1_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -12862,17 +13005,525 @@ - (void)testSendClusterTest_TC_I_1_1_000000_WaitForCommissionee WaitForCommissionee(expectation, queue, 305414945); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_I_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_I_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of ClusterRevision attribute"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of ClusterRevision attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_1_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_I_2_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the IdentifyTime attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeIdentifyTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyTime attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the IdentifyType attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeIdentifyTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyType attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 5); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_I_2_3_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"1.Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000001_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 " + @"blink and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and the " + @"effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000002_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Manually check DUT executes a blink effect"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT executes a blink effect"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000003_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the " + @"effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000004_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"check DUT executes a breathe effect"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT executes a breathe effect"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000005_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay " + @"and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:2]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and the " + @"effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000006_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"check DUT executes an okay effect"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT executes an okay effect"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000007_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b " + @"channel change and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:11]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel change " + @"and the effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000008_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"check DUT executes a channel change effect"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT executes a channel change effect"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000009_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the " + @"effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000010_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"check DUT executes a breathe effect"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT executes a breathe effect"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000011_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe " + @"finish effect and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:254]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish effect " + @"and the effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000012_UserPrompt +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Manually check DUT stops the breathe effect after the current effect sequence"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT stops the breathe effect after the current effect sequence"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000013_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the " + @"effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000014_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Manually check DUT executes a breathe effect"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT executes a breathe effect"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000015_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + @"effect and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop effect and " + @"the effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000016_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Check DUT stops the breathe effect as soon as possible."]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT stops the breathe effect as soon as possible"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000017_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 " + @"blink and the effect variant field set to 0x42 unknown"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0]; + params.effectVariant = [NSNumber numberWithUnsignedChar:66]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and the " + @"effect variant field set to 0x42 unknown Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000018_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Check DUT executes a blink effect."]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT executes a blink effect"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000019_TriggerEffect +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + @"effect and the effect variant field set to 0x00 default"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop effect and " + @"the effect variant field set to 0x00 default Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_I_2_3_000020_UserPrompt +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Check DUT stops any effect that may be still running as soon as possible"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"DUT stops any effect that may be still running as soon as possible"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_ILL_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_ILL_1_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of ClusterRevision attribute"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; XCTAssertNotNil(cluster); [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of ClusterRevision attribute Error: %@", err); + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -12881,13 +13532,15 @@ - (void)testSendClusterTest_TC_I_1_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_I_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_ILL_1_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; XCTAssertNotNil(cluster); [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -12900,13 +13553,15 @@ - (void)testSendClusterTest_TC_I_1_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_I_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_ILL_1_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; XCTAssertNotNil(cluster); [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -12919,13 +13574,15 @@ - (void)testSendClusterTest_TC_I_1_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_I_1_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_ILL_1_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; XCTAssertNotNil(cluster); [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -12939,7 +13596,7 @@ - (void)testSendClusterTest_TC_I_1_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_I_2_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_ILL_2_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -12947,49 +13604,32 @@ - (void)testSendClusterTest_TC_I_2_1_000000_WaitForCommissionee WaitForCommissionee(expectation, queue, 305414945); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_I_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the IdentifyTime attribute from the DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeIdentifyTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the IdentifyTime attribute from the DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_I_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_ILL_2_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the IdentifyType attribute from the DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads MinMeasuredValue attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeIdentifyTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the IdentifyType attribute from the DUT Error: %@", err); + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 1U); } } { id actualValue = value; if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 5); + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65533U); } } @@ -12998,18 +13638,9 @@ - (void)testSendClusterTest_TC_I_2_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_ILL_1_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ILL_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_ILL_2_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads MaxMeasuredValue attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -13018,40 +13649,32 @@ - (void)testSendClusterTest_TC_ILL_1_1_000001_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ILL_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 2U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65534U); + } + } [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_ILL_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_ILL_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads Tolerance attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -13060,19 +13683,32 @@ - (void)testSendClusterTest_TC_ILL_1_1_000003_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads Tolerance attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 2048U); + } + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_ILL_1_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_ILL_2_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads LightSensorType attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -13081,8 +13717,8 @@ - (void)testSendClusterTest_TC_ILL_1_1_000004_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + [cluster readAttributeLightSensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads LightSensorType attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -16700,6 +17336,144 @@ - (void)testSendClusterTest_TC_MC_9_1_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_MC_10_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_10_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the AcceptHeader attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestContentLauncher * cluster = [[CHIPTestContentLauncher alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAcceptHeaderWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the AcceptHeader attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_10_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"TH reads the SupportedStreamingProtocols attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestContentLauncher * cluster = [[CHIPTestContentLauncher alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeSupportedStreamingProtocolsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the SupportedStreamingProtocols attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MOD_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MOD_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the ClusterRevision attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the ClusterRevision attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 1U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MOD_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"TH reads the AttributeList attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the AttributeList attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MOD_1_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MOD_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_OCC_1_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index 2f9167910b8ece..94c043233b4353 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -75,7 +75,12 @@ class TestList : public Command { printf("Test_TC_FLW_1_1\n"); printf("Test_TC_FLW_2_1\n"); printf("Test_TC_FLW_2_2\n"); + printf("Test_TC_GC_1_1\n"); printf("Test_TC_ILL_1_1\n"); + printf("Test_TC_ILL_2_1\n"); + printf("Test_TC_I_1_1\n"); + printf("Test_TC_I_2_1\n"); + printf("Test_TC_I_2_3\n"); printf("Test_TC_LVL_1_1\n"); printf("Test_TC_LVL_2_1\n"); printf("Test_TC_LVL_2_2\n"); @@ -84,6 +89,17 @@ class TestList : public Command { printf("Test_TC_LVL_5_1\n"); printf("Test_TC_LVL_6_1\n"); printf("Test_TC_MC_1_1\n"); + printf("Test_TC_MC_1_2\n"); + printf("Test_TC_MC_1_3\n"); + printf("Test_TC_MC_1_4\n"); + printf("Test_TC_MC_1_5\n"); + printf("Test_TC_MC_1_6\n"); + printf("Test_TC_MC_1_7\n"); + printf("Test_TC_MC_1_8\n"); + printf("Test_TC_MC_1_9\n"); + printf("Test_TC_MC_1_10\n"); + printf("Test_TC_MC_1_11\n"); + printf("Test_TC_MC_1_12\n"); printf("Test_TC_MC_2_1\n"); printf("Test_TC_MC_3_1\n"); printf("Test_TC_MC_3_2\n"); @@ -107,6 +123,8 @@ class TestList : public Command { printf("Test_TC_MC_7_2\n"); printf("Test_TC_MC_8_1\n"); printf("Test_TC_MC_9_1\n"); + printf("Test_TC_MC_10_1\n"); + printf("Test_TC_MOD_1_1\n"); printf("Test_TC_OCC_1_1\n"); printf("Test_TC_OCC_2_1\n"); printf("Test_TC_OCC_2_2\n"); @@ -115,12 +133,14 @@ class TestList : public Command { printf("Test_TC_OO_2_2\n"); printf("Test_TC_OO_2_3\n"); printf("Test_TC_PS_1_1\n"); + printf("Test_TC_PS_2_1\n"); printf("Test_TC_PRS_1_1\n"); printf("Test_TC_PRS_2_1\n"); printf("Test_TC_PCC_1_1\n"); printf("Test_TC_PCC_2_1\n"); printf("Test_TC_PCC_2_2\n"); printf("Test_TC_PCC_2_3\n"); + printf("Test_TC_PCC_2_4\n"); printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); printf("Test_TC_RH_2_2\n"); @@ -136,6 +156,7 @@ class TestList : public Command { printf("Test_TC_TSUIC_2_1\n"); printf("Test_TC_TSUIC_2_2\n"); printf("Test_TC_DIAG_TH_NW_1_1\n"); + printf("Test_TC_DIAG_TH_NW_1_2\n"); printf("Test_TC_WIFIDIAG_1_1\n"); printf("Test_TC_WIFIDIAG_3_1\n"); printf("Test_TC_WNCV_1_1\n"); @@ -16415,6 +16436,217 @@ class Test_TC_FLW_2_2 : public TestCommandBridge { } }; +class Test_TC_GC_1_1 : public TestCommandBridge { +public: + Test_TC_GC_1_1() + : TestCommandBridge("Test_TC_GC_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_GC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_GC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GC_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads the BreadCrumb Attribute from the DUT\n"); + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH1 writes the BreadCrumb attribute as 1 to the DUT\n"); + err = TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH1 reads the BreadCrumb attribute from the DUT\n"); + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH1 reads the RegulatoryConfig attribute from the DUT\n"); + err = TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH1 reads the LocationCapability attribute from the DUT\n"); + err = TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 6; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb Attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 0ULL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id breadcrumbArgument; + breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; + [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH1 writes the BreadCrumb attribute as 1 to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 1ULL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRegulatoryConfigWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the RegulatoryConfig attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("regulatoryConfig", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("regulatoryConfig", [value unsignedCharValue], 2)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLocationCapabilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the LocationCapability attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("locationCapability", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("locationCapability", [value unsignedCharValue], 2)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_ILL_1_1 : public TestCommandBridge { public: Test_TC_ILL_1_1() @@ -16580,10 +16812,10 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { } }; -class Test_TC_LVL_1_1 : public TestCommandBridge { +class Test_TC_ILL_2_1 : public TestCommandBridge { public: - Test_TC_LVL_1_1() - : TestCommandBridge("Test_TC_LVL_1_1") + Test_TC_ILL_2_1() + : TestCommandBridge("Test_TC_ILL_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -16592,7 +16824,7 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_1_1() {} + ~Test_TC_ILL_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -16600,11 +16832,11 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -16621,49 +16853,20 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); + err = TestThReadsMinMeasuredValueAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); + err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); break; case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads Tolerance attribute from DUT\n"); + err = TestThReadsToleranceAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional global attribute : FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_11(); + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads LightSensorType attribute from DUT\n"); + err = TestThReadsLightSensorTypeAttributeFromDut_4(); break; } @@ -16680,7 +16883,7 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -16693,20 +16896,25 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 1U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 65533U)); } NextTest(); @@ -16715,59 +16923,52 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], 2U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value unsignedShortValue], 65534U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:4U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() + CHIP_ERROR TestThReadsToleranceAttributeFromDut_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads Tolerance attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); + VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); } NextTest(); @@ -16776,131 +16977,177 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR TestThReadsLightSensorTypeAttributeFromDut_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeLightSensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads LightSensorType attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("lightSensorType", "", "enum8")); NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_6() +class Test_TC_I_1_1 : public TestCommandBridge { +public: + Test_TC_I_1_1() + : TestCommandBridge("Test_TC_I_1_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + ~Test_TC_I_1_1() {} - VerifyOrReturn(CheckValue("status", err, 0)); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - }]; + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); + } - return CHIP_NO_ERROR; + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of ClusterRevision attribute\n"); + err = TestReadsConstraintsOfClusterRevisionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_7() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_8() + CHIP_ERROR TestReadsConstraintsOfClusterRevisionAttribute_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of ClusterRevision attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 3UL)); - } - + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_9() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional global attribute : FeatureMap Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id featureMapArgument; - featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeFeatureMapWithValue:featureMapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_11() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; @@ -16908,10 +17155,10 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { } }; -class Test_TC_LVL_2_1 : public TestCommandBridge { +class Test_TC_I_2_1 : public TestCommandBridge { public: - Test_TC_LVL_2_1() - : TestCommandBridge("Test_TC_LVL_2_1") + Test_TC_I_2_1() + : TestCommandBridge("Test_TC_I_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -16920,7 +17167,7 @@ class Test_TC_LVL_2_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_2_1() {} + ~Test_TC_I_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -16928,11 +17175,11 @@ class Test_TC_LVL_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -16949,64 +17196,12 @@ class Test_TC_LVL_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reset level to 254\n"); - err = TestResetLevelTo254_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); + err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); - err = TestWait100ms_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentLevel attribute\n"); - err = TestReadsTheCurrentLevelAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the RemainingTime attribute\n"); - err = TestReadsTheRemainingTimeAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the MinLevel attribute\n"); - err = TestReadsTheMinLevelAttribute_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the MaxLevel attribute\n"); - err = TestReadsTheMaxLevelAttribute_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentFrequency attribute\n"); - err = TestReadsTheCurrentFrequencyAttribute_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the MinFrequency attribute\n"); - err = TestReadsTheMinFrequencyAttribute_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads the MaxFrequency attribute\n"); - err = TestReadsTheMaxFrequencyAttribute_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OnOffTransitionTime attribute\n"); - err = TestReadsTheOnOffTransitionTimeAttribute_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the OnLevel attribute \n"); - err = TestReadsTheOnLevelAttribute_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the OnTransitionTime attribute \n"); - err = TestReadsTheOnTransitionTimeAttribute_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the OffTransitionTime attribute \n"); - err = TestReadsTheOffTransitionTimeAttribute_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the DefaultMoveRate attribute \n"); - err = TestReadsTheDefaultMoveRateAttribute_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reads the Options attribute \n"); - err = TestReadsTheOptionsAttribute_15(); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); + err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); break; } @@ -17023,7 +17218,7 @@ class Test_TC_LVL_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -17036,314 +17231,525 @@ class Test_TC_LVL_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestResetLevelTo254_1() + CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset level to 254 Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + [cluster readAttributeIdentifyTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyTime attribute from the DUT Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintType("identifyTime", "", "uint16")); + NextTest(); + }]; - CHIP_ERROR TestWait100ms_2() - { - WaitForMs(100); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheCurrentLevelAttribute_3() + CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentLevel attribute Error: %@", err); + [cluster readAttributeIdentifyTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyType attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 254)); + VerifyOrReturn(CheckConstraintType("identifyType", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("identifyType", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("identifyType", [value unsignedCharValue], 5)); } - VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsTheRemainingTimeAttribute_4() +class Test_TC_I_2_3 : public TestCommandBridge { +public: + Test_TC_I_2_3() + : TestCommandBridge("Test_TC_I_2_3") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - [cluster readAttributeRemainingTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the RemainingTime attribute Error: %@", err); + ~Test_TC_I_2_3() {} - VerifyOrReturn(CheckValue("status", err, 0)); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - { - id actualValue = value; - VerifyOrReturn(CheckValue("remaining time", actualValue, 0U)); - } + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); + } - VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); - NextTest(); - }]; + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - return CHIP_NO_ERROR; - } + Wait(); - CHIP_ERROR TestReadsTheMinLevelAttribute_5() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : 1.Wait for the commissioned device to be retrieved\n"); + err = Test1WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and " + "the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Manually check DUT executes a blink effect\n"); + err = TestManuallyCheckDutExecutesABlinkEffect_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : check DUT executes a breathe effect\n"); + err = TestCheckDutExecutesABreatheEffect_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and " + "the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : check DUT executes an okay effect\n"); + err = TestCheckDutExecutesAnOkayEffect_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel " + "change and the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : check DUT executes a channel change effect\n"); + err = TestCheckDutExecutesAChannelChangeEffect_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : check DUT executes a breathe effect\n"); + err = TestCheckDutExecutesABreatheEffect_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish " + "effect and the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Manually check DUT stops the breathe effect after the current effect sequence\n"); + err = TestManuallyCheckDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Manually check DUT executes a breathe effect\n"); + err = TestManuallyCheckDutExecutesABreatheEffect_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + "effect and the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Check DUT stops the breathe effect as soon as possible.\n"); + err = TestCheckDutStopsTheBreatheEffectAsSoonAsPossible_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " + "and the effect variant field set to 0x42 unknown\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Check DUT executes a blink effect.\n"); + err = TestCheckDutExecutesABlinkEffect_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + "effect and the effect variant field set to 0x00 default\n"); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19(); + break; + case 20: + ChipLogProgress( + chipTool, " ***** Test Step 20 : Check DUT stops any effect that may be still running as soon as possible\n"); + err = TestCheckDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20(); + break; + } - [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MinLevel attribute Error: %@", err); + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } - VerifyOrReturn(CheckValue("status", err, 0)); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("min level", actualValue, 0)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 21; - VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR Test1WaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheMaxLevelAttribute_6() + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MaxLevel attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and " + @"the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheCurrentFrequencyAttribute_7() + CHIP_ERROR TestManuallyCheckDutExecutesABlinkEffect_2() + { + UserPrompt(@"DUT executes a blink effect"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentFrequency attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and " + @"the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current frequency", actualValue, 0U)); - } + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("currentFrequency", "", "uint16")); - NextTest(); - }]; + return CHIP_NO_ERROR; + } + CHIP_ERROR TestCheckDutExecutesABreatheEffect_4() + { + UserPrompt(@"DUT executes a breathe effect"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheMinFrequencyAttribute_8() + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MinFrequency attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:2]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and the " + @"effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("min frequency", actualValue, 0U)); - } + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("minFrequency", "", "uint16")); - NextTest(); - }]; + return CHIP_NO_ERROR; + } + CHIP_ERROR TestCheckDutExecutesAnOkayEffect_6() + { + UserPrompt(@"DUT executes an okay effect"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheMaxFrequencyAttribute_9() + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the MaxFrequency attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:11]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel " + @"change and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("max frequency", actualValue, 0U)); - } + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("maxFrequency", "", "uint16")); - NextTest(); - }]; + return CHIP_NO_ERROR; + } + CHIP_ERROR TestCheckDutExecutesAChannelChangeEffect_8() + { + UserPrompt(@"DUT executes a channel change effect"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOnOffTransitionTimeAttribute_10() + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnOffTransitionTime attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and " + @"the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("on off transition time", actualValue, 0U)); - } + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); - NextTest(); - }]; + return CHIP_NO_ERROR; + } + CHIP_ERROR TestCheckDutExecutesABreatheEffect_10() + { + UserPrompt(@"DUT executes a breathe effect"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOnLevelAttribute_11() + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnLevel attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:254]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish " + @"effect and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOnTransitionTimeAttribute_12() + CHIP_ERROR TestManuallyCheckDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12() + { + UserPrompt(@"DUT stops the breathe effect after the current effect sequence"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnTransitionTime attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and " + @"the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOffTransitionTimeAttribute_13() + CHIP_ERROR TestManuallyCheckDutExecutesABreatheEffect_14() + { + UserPrompt(@"DUT executes a breathe effect"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OffTransitionTime attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop effect " + @"and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheDefaultMoveRateAttribute_14() + CHIP_ERROR TestCheckDutStopsTheBreatheEffectAsSoonAsPossible_16() + { + UserPrompt(@"DUT stops the breathe effect as soon as possible"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the DefaultMoveRate attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0]; + params.effectVariant = [NSNumber numberWithUnsignedChar:66]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and " + @"the effect variant field set to 0x42 unknown Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOptionsAttribute_15() + CHIP_ERROR TestCheckDutExecutesABlinkEffect_18() + { + UserPrompt(@"DUT executes a blink effect"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestIdentify * cluster = [[CHIPTestIdentify alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOptionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the Options attribute Error: %@", err); + __auto_type * params = [[CHIPIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0]; + [cluster triggerEffectWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop effect " + @"and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("options", actualValue, 0)); - } + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("options", "", "map8")); - NextTest(); - }]; + return CHIP_NO_ERROR; + } + CHIP_ERROR TestCheckDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20() + { + UserPrompt(@"DUT stops any effect that may be still running as soon as possible"); return CHIP_NO_ERROR; } }; -class Test_TC_LVL_2_2 : public TestCommandBridge { +class Test_TC_LVL_1_1 : public TestCommandBridge { public: - Test_TC_LVL_2_2() - : TestCommandBridge("Test_TC_LVL_2_2") + Test_TC_LVL_1_1() + : TestCommandBridge("Test_TC_LVL_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -17352,7 +17758,7 @@ class Test_TC_LVL_2_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_2_2() {} + ~Test_TC_LVL_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -17360,11 +17766,11 @@ class Test_TC_LVL_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -17381,64 +17787,49 @@ class Test_TC_LVL_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the OnOffTransitionTime attribute from the DUT\n"); - err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : writes the OnOffTransitionTime attribute on the DUT\n"); - err = TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the OnOffTransitionTime attribute from the DUT\n"); - err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3(); + ChipLogProgress( + chipTool, " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : writes default value of OnOffTransitionTime attribute\n"); - err = TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : writes the OnLevel attribute on the DUT\n"); - err = TestWritesTheOnLevelAttributeOnTheDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the OnLevel attribute from the DUT\n"); - err = TestReadsTheOnLevelAttributeFromTheDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Writes the OnTransitionTime attribute on the DUT\n"); - err = TestWritesTheOnTransitionTimeAttributeOnTheDut_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the OnTransitionTime attribute from the DUT\n"); - err = TestReadsTheOnTransitionTimeAttributeFromTheDut_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Writes the OffTransitionTime attribute on the DUT\n"); - err = TestWritesTheOffTransitionTimeAttributeOnTheDut_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional global attribute : FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OffTransitionTime attribute from the DUT\n"); - err = TestReadsTheOffTransitionTimeAttributeFromTheDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the DefaultMoveRate attribute from the DUT\n"); - err = TestReadsTheDefaultMoveRateAttributeFromTheDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Writes the DefaultMoveRate attribute on the DUT\n"); - err = TestWritesTheDefaultMoveRateAttributeOnTheDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the DefaultMoveRate attribute from the DUT\n"); - err = TestReadsTheDefaultMoveRateAttributeFromTheDut_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : writes the StartUpCurrentLevel attribute on the DUT\n"); - err = TestWritesTheStartUpCurrentLevelAttributeOnTheDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : reads the StartUpCurrentLevel attribute from the DUT\n"); - err = TestReadsTheStartUpCurrentLevelAttributeFromTheDut_15(); + ChipLogProgress(chipTool, " ***** Test Step 11 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_11(); break; } @@ -17455,7 +17846,7 @@ class Test_TC_LVL_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; + const uint16_t mTestCount = 12; chip::Optional mNodeId; chip::Optional mCluster; @@ -17468,330 +17859,214 @@ class Test_TC_LVL_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("on off transition time", actualValue, 0U)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); } - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id onOffTransitionTimeArgument; - onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:10U]; - [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes the OnOffTransitionTime attribute on the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("on off transition time", actualValue, 10U)); - } - - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id onOffTransitionTimeArgument; - onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:0U]; - [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes default value of OnOffTransitionTime attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheOnLevelAttributeOnTheDut_5() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id onLevelArgument; - onLevelArgument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeOnLevelWithValue:onLevelArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes the OnLevel attribute on the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:4U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog( + @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOnLevelAttributeFromTheDut_6() + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnLevel attribute from the DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueNonNull("on level", actualValue)); - VerifyOrReturn(CheckValue("on level", actualValue, 254)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); } - VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheOnTransitionTimeAttributeOnTheDut_7() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id onTransitionTimeArgument; - onTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; - [cluster writeAttributeOnTransitionTimeWithValue:onTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the OnTransitionTime attribute on the DUT Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOnTransitionTimeAttributeFromTheDut_8() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OnTransitionTime attribute from the DUT Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("on transition time", actualValue)); - VerifyOrReturn(CheckValue("on transition time", actualValue, 100U)); - } - - VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheOffTransitionTimeAttributeOnTheDut_9() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id offTransitionTimeArgument; - offTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; - [cluster writeAttributeOffTransitionTimeWithValue:offTransitionTimeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the OffTransitionTime attribute on the DUT Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOffTransitionTimeAttributeFromTheDut_10() + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_8() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the OffTransitionTime attribute from the DUT Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueNonNull("off transition time", actualValue)); - VerifyOrReturn(CheckValue("off transition time", actualValue, 100U)); + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 3UL)); } - VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_11() + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_9() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional global attribute : FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("default move rate", actualValue)); - VerifyOrReturn(CheckValue("default move rate", actualValue, 0)); - } - - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheDefaultMoveRateAttributeOnTheDut_12() + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id defaultMoveRateArgument; - defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:100]; - [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the DefaultMoveRate attribute on the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_13() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("default move rate", actualValue)); - VerifyOrReturn(CheckValue("default move rate", actualValue, 100)); - } - - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheStartUpCurrentLevelAttributeOnTheDut_14() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id startUpCurrentLevelArgument; - startUpCurrentLevelArgument = [NSNumber numberWithUnsignedChar:254]; - [cluster writeAttributeStartUpCurrentLevelWithValue:startUpCurrentLevelArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"writes the StartUpCurrentLevel attribute on the DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id featureMapArgument; + featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheStartUpCurrentLevelAttributeFromTheDut_15() + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_11() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeStartUpCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads the StartUpCurrentLevel attribute from the DUT Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("start up current level", actualValue)); - VerifyOrReturn(CheckValue("start up current level", actualValue, 254)); - } - - VerifyOrReturn(CheckConstraintType("startUpCurrentLevel", "", "uint8")); + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); }]; @@ -17799,10 +18074,10 @@ class Test_TC_LVL_2_2 : public TestCommandBridge { } }; -class Test_TC_LVL_3_1 : public TestCommandBridge { +class Test_TC_LVL_2_1 : public TestCommandBridge { public: - Test_TC_LVL_3_1() - : TestCommandBridge("Test_TC_LVL_3_1") + Test_TC_LVL_2_1() + : TestCommandBridge("Test_TC_LVL_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -17811,7 +18086,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_3_1() {} + ~Test_TC_LVL_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -17819,11 +18094,11 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -17840,64 +18115,64 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reset level to 254\n"); + err = TestResetLevelTo254_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the MinLevel attribute\n"); - err = TestReadsTheMinLevelAttribute_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); + err = TestWait100ms_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the MaxLevel attribute\n"); - err = TestReadsTheMaxLevelAttribute_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentLevel attribute\n"); + err = TestReadsTheCurrentLevelAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the RemainingTime attribute\n"); + err = TestReadsTheRemainingTimeAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 100ms\n"); - err = TestWait100ms_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the MinLevel attribute\n"); + err = TestReadsTheMinLevelAttribute_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the MaxLevel attribute\n"); + err = TestReadsTheMaxLevelAttribute_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentFrequency attribute\n"); + err = TestReadsTheCurrentFrequencyAttribute_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 11000 second\n"); - err = TestWait11000Second_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the MinFrequency attribute\n"); + err = TestReadsTheMinFrequencyAttribute_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads the MaxFrequency attribute\n"); + err = TestReadsTheMaxFrequencyAttribute_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads On Off Transition Time attribute from DUT\n"); - err = TestReadsOnOffTransitionTimeAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OnOffTransitionTime attribute\n"); + err = TestReadsTheOnOffTransitionTimeAttribute_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the OnLevel attribute \n"); + err = TestReadsTheOnLevelAttribute_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); - err = TestWait1000ms_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the OnTransitionTime attribute \n"); + err = TestReadsTheOnTransitionTimeAttribute_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the OffTransitionTime attribute \n"); + err = TestReadsTheOffTransitionTimeAttribute_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reset level to 254\n"); - err = TestResetLevelTo254_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the DefaultMoveRate attribute \n"); + err = TestReadsTheDefaultMoveRateAttribute_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 100ms\n"); - err = TestWait100ms_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads the Options attribute \n"); + err = TestReadsTheOptionsAttribute_15(); break; } @@ -17927,17 +18202,51 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() + CHIP_ERROR TestResetLevelTo254_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait100ms_2() + { + WaitForMs(100); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheCurrentLevelAttribute_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + NSLog(@"Reads the CurrentLevel attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("current level", actualValue, 254)); + } + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); NextTest(); }]; @@ -17945,7 +18254,30 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheMinLevelAttribute_2() + CHIP_ERROR TestReadsTheRemainingTimeAttribute_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRemainingTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the RemainingTime attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("remaining time", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheMinLevelAttribute_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -17956,6 +18288,11 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("min level", actualValue, 0)); + } + VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); NextTest(); }]; @@ -17963,7 +18300,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheMaxLevelAttribute_3() + CHIP_ERROR TestReadsTheMaxLevelAttribute_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -17981,211 +18318,198 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveToLevelCommand_4() + CHIP_ERROR TestReadsTheCurrentFrequencyAttribute_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentFrequency attribute Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("current frequency", actualValue, 0U)); + } - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintType("currentFrequency", "", "uint16")); + NextTest(); + }]; - CHIP_ERROR TestWait100ms_5() - { - WaitForMs(100); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + CHIP_ERROR TestReadsTheMinFrequencyAttribute_8() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeMinFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MinFrequency attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 64)); + VerifyOrReturn(CheckValue("min frequency", actualValue, 0U)); } + VerifyOrReturn(CheckConstraintType("minFrequency", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveToLevelCommand_7() + CHIP_ERROR TestReadsTheMaxFrequencyAttribute_9() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:100]; - params.transitionTime = [NSNumber numberWithUnsignedShort:100U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeMaxFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MaxFrequency attribute Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("max frequency", actualValue, 0U)); + } - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintType("maxFrequency", "", "uint16")); + NextTest(); + }]; - CHIP_ERROR TestWait11000Second_8() - { - WaitForMs(11000); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + CHIP_ERROR TestReadsTheOnOffTransitionTimeAttribute_10() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnOffTransitionTime attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 100)); + VerifyOrReturn(CheckValue("on off transition time", actualValue, 0U)); } + VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_10() + CHIP_ERROR TestReadsTheOnLevelAttribute_11() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnLevel attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); + VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveToLevelCommand_11() + CHIP_ERROR TestReadsTheOnTransitionTimeAttribute_12() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:128]; - params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnTransitionTime attribute Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait1000ms_12() + CHIP_ERROR TestReadsTheOffTransitionTimeAttribute_13() { - WaitForMs(1000); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OffTransitionTime attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() + CHIP_ERROR TestReadsTheDefaultMoveRateAttribute_14() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the DefaultMoveRate attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 128)); - } - + VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestResetLevelTo254_14() + CHIP_ERROR TestReadsTheOptionsAttribute_15() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset level to 254 Error: %@", err); + [cluster readAttributeOptionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the Options attribute Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("options", actualValue, 0)); + } - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintType("options", "", "map8")); + NextTest(); + }]; - CHIP_ERROR TestWait100ms_15() - { - WaitForMs(100); return CHIP_NO_ERROR; } }; -class Test_TC_LVL_4_1 : public TestCommandBridge { +class Test_TC_LVL_2_2 : public TestCommandBridge { public: - Test_TC_LVL_4_1() - : TestCommandBridge("Test_TC_LVL_4_1") + Test_TC_LVL_2_2() + : TestCommandBridge("Test_TC_LVL_2_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -18194,7 +18518,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_4_1() {} + ~Test_TC_LVL_2_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -18202,11 +18526,11 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -18223,72 +18547,64 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); - err = TestReadsMaxLevelAttributeFromDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the OnOffTransitionTime attribute from the DUT\n"); + err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); - err = TestSendsAMoveUpCommand_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : writes the OnOffTransitionTime attribute on the DUT\n"); + err = TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : user prompt message\n"); - err = TestUserPromptMessage_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the OnOffTransitionTime attribute from the DUT\n"); + err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); - err = TestWait3000ms_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : writes default value of OnOffTransitionTime attribute\n"); + err = TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : writes the OnLevel attribute on the DUT\n"); + err = TestWritesTheOnLevelAttributeOnTheDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads min level attribute from DUT\n"); - err = TestReadsMinLevelAttributeFromDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the OnLevel attribute from the DUT\n"); + err = TestReadsTheOnLevelAttributeFromTheDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move down command\n"); - err = TestSendsAMoveDownCommand_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Writes the OnTransitionTime attribute on the DUT\n"); + err = TestWritesTheOnTransitionTimeAttributeOnTheDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : user prompt message\n"); - err = TestUserPromptMessage_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the OnTransitionTime attribute from the DUT\n"); + err = TestReadsTheOnTransitionTimeAttributeFromTheDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); - err = TestWait5000ms_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Writes the OffTransitionTime attribute on the DUT\n"); + err = TestWritesTheOffTransitionTimeAttributeOnTheDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OffTransitionTime attribute from the DUT\n"); + err = TestReadsTheOffTransitionTimeAttributeFromTheDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads default move rate attribute from DUT\n"); - err = TestReadsDefaultMoveRateAttributeFromDut_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the DefaultMoveRate attribute from the DUT\n"); + err = TestReadsTheDefaultMoveRateAttributeFromTheDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : sends a Move up command at default move rate\n"); - err = TestSendsAMoveUpCommandAtDefaultMoveRate_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Writes the DefaultMoveRate attribute on the DUT\n"); + err = TestWritesTheDefaultMoveRateAttributeOnTheDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 100ms\n"); - err = TestWait100ms_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the DefaultMoveRate attribute from the DUT\n"); + err = TestReadsTheDefaultMoveRateAttributeFromTheDut_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : writes the StartUpCurrentLevel attribute on the DUT\n"); + err = TestWritesTheStartUpCurrentLevelAttributeOnTheDut_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : user prompt message\n"); - err = TestUserPromptMessage_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Reset level to 254\n"); - err = TestResetLevelTo254_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Wait 100ms\n"); - err = TestWait100ms_17(); + ChipLogProgress(chipTool, " ***** Test Step 15 : reads the StartUpCurrentLevel attribute from the DUT\n"); + err = TestReadsTheStartUpCurrentLevelAttributeFromTheDut_15(); break; } @@ -18305,7 +18621,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 16; chip::Optional mNodeId; chip::Optional mCluster; @@ -18317,290 +18633,342 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - NSNumber * _Nonnull MaxlevelValue; - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() + CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads max level attribute from DUT Error: %@", err); + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); { - MaxlevelValue = value; + id actualValue = value; + VerifyOrReturn(CheckValue("on off transition time", actualValue, 0U)); } + VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveUpCommand_2() + CHIP_ERROR TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:32]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move up command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; + id onOffTransitionTimeArgument; + onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:10U]; + [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes the OnOffTransitionTime attribute on the DUT Error: %@", err); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err, 0)); - CHIP_ERROR TestUserPromptMessage_3() - { - UserPrompt(@"Physically verify that the DUT moves at a rate of 32 units per second or as close as possible to this rate " - @"and completes moving to its maximum level"); - return CHIP_NO_ERROR; - } + NextTest(); + }]; - CHIP_ERROR TestWait3000ms_4() - { - WaitForMs(3000); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_5() + CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, MaxlevelValue)); + VerifyOrReturn(CheckValue("on off transition time", actualValue, 10U)); } + VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - NSNumber * _Nonnull MinlevelValue; - CHIP_ERROR TestReadsMinLevelAttributeFromDut_6() + CHIP_ERROR TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads min level attribute from DUT Error: %@", err); + id onOffTransitionTimeArgument; + onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:0U]; + [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes default value of OnOffTransitionTime attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesTheOnLevelAttributeOnTheDut_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id onLevelArgument; + onLevelArgument = [NSNumber numberWithUnsignedChar:254]; + [cluster writeAttributeOnLevelWithValue:onLevelArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes the OnLevel attribute on the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheOnLevelAttributeFromTheDut_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnLevel attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); { - MinlevelValue = value; + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("on level", actualValue)); + VerifyOrReturn(CheckValue("on level", actualValue, 254)); } + VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveDownCommand_7() + CHIP_ERROR TestWritesTheOnTransitionTimeAttributeOnTheDut_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedChar:64]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move down command Error: %@", err); + id onTransitionTimeArgument; + onTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; + [cluster writeAttributeOnTransitionTimeWithValue:onTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the OnTransitionTime attribute on the DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestUserPromptMessage_8() + CHIP_ERROR TestReadsTheOnTransitionTimeAttributeFromTheDut_8() { - UserPrompt(@"Physically verify that the DUT moves at a rate of 64 units per second or as close as possible to this rate " - @"and complete moving to its minimum level"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnTransitionTime attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("on transition time", actualValue)); + VerifyOrReturn(CheckValue("on transition time", actualValue, 100U)); + } + + VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestWait5000ms_9() + CHIP_ERROR TestWritesTheOffTransitionTimeAttributeOnTheDut_9() { - WaitForMs(5000); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id offTransitionTimeArgument; + offTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; + [cluster writeAttributeOffTransitionTimeWithValue:offTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the OffTransitionTime attribute on the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + CHIP_ERROR TestReadsTheOffTransitionTimeAttributeFromTheDut_10() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OffTransitionTime attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 1)); - } - - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 1)); + VerifyOrReturn(CheckValueNonNull("off transition time", actualValue)); + VerifyOrReturn(CheckValue("off transition time", actualValue, 100U)); } + VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - NSNumber * _Nullable DefaultMoveRateValue; - CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_11() + CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_11() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads default move rate attribute from DUT Error: %@", err); + NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); { - DefaultMoveRateValue = value; + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("default move rate", actualValue)); + VerifyOrReturn(CheckValue("default move rate", actualValue, 0)); } + VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_12() + CHIP_ERROR TestWritesTheDefaultMoveRateAttributeOnTheDut_12() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:255]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move up command at default move rate Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id defaultMoveRateArgument; + defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:100]; + [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the DefaultMoveRate attribute on the DUT Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); - return CHIP_NO_ERROR; - } + NextTest(); + }]; - CHIP_ERROR TestWait100ms_13() - { - WaitForMs(100); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_14() + CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_13() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - if (value != nil) { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, 255)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("default move rate", actualValue)); + VerifyOrReturn(CheckValue("default move rate", actualValue, 100)); } + VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestUserPromptMessage_15() + CHIP_ERROR TestWritesTheStartUpCurrentLevelAttributeOnTheDut_14() { - UserPrompt( - @"Physically verify that the device moves at the rate recorded in step 3a and completes moving to its maximum level."); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id startUpCurrentLevelArgument; + startUpCurrentLevelArgument = [NSNumber numberWithUnsignedChar:254]; + [cluster writeAttributeStartUpCurrentLevelWithValue:startUpCurrentLevelArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes the StartUpCurrentLevel attribute on the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestResetLevelTo254_16() + CHIP_ERROR TestReadsTheStartUpCurrentLevelAttributeFromTheDut_15() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset level to 254 Error: %@", err); + [cluster readAttributeStartUpCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads the StartUpCurrentLevel attribute from the DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("start up current level", actualValue)); + VerifyOrReturn(CheckValue("start up current level", actualValue, 254)); + } - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintType("startUpCurrentLevel", "", "uint8")); + NextTest(); + }]; - CHIP_ERROR TestWait100ms_17() - { - WaitForMs(100); return CHIP_NO_ERROR; } }; -class Test_TC_LVL_5_1 : public TestCommandBridge { +class Test_TC_LVL_3_1 : public TestCommandBridge { public: - Test_TC_LVL_5_1() - : TestCommandBridge("Test_TC_LVL_5_1") + Test_TC_LVL_3_1() + : TestCommandBridge("Test_TC_LVL_3_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -18609,7 +18977,7 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_5_1() {} + ~Test_TC_LVL_3_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -18617,11 +18985,11 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -18638,56 +19006,64 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); - err = TestSendingOnCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to its lowest point\n"); - err = TestPreconditionDutLevelIsSetToItsLowestPoint_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the MinLevel attribute\n"); + err = TestReadsTheMinLevelAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); - err = TestWait3000ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the MaxLevel attribute\n"); + err = TestReadsTheMaxLevelAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step up command to DUT\n"); - err = TestSendsStepUpCommandToDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 100ms\n"); + err = TestWait100ms_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 5000ms\n"); - err = TestWait5000ms_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step down command\n"); - err = TestSendsAStepDownCommand_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 11000 second\n"); + err = TestWait11000Second_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 4000ms\n"); - err = TestWait4000ms_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : reads On Off Transition Time attribute from DUT\n"); + err = TestReadsOnOffTransitionTimeAttributeFromDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 254\n"); - err = TestResetLevelTo254_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); - err = TestWait100ms_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); + err = TestWait1000ms_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Sending off command\n"); - err = TestSendingOffCommand_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Reset level to 254\n"); + err = TestResetLevelTo254_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 100ms\n"); + err = TestWait100ms_15(); break; } @@ -18704,7 +19080,7 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + const uint16_t mTestCount = 16; chip::Optional mNodeId; chip::Optional mCluster; @@ -18717,119 +19093,103 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendingOnCommand_1() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending on command Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionDutLevelIsSetToItsLowestPoint_2() + CHIP_ERROR TestReadsTheMinLevelAttribute_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:100]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: DUT level is set to its lowest point Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MinLevel attribute Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); + NextTest(); + }]; - CHIP_ERROR TestWait3000ms_3() - { - WaitForMs(3000); return CHIP_NO_ERROR; } - NSNumber * _Nonnull CurrentlevelValue; - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + CHIP_ERROR TestReadsTheMaxLevelAttribute_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MaxLevel attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); - { - CurrentlevelValue = value; - } - + VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsStepUpCommandToDut_5() + CHIP_ERROR TestSendsAMoveToLevelCommand_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:0]; - params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends step up command to DUT Error: %@", err); + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:64]; + params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move to level command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait5000ms_6() + CHIP_ERROR TestWait100ms_5() { - WaitForMs(5000); + WaitForMs(100); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_7() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - if (value != nil) { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, CurrentlevelValue)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("current level", actualValue, 64)); } NextTest(); @@ -18838,50 +19198,49 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAStepDownCommand_8() + CHIP_ERROR TestSendsAMoveToLevelCommand_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends a Step down command Error: %@", err); + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:100]; + params.transitionTime = [NSNumber numberWithUnsignedShort:100U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move to level command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait4000ms_9() + CHIP_ERROR TestWait11000Second_8() { - WaitForMs(4000); + WaitForMs(11000); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, CurrentlevelValue)); + VerifyOrReturn(CheckValue("current level", actualValue, 100)); } NextTest(); @@ -18890,20 +19249,38 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestResetLevelTo254_11() + CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_11() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.level = [NSNumber numberWithUnsignedChar:128]; + params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveToLevelWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset level to 254 Error: %@", err); + NSLog(@"sends a Move to level command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); @@ -18913,34 +19290,68 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait100ms_12() + CHIP_ERROR TestWait1000ms_12() { - WaitForMs(100); + WaitForMs(1000); return CHIP_NO_ERROR; } - CHIP_ERROR TestSendingOffCommand_13() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending off command Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("current level", actualValue, 128)); + } + NextTest(); }]; return CHIP_NO_ERROR; } + + CHIP_ERROR TestResetLevelTo254_14() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait100ms_15() + { + WaitForMs(100); + return CHIP_NO_ERROR; + } }; -class Test_TC_LVL_6_1 : public TestCommandBridge { +class Test_TC_LVL_4_1 : public TestCommandBridge { public: - Test_TC_LVL_6_1() - : TestCommandBridge("Test_TC_LVL_6_1") + Test_TC_LVL_4_1() + : TestCommandBridge("Test_TC_LVL_4_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -18949,7 +19360,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_6_1() {} + ~Test_TC_LVL_4_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -18957,11 +19368,11 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_6_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_6_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -18978,48 +19389,72 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); - err = TestSendingOnCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); + err = TestReadsMaxLevelAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: set DUT to lowest point\n"); - err = TestPreconditionSetDutToLowestPoint_2(); - break; + ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); + err = TestSendsAMoveUpCommand_2(); + break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 100ms\n"); - err = TestWait100ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : user prompt message\n"); + err = TestUserPromptMessage_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); + err = TestWait3000ms_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends a move up command to DUT\n"); - err = TestSendsAMoveUpCommandToDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 2000ms\n"); - err = TestWait2000ms_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : reads min level attribute from DUT\n"); + err = TestReadsMinLevelAttributeFromDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Sends stop command to DUT\n"); - err = TestSendsStopCommandToDut_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move down command\n"); + err = TestSendsAMoveDownCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : user prompt message\n"); + err = TestUserPromptMessage_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reset level to 254\n"); - err = TestResetLevelTo254_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); + err = TestWait5000ms_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 100ms\n"); - err = TestWait100ms_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Sending off command\n"); - err = TestSendingOffCommand_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : reads default move rate attribute from DUT\n"); + err = TestReadsDefaultMoveRateAttributeFromDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : sends a Move up command at default move rate\n"); + err = TestSendsAMoveUpCommandAtDefaultMoveRate_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 100ms\n"); + err = TestWait100ms_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : user prompt message\n"); + err = TestUserPromptMessage_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Reset level to 254\n"); + err = TestResetLevelTo254_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Wait 100ms\n"); + err = TestWait100ms_17(); break; } @@ -19036,7 +19471,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; @@ -19048,73 +19483,103 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + NSNumber * _Nonnull MaxlevelValue; - CHIP_ERROR TestSendingOnCommand_1() + CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending on command Error: %@", err); + [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads max level attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); + { + MaxlevelValue = value; + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionSetDutToLowestPoint_2() + CHIP_ERROR TestSendsAMoveUpCommand_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:0]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0]; + params.rate = [NSNumber numberWithUnsignedChar:32]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: set DUT to lowest point Error: %@", err); + [cluster moveWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move up command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait100ms_3() + CHIP_ERROR TestUserPromptMessage_3() { - WaitForMs(100); + UserPrompt(@"Physically verify that the DUT moves at a rate of 32 units per second or as close as possible to this rate " + @"and completes moving to its maximum level"); return CHIP_NO_ERROR; } - NSNumber * _Nonnull CurrentLevelValue; - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + CHIP_ERROR TestWait3000ms_4() + { + WaitForMs(3000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 1)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("current level", actualValue, MaxlevelValue)); } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull MinlevelValue; + + CHIP_ERROR TestReadsMinLevelAttributeFromDut_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads min level attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); { - CurrentLevelValue = value; + MinlevelValue = value; } NextTest(); @@ -19123,20 +19588,20 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveUpCommandToDut_5() + CHIP_ERROR TestSendsAMoveDownCommand_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:1]; + params.moveMode = [NSNumber numberWithUnsignedChar:1]; + params.rate = [NSNumber numberWithUnsignedChar:64]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends a move up command to DUT Error: %@", err); + NSLog(@"sends a Move down command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); @@ -19146,24 +19611,85 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait2000ms_6() + CHIP_ERROR TestUserPromptMessage_8() { - WaitForMs(2000); + UserPrompt(@"Physically verify that the DUT moves at a rate of 64 units per second or as close as possible to this rate " + @"and complete moving to its minimum level"); return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsStopCommandToDut_7() + CHIP_ERROR TestWait5000ms_9() + { + WaitForMs(5000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[CHIPLevelControlClusterStopParams alloc] init]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stopWithParams:params + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("current level", actualValue, 1)); + } + + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 1)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable DefaultMoveRateValue; + + CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads default move rate attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); + { + DefaultMoveRateValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_12() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0]; + params.rate = [NSNumber numberWithUnsignedChar:255]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends stop command to DUT Error: %@", err); + NSLog(@"sends a Move up command at default move rate Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); @@ -19173,19 +19699,25 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + CHIP_ERROR TestWait100ms_13() + { + WaitForMs(100); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_14() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); if (value != nil) { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, CurrentLevelValue)); + VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, 255)); } NextTest(); @@ -19194,7 +19726,14 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestResetLevelTo254_9() + CHIP_ERROR TestUserPromptMessage_15() + { + UserPrompt( + @"Physically verify that the device moves at the rate recorded in step 3a and completes moving to its maximum level."); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestResetLevelTo254_16() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -19217,34 +19756,17 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait100ms_10() + CHIP_ERROR TestWait100ms_17() { WaitForMs(100); return CHIP_NO_ERROR; } - - CHIP_ERROR TestSendingOffCommand_11() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending off command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } }; -class Test_TC_MC_1_1 : public TestCommandBridge { +class Test_TC_LVL_5_1 : public TestCommandBridge { public: - Test_TC_MC_1_1() - : TestCommandBridge("Test_TC_MC_1_1") + Test_TC_LVL_5_1() + : TestCommandBridge("Test_TC_LVL_5_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -19253,7 +19775,7 @@ class Test_TC_MC_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_1_1() {} + ~Test_TC_LVL_5_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -19261,11 +19783,11 @@ class Test_TC_MC_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19282,16 +19804,56 @@ class Test_TC_MC_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); + err = TestSendingOnCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to its lowest point\n"); + err = TestPreconditionDutLevelIsSetToItsLowestPoint_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); + err = TestWait3000ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step up command to DUT\n"); + err = TestSendsStepUpCommandToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 5000ms\n"); + err = TestWait5000ms_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step down command\n"); + err = TestSendsAStepDownCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 4000ms\n"); + err = TestWait4000ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 254\n"); + err = TestResetLevelTo254_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); + err = TestWait100ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Sending off command\n"); + err = TestSendingOffCommand_13(); break; } @@ -19308,7 +19870,7 @@ class Test_TC_MC_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 14; chip::Optional mNodeId; chip::Optional mCluster; @@ -19321,228 +19883,230 @@ class Test_TC_MC_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestSendingOnCommand_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending on command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + CHIP_ERROR TestPreconditionDutLevelIsSetToItsLowestPoint_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; + params.stepMode = [NSNumber numberWithUnsignedChar:1]; + params.stepSize = [NSNumber numberWithUnsignedChar:100]; + params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stepWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Precondition: DUT level is set to its lowest point Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestWait3000ms_3() + { + WaitForMs(3000); + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull CurrentlevelValue; + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); + { + CurrentlevelValue = value; + } + NextTest(); }]; return CHIP_NO_ERROR; } -}; - -class Test_TC_MC_2_1 : public TestCommandBridge { -public: - Test_TC_MC_2_1() - : TestCommandBridge("Test_TC_MC_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_2_1() {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestSendsStepUpCommandToDut_5() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - Wait(); + __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; + params.stepMode = [NSNumber numberWithUnsignedChar:0]; + params.stepSize = [NSNumber numberWithUnsignedChar:64]; + params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stepWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends step up command to DUT Error: %@", err); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Put the device into low power mode\n"); - err = TestPutTheDeviceIntoLowPowerMode_1(); - break; - } + VerifyOrReturn(CheckValue("status", err, 0)); - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + NextTest(); + }]; - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + return CHIP_NO_ERROR; } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestWait5000ms_6() { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + WaitForMs(5000); return CHIP_NO_ERROR; } - CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_1() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster sleepWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Put the device into low power mode Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + if (value != nil) { + VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, CurrentlevelValue)); + } + NextTest(); }]; return CHIP_NO_ERROR; } -}; -class Test_TC_MC_3_1 : public TestCommandBridge { -public: - Test_TC_MC_3_1() - : TestCommandBridge("Test_TC_MC_3_1") - , mTestIndex(0) + CHIP_ERROR TestSendsAStepDownCommand_8() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - ~Test_TC_MC_3_1() {} + __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; + params.stepMode = [NSNumber numberWithUnsignedChar:1]; + params.stepSize = [NSNumber numberWithUnsignedChar:64]; + params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stepWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends a Step down command Error: %@", err); - /////////// TestCommand Interface ///////// - void NextTest() override + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait4000ms_9() { - CHIP_ERROR err = CHIP_NO_ERROR; + WaitForMs(4000); + return CHIP_NO_ERROR; + } - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); - } + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); - Wait(); + VerifyOrReturn(CheckValue("status", err, 0)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("current level", actualValue, CurrentlevelValue)); + } - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + NextTest(); + }]; + + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestResetLevelTo254_11() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait100ms_12() { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + WaitForMs(100); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestSendingOffCommand_13() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending off command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } }; -class Test_TC_MC_3_2 : public TestCommandBridge { +class Test_TC_LVL_6_1 : public TestCommandBridge { public: - Test_TC_MC_3_2() - : TestCommandBridge("Test_TC_MC_3_2") + Test_TC_LVL_6_1() + : TestCommandBridge("Test_TC_LVL_6_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -19551,7 +20115,7 @@ class Test_TC_MC_3_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_2() {} + ~Test_TC_LVL_6_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -19559,11 +20123,11 @@ class Test_TC_MC_3_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_6_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_6_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19579,6 +20143,50 @@ class Test_TC_MC_3_2 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); + err = TestSendingOnCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: set DUT to lowest point\n"); + err = TestPreconditionSetDutToLowestPoint_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 100ms\n"); + err = TestWait100ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends a move up command to DUT\n"); + err = TestSendsAMoveUpCommandToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 2000ms\n"); + err = TestWait2000ms_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Sends stop command to DUT\n"); + err = TestSendsStopCommandToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reset level to 254\n"); + err = TestResetLevelTo254_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 100ms\n"); + err = TestWait100ms_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Sending off command\n"); + err = TestSendingOffCommand_11(); + break; } if (CHIP_NO_ERROR != err) { @@ -19594,7 +20202,7 @@ class Test_TC_MC_3_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 12; chip::Optional mNodeId; chip::Optional mCluster; @@ -19606,81 +20214,203 @@ class Test_TC_MC_3_2 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } -}; -class Test_TC_MC_3_3 : public TestCommandBridge { -public: - Test_TC_MC_3_3() - : TestCommandBridge("Test_TC_MC_3_3") - , mTestIndex(0) + CHIP_ERROR TestSendingOnCommand_1() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending on command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - ~Test_TC_MC_3_3() {} + CHIP_ERROR TestPreconditionSetDutToLowestPoint_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - /////////// TestCommand Interface ///////// - void NextTest() override + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:0]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Precondition: set DUT to lowest point Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait100ms_3() { - CHIP_ERROR err = CHIP_NO_ERROR; + WaitForMs(100); + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull CurrentLevelValue; - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); - } + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); - Wait(); + VerifyOrReturn(CheckValue("status", err, 0)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 1)); + } + { + CurrentLevelValue = value; + } - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + NextTest(); + }]; + + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestSendsAMoveUpCommandToDut_5() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0]; + params.rate = [NSNumber numberWithUnsignedChar:1]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends a move up command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + CHIP_ERROR TestWait2000ms_6() + { + WaitForMs(2000); + return CHIP_NO_ERROR; + } - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + CHIP_ERROR TestSendsStopCommandToDut_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + __auto_type * params = [[CHIPLevelControlClusterStopParams alloc] init]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stopWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends stop command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + if (value != nil) { + VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, CurrentLevelValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestResetLevelTo254_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait100ms_10() + { + WaitForMs(100); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestSendingOffCommand_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending off command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } }; -class Test_TC_MC_3_4 : public TestCommandBridge { +class Test_TC_MC_1_1 : public TestCommandBridge { public: - Test_TC_MC_3_4() - : TestCommandBridge("Test_TC_MC_3_4") + Test_TC_MC_1_1() + : TestCommandBridge("Test_TC_MC_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -19689,7 +20419,7 @@ class Test_TC_MC_3_4 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_4() {} + ~Test_TC_MC_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -19697,11 +20427,11 @@ class Test_TC_MC_3_4 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19717,6 +20447,18 @@ class Test_TC_MC_3_4 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; } if (CHIP_NO_ERROR != err) { @@ -19732,7 +20474,7 @@ class Test_TC_MC_3_4 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -19744,12 +20486,70 @@ class Test_TC_MC_3_4 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_3_5 : public TestCommandBridge { +class Test_TC_MC_1_2 : public TestCommandBridge { public: - Test_TC_MC_3_5() - : TestCommandBridge("Test_TC_MC_3_5") + Test_TC_MC_1_2() + : TestCommandBridge("Test_TC_MC_1_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -19758,7 +20558,7 @@ class Test_TC_MC_3_5 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_5() {} + ~Test_TC_MC_1_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -19766,11 +20566,11 @@ class Test_TC_MC_3_5 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19786,6 +20586,18 @@ class Test_TC_MC_3_5 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; } if (CHIP_NO_ERROR != err) { @@ -19801,7 +20613,7 @@ class Test_TC_MC_3_5 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -19813,81 +20625,70 @@ class Test_TC_MC_3_5 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } -}; -class Test_TC_MC_3_6 : public TestCommandBridge { -public: - Test_TC_MC_3_6() - : TestCommandBridge("Test_TC_MC_3_6") - , mTestIndex(0) + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestKeypadInput * cluster = [[CHIPTestKeypadInput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - ~Test_TC_MC_3_6() {} + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("status", err, 0)); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + NextTest(); + }]; - Wait(); + return CHIP_NO_ERROR; + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestKeypadInput * cluster = [[CHIPTestKeypadInput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestKeypadInput * cluster = [[CHIPTestKeypadInput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } }; -class Test_TC_MC_3_7 : public TestCommandBridge { +class Test_TC_MC_1_3 : public TestCommandBridge { public: - Test_TC_MC_3_7() - : TestCommandBridge("Test_TC_MC_3_7") + Test_TC_MC_1_3() + : TestCommandBridge("Test_TC_MC_1_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -19896,7 +20697,7 @@ class Test_TC_MC_3_7 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_7() {} + ~Test_TC_MC_1_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -19904,11 +20705,11 @@ class Test_TC_MC_3_7 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19924,6 +20725,18 @@ class Test_TC_MC_3_7 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; } if (CHIP_NO_ERROR != err) { @@ -19939,7 +20752,7 @@ class Test_TC_MC_3_7 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -19951,81 +20764,76 @@ class Test_TC_MC_3_7 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } -}; -class Test_TC_MC_3_8 : public TestCommandBridge { -public: - Test_TC_MC_3_8() - : TestCommandBridge("Test_TC_MC_3_8") - , mTestIndex(0) + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestApplicationLauncher * cluster = [[CHIPTestApplicationLauncher alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - ~Test_TC_MC_3_8() {} + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("status", err, 0)); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + NextTest(); + }]; - Wait(); + return CHIP_NO_ERROR; + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestApplicationLauncher * cluster = [[CHIPTestApplicationLauncher alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestApplicationLauncher * cluster = [[CHIPTestApplicationLauncher alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } }; -class Test_TC_MC_3_9 : public TestCommandBridge { +class Test_TC_MC_1_4 : public TestCommandBridge { public: - Test_TC_MC_3_9() - : TestCommandBridge("Test_TC_MC_3_9") + Test_TC_MC_1_4() + : TestCommandBridge("Test_TC_MC_1_4") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20034,7 +20842,7 @@ class Test_TC_MC_3_9 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_9() {} + ~Test_TC_MC_1_4() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20042,11 +20850,11 @@ class Test_TC_MC_3_9 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_4\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_4\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20062,6 +20870,18 @@ class Test_TC_MC_3_9 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; } if (CHIP_NO_ERROR != err) { @@ -20077,7 +20897,7 @@ class Test_TC_MC_3_9 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20089,12 +20909,70 @@ class Test_TC_MC_3_9 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestMediaInput * cluster = [[CHIPTestMediaInput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestMediaInput * cluster = [[CHIPTestMediaInput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestMediaInput * cluster = [[CHIPTestMediaInput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_3_10 : public TestCommandBridge { +class Test_TC_MC_1_5 : public TestCommandBridge { public: - Test_TC_MC_3_10() - : TestCommandBridge("Test_TC_MC_3_10") + Test_TC_MC_1_5() + : TestCommandBridge("Test_TC_MC_1_5") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20103,7 +20981,7 @@ class Test_TC_MC_3_10 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_10() {} + ~Test_TC_MC_1_5() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20111,11 +20989,11 @@ class Test_TC_MC_3_10 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_5\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_5\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20131,6 +21009,18 @@ class Test_TC_MC_3_10 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; } if (CHIP_NO_ERROR != err) { @@ -20146,7 +21036,7 @@ class Test_TC_MC_3_10 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20158,12 +21048,70 @@ class Test_TC_MC_3_10 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWakeOnLan * cluster = [[CHIPTestWakeOnLan alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWakeOnLan * cluster = [[CHIPTestWakeOnLan alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWakeOnLan * cluster = [[CHIPTestWakeOnLan alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_3_11 : public TestCommandBridge { +class Test_TC_MC_1_6 : public TestCommandBridge { public: - Test_TC_MC_3_11() - : TestCommandBridge("Test_TC_MC_3_11") + Test_TC_MC_1_6() + : TestCommandBridge("Test_TC_MC_1_6") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20172,7 +21120,7 @@ class Test_TC_MC_3_11 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_11() {} + ~Test_TC_MC_1_6() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20180,11 +21128,11 @@ class Test_TC_MC_3_11 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_6\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_6\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20200,6 +21148,18 @@ class Test_TC_MC_3_11 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; } if (CHIP_NO_ERROR != err) { @@ -20215,7 +21175,7 @@ class Test_TC_MC_3_11 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20227,12 +21187,70 @@ class Test_TC_MC_3_11 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestChannel * cluster = [[CHIPTestChannel alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestChannel * cluster = [[CHIPTestChannel alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestChannel * cluster = [[CHIPTestChannel alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_5_1 : public TestCommandBridge { +class Test_TC_MC_1_7 : public TestCommandBridge { public: - Test_TC_MC_5_1() - : TestCommandBridge("Test_TC_MC_5_1") + Test_TC_MC_1_7() + : TestCommandBridge("Test_TC_MC_1_7") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20241,7 +21259,7 @@ class Test_TC_MC_5_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_5_1() {} + ~Test_TC_MC_1_7() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20249,11 +21267,11 @@ class Test_TC_MC_5_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_7\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_7\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20270,8 +21288,16 @@ class Test_TC_MC_5_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the ChannelList attribute from the DUT\n"); - err = TestReadsTheChannelListAttributeFromTheDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; } @@ -20288,7 +21314,7 @@ class Test_TC_MC_5_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20301,18 +21327,58 @@ class Test_TC_MC_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheChannelListAttributeFromTheDut_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestChannel * cluster = [[CHIPTestChannel alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeChannelListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ChannelList attribute from the DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("channelList", "", "list")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; @@ -20320,10 +21386,10 @@ class Test_TC_MC_5_1 : public TestCommandBridge { } }; -class Test_TC_MC_5_2 : public TestCommandBridge { +class Test_TC_MC_1_8 : public TestCommandBridge { public: - Test_TC_MC_5_2() - : TestCommandBridge("Test_TC_MC_5_2") + Test_TC_MC_1_8() + : TestCommandBridge("Test_TC_MC_1_8") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20332,7 +21398,7 @@ class Test_TC_MC_5_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_5_2() {} + ~Test_TC_MC_1_8() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20340,11 +21406,11 @@ class Test_TC_MC_5_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_8\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_8\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20361,8 +21427,16 @@ class Test_TC_MC_5_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; } @@ -20379,7 +21453,7 @@ class Test_TC_MC_5_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20392,96 +21466,69 @@ class Test_TC_MC_5_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { - UserPrompt(@"verify that the channel has changed on the device."); - return CHIP_NO_ERROR; - } -}; + CHIPDevice * device = GetConnectedDevice(); + CHIPTestAudioOutput * cluster = [[CHIPTestAudioOutput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -class Test_TC_MC_5_3 : public TestCommandBridge { -public: - Test_TC_MC_5_3() - : TestCommandBridge("Test_TC_MC_5_3") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_5_3() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_3\n"); - } + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - Wait(); + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestAudioOutput * cluster = [[CHIPTestAudioOutput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_1() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - UserPrompt(@"verify that the channel has changed on the device"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestAudioOutput * cluster = [[CHIPTestAudioOutput alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + return CHIP_NO_ERROR; } }; -class Test_TC_MC_6_1 : public TestCommandBridge { +class Test_TC_MC_1_9 : public TestCommandBridge { public: - Test_TC_MC_6_1() - : TestCommandBridge("Test_TC_MC_6_1") + Test_TC_MC_1_9() + : TestCommandBridge("Test_TC_MC_1_9") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20490,7 +21537,7 @@ class Test_TC_MC_6_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_1() {} + ~Test_TC_MC_1_9() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20498,11 +21545,11 @@ class Test_TC_MC_6_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_9\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_9\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20519,24 +21566,16 @@ class Test_TC_MC_6_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the playback state attribute\n"); - err = TestReadsThePlaybackStateAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); - err = TestLogACommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; } @@ -20553,7 +21592,7 @@ class Test_TC_MC_6_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20566,32 +21605,20 @@ class Test_TC_MC_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_1() - { - UserPrompt(@"Verify that media is paused"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestLogACommand_2() - { - UserPrompt(@"Physically verify that the media is playing"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsThePlaybackStateAttribute_3() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the playback state attribute Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); } NextTest(); @@ -20600,23 +21627,47 @@ class Test_TC_MC_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_4() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() { - UserPrompt(@"Physically verify that the media is paused"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_5() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - UserPrompt(@"Physically verify that the media is stoped"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + return CHIP_NO_ERROR; } }; -class Test_TC_MC_6_2 : public TestCommandBridge { +class Test_TC_MC_1_10 : public TestCommandBridge { public: - Test_TC_MC_6_2() - : TestCommandBridge("Test_TC_MC_6_2") + Test_TC_MC_1_10() + : TestCommandBridge("Test_TC_MC_1_10") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20625,7 +21676,7 @@ class Test_TC_MC_6_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_2() {} + ~Test_TC_MC_1_10() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20633,11 +21684,11 @@ class Test_TC_MC_6_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_10\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_10\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20654,36 +21705,16 @@ class Test_TC_MC_6_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); - err = TestLogACommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); - err = TestLogACommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : log a command\n"); - err = TestLogACommand_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); - err = TestLogACommand_8(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; } @@ -20700,7 +21731,7 @@ class Test_TC_MC_6_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20713,32 +21744,22 @@ class Test_TC_MC_6_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_1() - { - UserPrompt(@"Verify that media is paused"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestLogACommand_2() - { - UserPrompt(@"Physically verify that the media is playing"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsTheCurrentStateAttribute_3() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentState attribute Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); } NextTest(); @@ -20747,41 +21768,51 @@ class Test_TC_MC_6_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_4() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() { - UserPrompt(@"Physically verify that the media is started over"); - return CHIP_NO_ERROR; - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestLogACommand_5() - { - UserPrompt(@"Verify that the next media item in the queue has been loaded"); - return CHIP_NO_ERROR; - } + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - CHIP_ERROR TestLogACommand_6() - { - UserPrompt(@"Verify that the previous media item in the queue has been loaded"); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; - CHIP_ERROR TestLogACommand_7() - { - UserPrompt(@"Verify that the media has skipped forward 10 seconds"); return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_8() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - UserPrompt(@"Verify that the media has skipped backward 10 seconds"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + return CHIP_NO_ERROR; } }; -class Test_TC_MC_6_3 : public TestCommandBridge { +class Test_TC_MC_1_11 : public TestCommandBridge { public: - Test_TC_MC_6_3() - : TestCommandBridge("Test_TC_MC_6_3") + Test_TC_MC_1_11() + : TestCommandBridge("Test_TC_MC_1_11") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20790,7 +21821,7 @@ class Test_TC_MC_6_3 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_3() {} + ~Test_TC_MC_1_11() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20798,11 +21829,11 @@ class Test_TC_MC_6_3 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_11\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_11\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20819,16 +21850,16 @@ class Test_TC_MC_6_3 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); - err = TestLogACommand_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; } @@ -20858,29 +21889,69 @@ class Test_TC_MC_6_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { - UserPrompt(@"Verify that media is paused"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestContentLauncher * cluster = [[CHIPTestContentLauncher alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_2() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() { - UserPrompt(@"Verify that the media has moved to 10 seconds from the starting point."); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestContentLauncher * cluster = [[CHIPTestContentLauncher alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - UserPrompt(@"User prompt needed to enter the value beyond the furthest valid position"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestContentLauncher * cluster = [[CHIPTestContentLauncher alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + return CHIP_NO_ERROR; } }; -class Test_TC_MC_6_4 : public TestCommandBridge { +class Test_TC_MC_1_12 : public TestCommandBridge { public: - Test_TC_MC_6_4() - : TestCommandBridge("Test_TC_MC_6_4") + Test_TC_MC_1_12() + : TestCommandBridge("Test_TC_MC_1_12") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -20889,7 +21960,7 @@ class Test_TC_MC_6_4 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_4() {} + ~Test_TC_MC_1_12() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -20897,11 +21968,11 @@ class Test_TC_MC_6_4 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_12\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_12\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -20918,40 +21989,16 @@ class Test_TC_MC_6_4 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the PlaybackSpeed attribute from the DUT\n"); - err = TestReadsThePlaybackSpeedAttributeFromTheDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); - err = TestLogACommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); - err = TestLogACommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); - err = TestLogACommand_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : log a command\n"); - err = TestLogACommand_9(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; } @@ -20968,7 +22015,7 @@ class Test_TC_MC_6_4 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -20981,26 +22028,20 @@ class Test_TC_MC_6_4 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_1() - { - UserPrompt(@"Verify that media is paused"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_2() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestAccountLogin * cluster = [[CHIPTestAccountLogin alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributePlaybackSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the PlaybackSpeed attribute from the DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("PlaybackSpeed", actualValue, 0.0f)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); } NextTest(); @@ -21009,85 +22050,47 @@ class Test_TC_MC_6_4 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_3() - { - UserPrompt(@"Verify that the media is playing"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsTheCurrentStateAttribute_4() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestAccountLogin * cluster = [[CHIPTestAccountLogin alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentState attribute Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_5() - { - UserPrompt(@"Verify that the media play speed has increased"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestLogACommand_6() - { - UserPrompt(@"Verify that the media play has reversed direction"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsTheCurrentStateAttribute_7() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestAccountLogin * cluster = [[CHIPTestAccountLogin alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentState attribute Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - - CHIP_ERROR TestLogACommand_8() - { - UserPrompt(@"Verify that the media play has reversed direction"); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestLogACommand_9() - { - UserPrompt(@"Verify that the media is has resumed playing forward at the default speed"); - return CHIP_NO_ERROR; - } }; -class Test_TC_MC_7_1 : public TestCommandBridge { +class Test_TC_MC_2_1 : public TestCommandBridge { public: - Test_TC_MC_7_1() - : TestCommandBridge("Test_TC_MC_7_1") + Test_TC_MC_2_1() + : TestCommandBridge("Test_TC_MC_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -21096,7 +22099,7 @@ class Test_TC_MC_7_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_7_1() {} + ~Test_TC_MC_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -21104,11 +22107,11 @@ class Test_TC_MC_7_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -21124,6 +22127,10 @@ class Test_TC_MC_7_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Put the device into low power mode\n"); + err = TestPutTheDeviceIntoLowPowerMode_1(); + break; } if (CHIP_NO_ERROR != err) { @@ -21139,7 +22146,7 @@ class Test_TC_MC_7_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 2; chip::Optional mNodeId; chip::Optional mCluster; @@ -21151,12 +22158,29 @@ class Test_TC_MC_7_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + + CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster sleepWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Put the device into low power mode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_7_2 : public TestCommandBridge { +class Test_TC_MC_3_1 : public TestCommandBridge { public: - Test_TC_MC_7_2() - : TestCommandBridge("Test_TC_MC_7_2") + Test_TC_MC_3_1() + : TestCommandBridge("Test_TC_MC_3_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -21165,7 +22189,7 @@ class Test_TC_MC_7_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_7_2() {} + ~Test_TC_MC_3_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -21173,11 +22197,11 @@ class Test_TC_MC_7_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -21222,11 +22246,11 @@ class Test_TC_MC_7_2 : public TestCommandBridge { } }; -class Test_TC_MC_8_1 : public TestCommandBridge { +class Test_TC_MC_3_2 : public TestCommandBridge { public: - Test_TC_MC_8_1() - : TestCommandBridge("Test_TC_MC_8_1") - , mTestIndex(0) + Test_TC_MC_3_2() + : TestCommandBridge("Test_TC_MC_3_2") + , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -21234,7 +22258,7 @@ class Test_TC_MC_8_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_8_1() {} + ~Test_TC_MC_3_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -21242,11 +22266,11 @@ class Test_TC_MC_8_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -21262,14 +22286,6 @@ class Test_TC_MC_8_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the CurrentTarget attribute\n"); - err = TestReadsTheCurrentTargetAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the TargetList attribute\n"); - err = TestReadsTheTargetListAttribute_2(); - break; } if (CHIP_NO_ERROR != err) { @@ -21285,7 +22301,7 @@ class Test_TC_MC_8_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 1; chip::Optional mNodeId; chip::Optional mCluster; @@ -21297,48 +22313,12 @@ class Test_TC_MC_8_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - - CHIP_ERROR TestReadsTheCurrentTargetAttribute_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentTargetWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the CurrentTarget attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("currentTarget", "", "uint8")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsTheTargetListAttribute_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeTargetListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the TargetList attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("targetList", "", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } }; -class Test_TC_MC_9_1 : public TestCommandBridge { +class Test_TC_MC_3_3 : public TestCommandBridge { public: - Test_TC_MC_9_1() - : TestCommandBridge("Test_TC_MC_9_1") + Test_TC_MC_3_3() + : TestCommandBridge("Test_TC_MC_3_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -21347,7 +22327,7 @@ class Test_TC_MC_9_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_9_1() {} + ~Test_TC_MC_3_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -21355,11 +22335,11 @@ class Test_TC_MC_9_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -21375,34 +22355,6 @@ class Test_TC_MC_9_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition\n"); - err = TestPrecondition_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the VendorName attribute\n"); - err = TestReadsTheVendorNameAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the VendorID attribute\n"); - err = TestReadsTheVendorIDAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the ApplicationName attribute\n"); - err = TestReadsTheApplicationNameAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the ProductID attribute\n"); - err = TestReadsTheProductIDAttribute_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the Status attribute\n"); - err = TestReadsTheStatusAttribute_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the ApplicationVersion attribute\n"); - err = TestReadsTheApplicationVersionAttribute_7(); - break; } if (CHIP_NO_ERROR != err) { @@ -21418,7 +22370,7 @@ class Test_TC_MC_9_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 1; chip::Optional mNodeId; chip::Optional mCluster; @@ -21430,145 +22382,150 @@ class Test_TC_MC_9_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestPrecondition_1() +class Test_TC_MC_3_4 : public TestCommandBridge { +public: + Test_TC_MC_3_4() + : TestCommandBridge("Test_TC_MC_3_4") + , mTestIndex(0) { - Log(@"DUT has one or more Content Apps available"); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestReadsTheVendorNameAttribute_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeVendorNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the VendorName attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("vendorName", [value length], 32)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_4() {} - CHIP_ERROR TestReadsTheVendorIDAttribute_3() + /////////// TestCommand Interface ///////// + void NextTest() override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + CHIP_ERROR err = CHIP_NO_ERROR; - [cluster readAttributeVendorIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the VendorID attribute Error: %@", err); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - VerifyOrReturn(CheckConstraintType("vendorID", "", "vendor-id")); - NextTest(); - }]; + Wait(); - return CHIP_NO_ERROR; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsTheApplicationNameAttribute_4() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeApplicationNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ApplicationName attribute Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - VerifyOrReturn(CheckConstraintType("applicationName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("applicationName", [value length], 256)); - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsTheProductIDAttribute_5() +class Test_TC_MC_3_5 : public TestCommandBridge { +public: + Test_TC_MC_3_5() + : TestCommandBridge("Test_TC_MC_3_5") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeProductIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ProductID attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); - NextTest(); - }]; - - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestReadsTheStatusAttribute_6() + ~Test_TC_MC_3_5() {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + CHIP_ERROR err = CHIP_NO_ERROR; - [cluster readAttributeStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the Status attribute Error: %@", err); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("Status", actualValue, 0)); - } + Wait(); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsTheApplicationVersionAttribute_7() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeApplicationVersionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the ApplicationVersion attribute Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - VerifyOrReturn(CheckConstraintType("applicationVersion", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("applicationVersion", [value length], 32)); - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } }; -class Test_TC_OCC_1_1 : public TestCommandBridge { +class Test_TC_MC_3_6 : public TestCommandBridge { public: - Test_TC_OCC_1_1() - : TestCommandBridge("Test_TC_OCC_1_1") + Test_TC_MC_3_6() + : TestCommandBridge("Test_TC_MC_3_6") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -21577,7 +22534,7 @@ class Test_TC_OCC_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_OCC_1_1() {} + ~Test_TC_MC_3_6() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -21585,11 +22542,11 @@ class Test_TC_OCC_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -21605,19 +22562,6 @@ class Test_TC_OCC_1_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); - break; } if (CHIP_NO_ERROR != err) { @@ -21633,7 +22577,7 @@ class Test_TC_OCC_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 1; chip::Optional mNodeId; chip::Optional mCluster; @@ -21645,75 +22589,81 @@ class Test_TC_OCC_1_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() +class Test_TC_MC_3_7 : public TestCommandBridge { +public: + Test_TC_MC_3_7() + : TestCommandBridge("Test_TC_MC_3_7") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - VerifyOrReturn(CheckValue("status", err, 0)); + ~Test_TC_MC_3_7() {} - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - }]; + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - return CHIP_NO_ERROR; - } + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + Wait(); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } }; -class Test_TC_OCC_2_1 : public TestCommandBridge { +class Test_TC_MC_3_8 : public TestCommandBridge { public: - Test_TC_OCC_2_1() - : TestCommandBridge("Test_TC_OCC_2_1") + Test_TC_MC_3_8() + : TestCommandBridge("Test_TC_MC_3_8") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -21722,7 +22672,7 @@ class Test_TC_OCC_2_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_OCC_2_1() {} + ~Test_TC_MC_3_8() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -21730,11 +22680,11 @@ class Test_TC_OCC_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -21750,45 +22700,6 @@ class Test_TC_OCC_2_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads mandatory attribute constrains: Occupancy\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancy_1(); - break; - case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : Writes the respective default value to mandatory attribute: Occupancy\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back mandatory attribute: Occupancy\n"); - err = TestReadsBackMandatoryAttributeOccupancy_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads mandatory attribute constrains: OccupancySensorType\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_4(); - break; - case 5: - ChipLogProgress( - chipTool, " ***** Test Step 5 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back mandatory attribute: OccupancySensorType\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorType_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_7(); - break; - case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_9(); - break; } if (CHIP_NO_ERROR != err) { @@ -21804,7 +22715,7 @@ class Test_TC_OCC_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; + const uint16_t mTestCount = 1; chip::Optional mNodeId; chip::Optional mCluster; @@ -21816,234 +22727,219 @@ class Test_TC_OCC_2_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_1() +class Test_TC_MC_3_9 : public TestCommandBridge { +public: + Test_TC_MC_3_9() + : TestCommandBridge("Test_TC_MC_3_9") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attribute constrains: Occupancy Error: %@", err); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - VerifyOrReturn(CheckValue("status", err, 0)); + ~Test_TC_MC_3_9() {} - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupancy", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupancy", [value unsignedCharValue], 1)); - } + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - NextTest(); - }]; + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); + } - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - id occupancyArgument; - occupancyArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeOccupancyWithValue:occupancyArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attribute: Occupancy Error: %@", err); + Wait(); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_3() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: Occupancy Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupancy", actualValue, 0)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_4() +class Test_TC_MC_3_10 : public TestCommandBridge { +public: + Test_TC_MC_3_10() + : TestCommandBridge("Test_TC_MC_3_10") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupancySensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorType Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupancySensorType", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", [value unsignedCharValue], 3)); - } + ~Test_TC_MC_3_10() {} - NextTest(); - }]; + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - return CHIP_NO_ERROR; - } + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_5() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - id occupancySensorTypeArgument; - occupancySensorTypeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeOccupancySensorTypeWithValue:occupancySensorTypeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attribute: " - @"OccupancySensorType Error: %@", - err); + Wait(); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_6() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupancySensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: OccupancySensorType Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupancy sensor type", actualValue, 0)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_7() +class Test_TC_MC_3_11 : public TestCommandBridge { +public: + Test_TC_MC_3_11() + : TestCommandBridge("Test_TC_MC_3_11") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster - readAttributeOccupancySensorTypeBitmapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", [value unsignedCharValue], 1)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", [value unsignedCharValue], 7)); - } + ~Test_TC_MC_3_11() {} - NextTest(); - }]; + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - return CHIP_NO_ERROR; - } + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); + } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_8() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - id occupancySensorTypeBitmapArgument; - occupancySensorTypeBitmapArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeOccupancySensorTypeBitmapWithValue:occupancySensorTypeBitmapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attribute: " - @"OccupancySensorTypeBitmap Error: %@", - err); + Wait(); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_9() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster - readAttributeOccupancySensorTypeBitmapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: OccupancySensorTypeBitmap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupancy sensor type bitmap", actualValue, 1)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } }; -class Test_TC_OCC_2_2 : public TestCommandBridge { +class Test_TC_MC_5_1 : public TestCommandBridge { public: - Test_TC_OCC_2_2() - : TestCommandBridge("Test_TC_OCC_2_2") + Test_TC_MC_5_1() + : TestCommandBridge("Test_TC_MC_5_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -22052,7 +22948,7 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_OCC_2_2() {} + ~Test_TC_MC_5_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -22060,11 +22956,11 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -22081,20 +22977,8 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Occupancy attribute from DUT\n"); - if (ShouldSkip("A_OCCUPANCY")) { - NextTest(); - return; - } - err = TestReadsOccupancyAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back Occupancy attribute from DUT after few seconds\n"); - if (ShouldSkip("A_OCCUPANCY")) { - NextTest(); - return; - } - err = TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the ChannelList attribute from the DUT\n"); + err = TestReadsTheChannelListAttributeFromTheDut_1(); break; } @@ -22111,7 +22995,7 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 2; chip::Optional mNodeId; chip::Optional mCluster; @@ -22123,48 +23007,19 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - NSNumber * _Nonnull OccupancyValue; - - CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupancy", actualValue, 0)); - } - { - OccupancyValue = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - CHIP_ERROR TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2() + CHIP_ERROR TestReadsTheChannelListAttributeFromTheDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestChannel * cluster = [[CHIPTestChannel alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back Occupancy attribute from DUT after few seconds Error: %@", err); + [cluster readAttributeChannelListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ChannelList attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("channelList", "", "list")); NextTest(); }]; @@ -22172,10 +23027,10 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { } }; -class Test_TC_OO_1_1 : public TestCommandBridge { +class Test_TC_MC_5_2 : public TestCommandBridge { public: - Test_TC_OO_1_1() - : TestCommandBridge("Test_TC_OO_1_1") + Test_TC_MC_5_2() + : TestCommandBridge("Test_TC_MC_5_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -22184,7 +23039,7 @@ class Test_TC_OO_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_OO_1_1() {} + ~Test_TC_MC_5_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -22192,11 +23047,11 @@ class Test_TC_OO_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -22213,41 +23068,8 @@ class Test_TC_OO_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the optional global attribute : FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); break; } @@ -22264,7 +23086,7 @@ class Test_TC_OO_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; + const uint16_t mTestCount = 2; chip::Optional mNodeId; chip::Optional mCluster; @@ -22277,180 +23099,206 @@ class Test_TC_OO_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestLogACommand_1() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + UserPrompt(@"verify that the channel has changed on the device."); + return CHIP_NO_ERROR; + } +}; - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); +class Test_TC_MC_5_3 : public TestCommandBridge { +public: + Test_TC_MC_5_3() + : TestCommandBridge("Test_TC_MC_5_3") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - VerifyOrReturn(CheckValue("status", err, 0)); + ~Test_TC_MC_5_3() {} - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); - } + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - NextTest(); - }]; + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_3\n"); + } - return CHIP_NO_ERROR; + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 2; - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() + CHIP_ERROR TestLogACommand_1() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + UserPrompt(@"verify that the channel has changed on the device"); + return CHIP_NO_ERROR; + } +}; - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; +class Test_TC_MC_6_1 : public TestCommandBridge { +public: + Test_TC_MC_6_1() + : TestCommandBridge("Test_TC_MC_6_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() + ~Test_TC_MC_6_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + CHIP_ERROR err = CHIP_NO_ERROR; - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_1\n"); + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); - } + Wait(); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the playback state attribute\n"); + err = TestReadsThePlaybackStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); + err = TestLogACommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 1UL)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 6; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() + CHIP_ERROR TestLogACommand_1() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional global attribute : FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); - NextTest(); - }]; - + UserPrompt(@"Verify that media is paused"); return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() + CHIP_ERROR TestLogACommand_2() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id featureMapArgument; - featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeFeatureMapWithValue:featureMapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - + UserPrompt(@"Physically verify that the media is playing"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() + CHIP_ERROR TestReadsThePlaybackStateAttribute_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the playback state attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 1UL)); + VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); } NextTest(); @@ -22458,12 +23306,24 @@ class Test_TC_OO_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestLogACommand_4() + { + UserPrompt(@"Physically verify that the media is paused"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestLogACommand_5() + { + UserPrompt(@"Physically verify that the media is stoped"); + return CHIP_NO_ERROR; + } }; -class Test_TC_OO_2_1 : public TestCommandBridge { +class Test_TC_MC_6_2 : public TestCommandBridge { public: - Test_TC_OO_2_1() - : TestCommandBridge("Test_TC_OO_2_1") + Test_TC_MC_6_2() + : TestCommandBridge("Test_TC_MC_6_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -22472,7 +23332,7 @@ class Test_TC_OO_2_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_OO_2_1() {} + ~Test_TC_MC_6_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -22480,11 +23340,11 @@ class Test_TC_OO_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -22501,24 +23361,36 @@ class Test_TC_OO_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: OnOff\n"); - err = TestReadTheMandatoryAttributeOnOff_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read LT attribute: GlobalSceneControl\n"); - err = TestReadLtAttributeGlobalSceneControl_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read LT attribute: OnTime\n"); - err = TestReadLtAttributeOnTime_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read LT attribute: OffWaitTime\n"); - err = TestReadLtAttributeOffWaitTime_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); + err = TestLogACommand_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read LT attribute: StartUpOnOff\n"); - err = TestReadLtAttributeStartUpOnOff_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); + err = TestLogACommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : log a command\n"); + err = TestLogACommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); + err = TestLogACommand_8(); break; } @@ -22535,7 +23407,7 @@ class Test_TC_OO_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 9; chip::Optional mNodeId; chip::Optional mCluster; @@ -22548,101 +23420,174 @@ class Test_TC_OO_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeOnOff_1() + CHIP_ERROR TestLogACommand_1() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("onOff", "", "bool")); - NextTest(); - }]; + UserPrompt(@"Verify that media is paused"); + return CHIP_NO_ERROR; + } + CHIP_ERROR TestLogACommand_2() + { + UserPrompt(@"Physically verify that the media is playing"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() + CHIP_ERROR TestReadsTheCurrentStateAttribute_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); + [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentState attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("globalSceneControl", "", "bool")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadLtAttributeOnTime_3() + CHIP_ERROR TestLogACommand_4() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + UserPrompt(@"Physically verify that the media is started over"); + return CHIP_NO_ERROR; + } - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: OnTime Error: %@", err); + CHIP_ERROR TestLogACommand_5() + { + UserPrompt(@"Verify that the next media item in the queue has been loaded"); + return CHIP_NO_ERROR; + } - VerifyOrReturn(CheckValue("status", err, 0)); + CHIP_ERROR TestLogACommand_6() + { + UserPrompt(@"Verify that the previous media item in the queue has been loaded"); + return CHIP_NO_ERROR; + } - VerifyOrReturn(CheckConstraintType("onTime", "", "uint16")); - NextTest(); - }]; + CHIP_ERROR TestLogACommand_7() + { + UserPrompt(@"Verify that the media has skipped forward 10 seconds"); + return CHIP_NO_ERROR; + } + CHIP_ERROR TestLogACommand_8() + { + UserPrompt(@"Verify that the media has skipped backward 10 seconds"); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadLtAttributeOffWaitTime_4() +class Test_TC_MC_6_3 : public TestCommandBridge { +public: + Test_TC_MC_6_3() + : TestCommandBridge("Test_TC_MC_6_3") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: OffWaitTime Error: %@", err); + ~Test_TC_MC_6_3() {} - VerifyOrReturn(CheckValue("status", err, 0)); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturn(CheckConstraintType("offWaitTime", "", "uint16")); - NextTest(); - }]; + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_3\n"); + } - return CHIP_NO_ERROR; + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); + err = TestLogACommand_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - [cluster readAttributeStartUpOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; - VerifyOrReturn(CheckValue("status", err, 0)); + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - VerifyOrReturn(CheckConstraintType("startUpOnOff", "", "enum8")); - NextTest(); - }]; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestLogACommand_1() + { + UserPrompt(@"Verify that media is paused"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestLogACommand_2() + { + UserPrompt(@"Verify that the media has moved to 10 seconds from the starting point."); + return CHIP_NO_ERROR; + } + CHIP_ERROR TestLogACommand_3() + { + UserPrompt(@"User prompt needed to enter the value beyond the furthest valid position"); return CHIP_NO_ERROR; } }; -class Test_TC_OO_2_2 : public TestCommandBridge { +class Test_TC_MC_6_4 : public TestCommandBridge { public: - Test_TC_OO_2_2() - : TestCommandBridge("Test_TC_OO_2_2") + Test_TC_MC_6_4() + : TestCommandBridge("Test_TC_MC_6_4") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -22651,7 +23596,7 @@ class Test_TC_OO_2_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_OO_2_2() {} + ~Test_TC_MC_6_4() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -22659,11 +23604,11 @@ class Test_TC_OO_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_4\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_4\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -22680,84 +23625,40 @@ class Test_TC_OO_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Off Command\n"); - err = TestSendOffCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the PlaybackSpeed attribute from the DUT\n"); + err = TestReadsThePlaybackSpeedAttributeFromTheDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Send On Command\n"); - err = TestSendOnCommand_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); + err = TestLogACommand_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Send On Command\n"); - err = TestSendOnCommand_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); + err = TestLogACommand_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Send Off Command\n"); - err = TestSendOffCommand_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); + err = TestLogACommand_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Send Off Command\n"); - err = TestSendOffCommand_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Send Toggle Command\n"); - err = TestSendToggleCommand_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); - err = TestWait1000ms_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is true after toggle command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Send Toggle Command\n"); - err = TestSendToggleCommand_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 1000ms\n"); - err = TestWait1000ms_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Check on/off attribute value is false after toggle command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : User prompt Set OnOff attribute manually to on\n"); - err = TestUserPromptSetOnOffAttributeManuallyToOn_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : User prompt Set OnOff attribute manually to off\n"); - err = TestUserPromptSetOnOffAttributeManuallyToOff_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Reset Off Command\n"); - err = TestResetOffCommand_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20(); + ChipLogProgress(chipTool, " ***** Test Step 9 : log a command\n"); + err = TestLogACommand_9(); break; } @@ -22774,7 +23675,7 @@ class Test_TC_OO_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; + const uint16_t mTestCount = 10; chip::Optional mNodeId; chip::Optional mCluster; @@ -22787,76 +23688,54 @@ class Test_TC_OO_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOffCommand_1() + CHIP_ERROR TestLogACommand_1() + { + UserPrompt(@"Verify that media is paused"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); + [cluster readAttributePlaybackSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the PlaybackSpeed attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("PlaybackSpeed", actualValue, 0.0f)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_2() + CHIP_ERROR TestLogACommand_3() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestSendOnCommand_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - + UserPrompt(@"Verify that the media is playing"); return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_4() + CHIP_ERROR TestReadsTheCurrentStateAttribute_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); + [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentState attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); } NextTest(); @@ -22865,37 +23744,32 @@ class Test_TC_OO_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOnCommand_5() + CHIP_ERROR TestLogACommand_5() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; + UserPrompt(@"Verify that the media play speed has increased"); + return CHIP_NO_ERROR; + } + CHIP_ERROR TestLogACommand_6() + { + UserPrompt(@"Verify that the media play has reversed direction"); return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_6() + CHIP_ERROR TestReadsTheCurrentStateAttribute_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after on command Error: %@", err); + [cluster readAttributeCurrentStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentState attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + VerifyOrReturn(CheckValue("CurrentState", actualValue, 0)); } NextTest(); @@ -22904,219 +23778,263 @@ class Test_TC_OO_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOffCommand_7() + CHIP_ERROR TestLogACommand_8() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - + UserPrompt(@"Verify that the media play has reversed direction"); return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8() + CHIP_ERROR TestLogACommand_9() { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } - - NextTest(); - }]; - + UserPrompt(@"Verify that the media is has resumed playing forward at the default speed"); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestSendOffCommand_9() +class Test_TC_MC_7_1 : public TestCommandBridge { +public: + Test_TC_MC_7_1() + : TestCommandBridge("Test_TC_MC_7_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10() + ~Test_TC_MC_7_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + CHIP_ERROR err = CHIP_NO_ERROR; - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_1\n"); + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } + Wait(); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestSendToggleCommand_11() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster toggleWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Toggle Command Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestWait1000ms_12() +class Test_TC_MC_7_2 : public TestCommandBridge { +public: + Test_TC_MC_7_2() + : TestCommandBridge("Test_TC_MC_7_2") + , mTestIndex(0) { - WaitForMs(1000); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_13() + ~Test_TC_MC_7_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + CHIP_ERROR err = CHIP_NO_ERROR; - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_2\n"); + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); - } + Wait(); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestSendToggleCommand_14() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster toggleWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Toggle Command Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestWait1000ms_15() +class Test_TC_MC_8_1 : public TestCommandBridge { +public: + Test_TC_MC_8_1() + : TestCommandBridge("Test_TC_MC_8_1") + , mTestIndex(0) { - WaitForMs(1000); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_16() + ~Test_TC_MC_8_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + CHIP_ERROR err = CHIP_NO_ERROR; - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after toggle command Error: %@", err); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_1\n"); + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } + Wait(); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the CurrentTarget attribute\n"); + err = TestReadsTheCurrentTargetAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the TargetList attribute\n"); + err = TestReadsTheTargetListAttribute_2(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestUserPromptSetOnOffAttributeManuallyToOn_17() + chip::System::Clock::Timeout GetWaitDuration() const override { - UserPrompt(@"Operate on device to set OnOff attribute manually to on"); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestUserPromptSetOnOffAttributeManuallyToOff_18() +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() { - UserPrompt(@"Operate on device to set OnOff attribute manually to off"); + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestResetOffCommand_19() + CHIP_ERROR TestReadsTheCurrentTargetAttribute_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset Off Command Error: %@", err); + [cluster readAttributeCurrentTargetWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentTarget attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("currentTarget", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20() + CHIP_ERROR TestReadsTheTargetListAttribute_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + [cluster readAttributeTargetListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the TargetList attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("targetList", "", "list")); NextTest(); }]; @@ -23124,10 +24042,10 @@ class Test_TC_OO_2_2 : public TestCommandBridge { } }; -class Test_TC_OO_2_3 : public TestCommandBridge { +class Test_TC_MC_9_1 : public TestCommandBridge { public: - Test_TC_OO_2_3() - : TestCommandBridge("Test_TC_OO_2_3") + Test_TC_MC_9_1() + : TestCommandBridge("Test_TC_MC_9_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -23136,7 +24054,7 @@ class Test_TC_OO_2_3 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_OO_2_3() {} + ~Test_TC_MC_9_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -23144,11 +24062,11 @@ class Test_TC_OO_2_3 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -23165,360 +24083,32 @@ class Test_TC_OO_2_3 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send On Command\n"); - if (ShouldSkip("CR_ON")) { - NextTest(); - return; - } - err = TestSendOnCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition\n"); + err = TestPrecondition_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); - err = TestWait1000ms_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the VendorName attribute\n"); + err = TestReadsTheVendorNameAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the VendorID attribute\n"); + err = TestReadsTheVendorIDAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads GlobalSceneControl attribute from DUT\n"); - if (ShouldSkip("A_GLOBALSCENECONTROL")) { - NextTest(); - return; - } - err = TestReadsGlobalSceneControlAttributeFromDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the ApplicationName attribute\n"); + err = TestReadsTheApplicationNameAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Send On Command\n"); - if (ShouldSkip("CR_ON")) { - NextTest(); - return; - } - err = TestSendOnCommand_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the ProductID attribute\n"); + err = TestReadsTheProductIDAttribute_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 1000ms\n"); - err = TestWait1000ms_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the Status attribute\n"); + err = TestReadsTheStatusAttribute_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads GlobalSceneControl attribute from DUT\n"); - if (ShouldSkip("A_GLOBALSCENECONTROL")) { - NextTest(); - return; - } - err = TestReadsGlobalSceneControlAttributeFromDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Send On Command\n"); - if (ShouldSkip("CR_ON")) { - NextTest(); - return; - } - err = TestSendOnCommand_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 1000ms\n"); - err = TestWait1000ms_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads GlobalSceneControl attribute from DUT\n"); - if (ShouldSkip("A_GLOBALSCENECONTROL")) { - NextTest(); - return; - } - err = TestReadsGlobalSceneControlAttributeFromDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Send On Command\n"); - if (ShouldSkip("CR_ON")) { - NextTest(); - return; - } - err = TestSendOnCommand_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) { - NextTest(); - return; - } - err = TestSendOffCommand_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Send On Command\n"); - if (ShouldSkip("CR_ON")) { - NextTest(); - return; - } - err = TestSendOnCommand_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) { - NextTest(); - return; - } - err = TestSendOffCommand_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Send On Command\n"); - if (ShouldSkip("CR_ON")) { - NextTest(); - return; - } - err = TestSendOnCommand_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) { - NextTest(); - return; - } - err = TestSendOffCommand_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) { - NextTest(); - return; - } - err = TestSendOffCommand_46(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the ApplicationVersion attribute\n"); + err = TestReadsTheApplicationVersionAttribute_7(); break; } @@ -23535,7 +24125,7 @@ class Test_TC_OO_2_3 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 47; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -23548,132 +24138,110 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOnCommand_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWait1000ms_2() + CHIP_ERROR TestPrecondition_1() { - WaitForMs(1000); + Log(@"DUT has one or more Content Apps available"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnOffAttributeFromDut_3() + CHIP_ERROR TestReadsTheVendorNameAttribute_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeVendorNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the VendorName attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); - } - + VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("vendorName", [value length], 32)); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_4() + CHIP_ERROR TestReadsTheVendorIDAttribute_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); + [cluster readAttributeVendorIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the VendorID attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("GlobalSceneControl", actualValue, 1)); - } - + VerifyOrReturn(CheckConstraintType("vendorID", "", "vendor-id")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOnCommand_5() + CHIP_ERROR TestReadsTheApplicationNameAttribute_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); + [cluster readAttributeApplicationNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ApplicationName attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("applicationName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("applicationName", [value length], 256)); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait1000ms_6() - { - WaitForMs(1000); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_7() + CHIP_ERROR TestReadsTheProductIDAttribute_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeProductIDWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ProductID attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); - } - + VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_8() + CHIP_ERROR TestReadsTheStatusAttribute_6() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); + [cluster readAttributeStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the Status attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("GlobalSceneControl", actualValue, 1)); + VerifyOrReturn(CheckValue("Status", actualValue, 0)); } NextTest(); @@ -23682,419 +24250,575 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOnCommand_9() + CHIP_ERROR TestReadsTheApplicationVersionAttribute_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); + [cluster readAttributeApplicationVersionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ApplicationVersion attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("applicationVersion", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("applicationVersion", [value length], 32)); NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestWait1000ms_10() +class Test_TC_MC_10_1 : public TestCommandBridge { +public: + Test_TC_MC_10_1() + : TestCommandBridge("Test_TC_MC_10_1") + , mTestIndex(0) { - WaitForMs(1000); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestReadsOnOffAttributeFromDut_11() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } + ~Test_TC_MC_10_1() {} - CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_12() + /////////// TestCommand Interface ///////// + void NextTest() override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + CHIP_ERROR err = CHIP_NO_ERROR; - [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_1\n"); + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("GlobalSceneControl", actualValue, 1)); - } + Wait(); - NextTest(); - }]; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the AcceptHeader attribute from the DUT\n"); + err = TestThReadsTheAcceptHeaderAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the SupportedStreamingProtocols attribute from the DUT\n"); + err = TestThReadsTheSupportedStreamingProtocolsAttributeFromTheDut_2(); + break; + } - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_13() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_14() + CHIP_ERROR TestThReadsTheAcceptHeaderAttributeFromTheDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestContentLauncher * cluster = [[CHIPTestContentLauncher alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); + [cluster readAttributeAcceptHeaderWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the AcceptHeader attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("acceptHeader", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOnCommand_15() + CHIP_ERROR TestThReadsTheSupportedStreamingProtocolsAttributeFromTheDut_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestContentLauncher * cluster = [[CHIPTestContentLauncher alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); + [cluster + readAttributeSupportedStreamingProtocolsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the SupportedStreamingProtocols attribute from the DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("supportedStreamingProtocols", "", "map32")); + NextTest(); + }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsOnOffAttributeFromDut_16() +class Test_TC_MOD_1_1 : public TestCommandBridge { +public: + Test_TC_MOD_1_1() + : TestCommandBridge("Test_TC_MOD_1_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - VerifyOrReturn(CheckValue("status", err, 0)); + ~Test_TC_MOD_1_1() {} - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); - } + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - NextTest(); - }]; + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_1_1\n"); + } - return CHIP_NO_ERROR; - } + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_17() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + Wait(); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); + err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the AttributeList attribute from the DUT\n"); + err = TestThReadsTheAttributeListAttributeFromTheDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + break; + } - VerifyOrReturn(CheckValue("status", err, 0)); + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - NextTest(); - }]; +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_18() + CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the ClusterRevision attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); } + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOffCommand_19() + CHIP_ERROR TestThReadsTheAttributeListAttributeFromTheDut_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the AttributeList attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnOffAttributeFromDut_20() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_21() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsOnOffAttributeFromDut_22() +class Test_TC_OCC_1_1 : public TestCommandBridge { +public: + Test_TC_OCC_1_1() + : TestCommandBridge("Test_TC_OCC_1_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + ~Test_TC_OCC_1_1() {} - VerifyOrReturn(CheckValue("status", err, 0)); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); + } - NextTest(); - }]; + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - return CHIP_NO_ERROR; - } + Wait(); - CHIP_ERROR TestReadsOnTimeAttributeFromDut_23() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + break; + case 2: + ChipLogProgress( + chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; + } - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } - VerifyOrReturn(CheckValue("status", err, 0)); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_24() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOnCommand_25() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog( + @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_26() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_27() +class Test_TC_OCC_2_1 : public TestCommandBridge { +public: + Test_TC_OCC_2_1() + : TestCommandBridge("Test_TC_OCC_2_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); + ~Test_TC_OCC_2_1() {} - VerifyOrReturn(CheckValue("status", err, 0)); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - { - id actualValue = value; - VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); - } + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); + } - NextTest(); - }]; + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - return CHIP_NO_ERROR; + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads mandatory attribute constrains: Occupancy\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancy_1(); + break; + case 2: + ChipLogProgress( + chipTool, " ***** Test Step 2 : Writes the respective default value to mandatory attribute: Occupancy\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back mandatory attribute: Occupancy\n"); + err = TestReadsBackMandatoryAttributeOccupancy_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads mandatory attribute constrains: OccupancySensorType\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back mandatory attribute: OccupancySensorType\n"); + err = TestReadsBackMandatoryAttributeOccupancySensorType_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_7(); + break; + case 8: + ChipLogProgress(chipTool, + " ***** Test Step 8 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); + err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_9(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestSendOffCommand_28() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValue("status", err, 0)); +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 10; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnOffAttributeFromDut_29() + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads mandatory attribute constrains: Occupancy Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupancy", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupancy", [value unsignedCharValue], 1)); } NextTest(); @@ -24103,42 +24827,43 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_30() + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } + id occupancyArgument; + occupancyArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeOccupancyWithValue:occupancyArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the respective default value to mandatory attribute: Occupancy Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnOffAttributeFromDut_31() + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads back mandatory attribute: Occupancy Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + VerifyOrReturn(CheckValue("occupancy", actualValue, 0)); } NextTest(); @@ -24147,20 +24872,25 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_32() + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + [cluster readAttributeOccupancySensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads mandatory attribute constrains: OccupancySensorType Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupancySensorType", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", [value unsignedCharValue], 3)); } NextTest(); @@ -24169,37 +24899,45 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOnCommand_33() + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send On Command Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id occupancySensorTypeArgument; + occupancySensorTypeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeOccupancySensorTypeWithValue:occupancySensorTypeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the respective default value to mandatory attribute: " + @"OccupancySensorType Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnOffAttributeFromDut_34() + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_6() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeOccupancySensorTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads back mandatory attribute: OccupancySensorType Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + VerifyOrReturn(CheckValue("occupancy sensor type", actualValue, 0)); } NextTest(); @@ -24208,81 +24946,187 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_35() + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + [cluster + readAttributeOccupancySensorTypeBitmapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } + VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", [value unsignedCharValue], 1)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", [value unsignedCharValue], 7)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_36() + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); + id occupancySensorTypeBitmapArgument; + occupancySensorTypeBitmapArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeOccupancySensorTypeBitmapWithValue:occupancySensorTypeBitmapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the respective default value to mandatory attribute: " + @"OccupancySensorTypeBitmap Error: %@", + err); - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); - } - - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOffCommand_37() + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); + [cluster + readAttributeOccupancySensorTypeBitmapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads back mandatory attribute: OccupancySensorTypeBitmap Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("occupancy sensor type bitmap", actualValue, 1)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsOnOffAttributeFromDut_38() +class Test_TC_OCC_2_2 : public TestCommandBridge { +public: + Test_TC_OCC_2_2() + : TestCommandBridge("Test_TC_OCC_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_OCC_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Occupancy attribute from DUT\n"); + if (ShouldSkip("A_OCCUPANCY")) { + NextTest(); + return; + } + err = TestReadsOccupancyAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back Occupancy attribute from DUT after few seconds\n"); + if (ShouldSkip("A_OCCUPANCY")) { + NextTest(); + return; + } + err = TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull OccupancyValue; + + CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + VerifyOrReturn(CheckValue("occupancy", actualValue, 0)); + } + { + OccupancyValue = value; } NextTest(); @@ -24291,42 +25135,145 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_39() + CHIP_ERROR TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads back Occupancy attribute from DUT after few seconds Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } - NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsOnOffAttributeFromDut_40() +class Test_TC_OO_1_1 : public TestCommandBridge { +public: + Test_TC_OO_1_1() + : TestCommandBridge("Test_TC_OO_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_OO_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the optional global attribute : FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 10; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); } NextTest(); @@ -24335,42 +25282,59 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_41() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_42() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog( + @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); } NextTest(); @@ -24379,42 +25343,38 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnOffAttributeFromDut_43() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnOff attribute from DUT Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOnTimeAttributeFromDut_44() + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OnTime attribute from DUT Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 1UL)); } NextTest(); @@ -24423,39 +25383,59 @@ class Test_TC_OO_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_45() + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional global attribute : FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSendOffCommand_46() + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Send Off Command Error: %@", err); + id featureMapArgument; + featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 1UL)); + } + NextTest(); }]; @@ -24463,10 +25443,10 @@ class Test_TC_OO_2_3 : public TestCommandBridge { } }; -class Test_TC_PS_1_1 : public TestCommandBridge { +class Test_TC_OO_2_1 : public TestCommandBridge { public: - Test_TC_PS_1_1() - : TestCommandBridge("Test_TC_PS_1_1") + Test_TC_OO_2_1() + : TestCommandBridge("Test_TC_OO_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -24475,7 +25455,7 @@ class Test_TC_PS_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_PS_1_1() {} + ~Test_TC_OO_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -24483,11 +25463,11 @@ class Test_TC_PS_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PS_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PS_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -24504,20 +25484,24 @@ class Test_TC_PS_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: OnOff\n"); + err = TestReadTheMandatoryAttributeOnOff_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : read LT attribute: GlobalSceneControl\n"); + err = TestReadLtAttributeGlobalSceneControl_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : read LT attribute: OnTime\n"); + err = TestReadLtAttributeOnTime_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : read LT attribute: OffWaitTime\n"); + err = TestReadLtAttributeOffWaitTime_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read LT attribute: StartUpOnOff\n"); + err = TestReadLtAttributeStartUpOnOff_5(); break; } @@ -24534,7 +25518,7 @@ class Test_TC_PS_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 6; chip::Optional mNodeId; chip::Optional mCluster; @@ -24547,76 +25531,90 @@ class Test_TC_PS_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestReadTheMandatoryAttributeOnOff_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: OnOff Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } + VerifyOrReturn(CheckConstraintType("onOff", "", "bool")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("globalSceneControl", "", "bool")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + CHIP_ERROR TestReadLtAttributeOnTime_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read LT attribute: OnTime Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("onTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + CHIP_ERROR TestReadLtAttributeOffWaitTime_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read LT attribute: OffWaitTime Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + VerifyOrReturn(CheckConstraintType("offWaitTime", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + [cluster readAttributeStartUpOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + VerifyOrReturn(CheckConstraintType("startUpOnOff", "", "enum8")); NextTest(); }]; @@ -24624,10 +25622,10 @@ class Test_TC_PS_1_1 : public TestCommandBridge { } }; -class Test_TC_PRS_1_1 : public TestCommandBridge { +class Test_TC_OO_2_2 : public TestCommandBridge { public: - Test_TC_PRS_1_1() - : TestCommandBridge("Test_TC_PRS_1_1") + Test_TC_OO_2_2() + : TestCommandBridge("Test_TC_OO_2_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -24636,7 +25634,7 @@ class Test_TC_PRS_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_PRS_1_1() {} + ~Test_TC_OO_2_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -24644,11 +25642,11 @@ class Test_TC_PRS_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -24665,272 +25663,261 @@ class Test_TC_PRS_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Send Off Command\n"); + err = TestSendOffCommand_1(); break; case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : Write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute constraints: AttributeList\n"); - err = TestReadTheGlobalAttributeConstraintsAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Send On Command\n"); + err = TestSendOnCommand_3(); break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Send On Command\n"); + err = TestSendOnCommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Send Off Command\n"); + err = TestSendOffCommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Send Off Command\n"); + err = TestSendOffCommand_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Send Toggle Command\n"); + err = TestSendToggleCommand_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); + err = TestWait1000ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is true after toggle command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Send Toggle Command\n"); + err = TestSendToggleCommand_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 1000ms\n"); + err = TestWait1000ms_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Check on/off attribute value is false after toggle command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : User prompt Set OnOff attribute manually to on\n"); + err = TestUserPromptSetOnOffAttributeManuallyToOn_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : User prompt Set OnOff attribute manually to off\n"); + err = TestUserPromptSetOnOffAttributeManuallyToOff_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Reset Off Command\n"); + err = TestResetOffCommand_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 21; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestSendOffCommand_1() + { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Off Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"Write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsAttributeList_3() + CHIP_ERROR TestSendOnCommand_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: AttributeList Error: %@", err); + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } -}; - -class Test_TC_PRS_2_1 : public TestCommandBridge { -public: - Test_TC_PRS_2_1() - : TestCommandBridge("Test_TC_PRS_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PRS_2_1() {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_4() { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_2_1\n"); - } + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is true after on command Error: %@", err); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - Wait(); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the mandatory attribute constraints: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeConstraintsMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Write the default values to mandatory attribute: MeasuredValue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back mandatory attribute: MeasuredValue\n"); - err = TestReadsBackMandatoryAttributeMeasuredValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute constraints: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write the default values to mandatory attribute: MinMeasuredValue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back mandatory attribute: MinMeasuredValue\n"); - err = TestReadsBackMandatoryAttributeMinMeasuredValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the mandatory attribute constraints: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Write the default values to mandatory attribute: MaxMeasuredValue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads back mandatory attribute: MaxMeasuredValue\n"); - err = TestReadsBackMandatoryAttributeMaxMeasuredValue_9(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestSendOnCommand_5() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMeasuredValue_1() + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_6() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute constraints: MeasuredValue Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is true after on command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_2() + CHIP_ERROR TestSendOffCommand_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id measuredValueArgument; - measuredValueArgument = [NSNumber numberWithShort:0]; - [cluster writeAttributeMeasuredValueWithValue:measuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: MeasuredValue Error: %@", err); + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Off Command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsBackMandatoryAttributeMeasuredValue_3() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: MeasuredValue Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueNonNull("MeasuredValue", actualValue)); - VerifyOrReturn(CheckValue("MeasuredValue", actualValue, 0)); + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); } NextTest(); @@ -24939,65 +25926,82 @@ class Test_TC_PRS_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_4() + CHIP_ERROR TestSendOffCommand_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute constraints: MinMeasuredValue Error: %@", err); + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Off Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_5() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minMeasuredValueArgument; - minMeasuredValueArgument = [NSNumber numberWithShort:0]; - [cluster - writeAttributeMinMeasuredValueWithValue:minMeasuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: MinMeasuredValue Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsBackMandatoryAttributeMinMeasuredValue_6() + CHIP_ERROR TestSendToggleCommand_11() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: MinMeasuredValue Error: %@", err); + [cluster toggleWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Toggle Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait1000ms_12() + { + WaitForMs(1000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_13() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueNonNull("MinMeasuredValue", actualValue)); - VerifyOrReturn(CheckValue("MinMeasuredValue", actualValue, 0)); + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); } NextTest(); @@ -25006,65 +26010,94 @@ class Test_TC_PRS_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_7() + CHIP_ERROR TestSendToggleCommand_14() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute constraints: MaxMeasuredValue Error: %@", err); + [cluster toggleWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Toggle Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_8() + CHIP_ERROR TestWait1000ms_15() + { + WaitForMs(1000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_16() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxMeasuredValueArgument; - maxMeasuredValueArgument = [NSNumber numberWithShort:0]; - [cluster - writeAttributeMaxMeasuredValueWithValue:maxMeasuredValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default values to mandatory attribute: MaxMeasuredValue Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after toggle command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsBackMandatoryAttributeMaxMeasuredValue_9() + CHIP_ERROR TestUserPromptSetOnOffAttributeManuallyToOn_17() + { + UserPrompt(@"Operate on device to set OnOff attribute manually to on"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserPromptSetOnOffAttributeManuallyToOff_18() + { + UserPrompt(@"Operate on device to set OnOff attribute manually to off"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestResetOffCommand_19() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back mandatory attribute: MaxMeasuredValue Error: %@", err); + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset Off Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueNonNull("MaxMeasuredValue", actualValue)); - VerifyOrReturn(CheckValue("MaxMeasuredValue", actualValue, 0)); + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); } NextTest(); @@ -25074,10 +26107,10 @@ class Test_TC_PRS_2_1 : public TestCommandBridge { } }; -class Test_TC_PCC_1_1 : public TestCommandBridge { +class Test_TC_OO_2_3 : public TestCommandBridge { public: - Test_TC_PCC_1_1() - : TestCommandBridge("Test_TC_PCC_1_1") + Test_TC_OO_2_3() + : TestCommandBridge("Test_TC_OO_2_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -25086,7 +26119,7 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_PCC_1_1() {} + ~Test_TC_OO_2_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -25094,11 +26127,11 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -25115,41 +26148,360 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Send On Command\n"); + if (ShouldSkip("CR_ON")) { + NextTest(); + return; + } + err = TestSendOnCommand_1(); break; case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); + err = TestWait1000ms_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads GlobalSceneControl attribute from DUT\n"); + if (ShouldSkip("A_GLOBALSCENECONTROL")) { + NextTest(); + return; + } + err = TestReadsGlobalSceneControlAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Send On Command\n"); + if (ShouldSkip("CR_ON")) { + NextTest(); + return; + } + err = TestSendOnCommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 1000ms\n"); + err = TestWait1000ms_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads GlobalSceneControl attribute from DUT\n"); + if (ShouldSkip("A_GLOBALSCENECONTROL")) { + NextTest(); + return; + } + err = TestReadsGlobalSceneControlAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Send On Command\n"); + if (ShouldSkip("CR_ON")) { + NextTest(); + return; + } + err = TestSendOnCommand_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 1000ms\n"); + err = TestWait1000ms_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Reads GlobalSceneControl attribute from DUT\n"); + if (ShouldSkip("A_GLOBALSCENECONTROL")) { + NextTest(); + return; + } + err = TestReadsGlobalSceneControlAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Reads OffWaitTime attribute from DUT\n"); + if (ShouldSkip("A_OFFWAITTIME")) { + NextTest(); + return; + } + err = TestReadsOffWaitTimeAttributeFromDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Send On Command\n"); + if (ShouldSkip("CR_ON")) { + NextTest(); + return; + } + err = TestSendOnCommand_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Reads OffWaitTime attribute from DUT\n"); + if (ShouldSkip("A_OFFWAITTIME")) { + NextTest(); + return; + } + err = TestReadsOffWaitTimeAttributeFromDut_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Send Off Command\n"); + if (ShouldSkip("CR_OFF")) { + NextTest(); + return; + } + err = TestSendOffCommand_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Reads OffWaitTime attribute from DUT\n"); + if (ShouldSkip("A_OFFWAITTIME")) { + NextTest(); + return; + } + err = TestReadsOffWaitTimeAttributeFromDut_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Send On Command\n"); + if (ShouldSkip("CR_ON")) { + NextTest(); + return; + } + err = TestSendOnCommand_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Reads OffWaitTime attribute from DUT\n"); + if (ShouldSkip("A_OFFWAITTIME")) { + NextTest(); + return; + } + err = TestReadsOffWaitTimeAttributeFromDut_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Send Off Command\n"); + if (ShouldSkip("CR_OFF")) { + NextTest(); + return; + } + err = TestSendOffCommand_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Send On Command\n"); + if (ShouldSkip("CR_ON")) { + NextTest(); + return; + } + err = TestSendOnCommand_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : Reads OffWaitTime attribute from DUT\n"); + if (ShouldSkip("A_OFFWAITTIME")) { + NextTest(); + return; + } + err = TestReadsOffWaitTimeAttributeFromDut_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : Send Off Command\n"); + if (ShouldSkip("CR_OFF")) { + NextTest(); + return; + } + err = TestSendOffCommand_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_38(); + break; + case 39: + ChipLogProgress(chipTool, " ***** Test Step 39 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_39(); + break; + case 40: + ChipLogProgress(chipTool, " ***** Test Step 40 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_41(); + break; + case 42: + ChipLogProgress(chipTool, " ***** Test Step 42 : Reads OffWaitTime attribute from DUT\n"); + if (ShouldSkip("A_OFFWAITTIME")) { + NextTest(); + return; + } + err = TestReadsOffWaitTimeAttributeFromDut_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Reads OnOff attribute from DUT\n"); + if (ShouldSkip("A_ONOFF")) { + NextTest(); + return; + } + err = TestReadsOnOffAttributeFromDut_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : Reads OnTime attribute from DUT\n"); + if (ShouldSkip("A_ONTIME")) { + NextTest(); + return; + } + err = TestReadsOnTimeAttributeFromDut_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Reads OffWaitTime attribute from DUT\n"); + if (ShouldSkip("A_OFFWAITTIME")) { + NextTest(); + return; + } + err = TestReadsOffWaitTimeAttributeFromDut_45(); + break; + case 46: + ChipLogProgress(chipTool, " ***** Test Step 46 : Send Off Command\n"); + if (ShouldSkip("CR_OFF")) { + NextTest(); + return; + } + err = TestSendOffCommand_46(); break; } @@ -25166,7 +26518,7 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; + const uint16_t mTestCount = 47; chip::Optional mNodeId; chip::Optional mCluster; @@ -25179,125 +26531,132 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + CHIP_ERROR TestSendOnCommand_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() + CHIP_ERROR TestWait1000ms_2() + { + WaitForMs(1000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("GlobalSceneControl", actualValue, 1)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() + CHIP_ERROR TestSendOnCommand_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() + CHIP_ERROR TestWait1000ms_6() + { + WaitForMs(1000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + VerifyOrReturn(CheckValue("GlobalSceneControl", actualValue, 1)); } NextTest(); @@ -25306,798 +26665,524 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() + CHIP_ERROR TestSendOnCommand_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() + CHIP_ERROR TestWait1000ms_10() + { + WaitForMs(1000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_11() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id featureMapArgument; - featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeFeatureMapWithValue:featureMapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_12() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeGlobalSceneControlWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + VerifyOrReturn(CheckValue("GlobalSceneControl", actualValue, 1)); } - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); }]; return CHIP_NO_ERROR; } -}; -class Test_TC_PCC_2_1 : public TestCommandBridge { -public: - Test_TC_PCC_2_1() - : TestCommandBridge("Test_TC_PCC_2_1") - , mTestIndex(0) + CHIP_ERROR TestReadsOnTimeAttributeFromDut_13() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - ~Test_TC_PCC_2_1() {} + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("status", err, 0)); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MaxPressure\n"); - err = TestReadTheMandatoryAttributeMaxPressure_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxSpeed\n"); - err = TestReadTheMandatoryAttributeMaxSpeed_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxFlow\n"); - err = TestReadTheMandatoryAttributeMaxFlow_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: EffectiveOperationMode\n"); - err = TestReadTheMandatoryAttributeEffectiveOperationMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: EffectiveControlMode\n"); - err = TestReadTheMandatoryAttributeEffectiveControlMode_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: Capacity\n"); - err = TestReadTheMandatoryAttributeCapacity_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxPressure\n"); - err = TestReadTheMandatoryAttributeMaxPressure_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read the mandatory attribute: MaxSpeed\n"); - err = TestReadTheMandatoryAttributeMaxSpeed_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: MaxFlow\n"); - err = TestReadTheMandatoryAttributeMaxFlow_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read the mandatory attribute: EffectiveOperationMode\n"); - err = TestReadTheMandatoryAttributeEffectiveOperationMode_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : read the mandatory attribute: EffectiveControlMode\n"); - err = TestReadTheMandatoryAttributeEffectiveControlMode_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : read the mandatory attribute: Capacity\n"); - err = TestReadTheMandatoryAttributeCapacity_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : read the optional attribute: MinConstPressure\n"); - err = TestReadTheOptionalAttributeMinConstPressure_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : read the optional attribute: MaxConstPressure\n"); - err = TestReadTheOptionalAttributeMaxConstPressure_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : read the optional attribute: MinCompPressure\n"); - err = TestReadTheOptionalAttributeMinCompPressure_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : read the optional attribute: MaxCompPressure\n"); - err = TestReadTheOptionalAttributeMaxCompPressure_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : read the optional attribute: MinConstSpeed\n"); - err = TestReadTheOptionalAttributeMinConstSpeed_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : read the optional attribute: MaxConstSpeed\n"); - err = TestReadTheOptionalAttributeMaxConstSpeed_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : read the optional attribute: MinConstFlow\n"); - err = TestReadTheOptionalAttributeMinConstFlow_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : read the optional attribute: MaxConstFlow\n"); - err = TestReadTheOptionalAttributeMaxConstFlow_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : read the optional attribute: MinConstTemp\n"); - err = TestReadTheOptionalAttributeMinConstTemp_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : read the optional attribute: MaxConstTemp\n"); - err = TestReadTheOptionalAttributeMaxConstTemp_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : read the optional attribute: Speed\n"); - err = TestReadTheOptionalAttributeSpeed_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : read the optional attribute: Power\n"); - err = TestReadTheOptionalAttributePower_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : write to the optional attribute: LifetimeEnergyConsumed\n"); - err = TestWriteToTheOptionalAttributeLifetimeEnergyConsumed_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : read the optional attribute: MinConstPressure\n"); - err = TestReadTheOptionalAttributeMinConstPressure_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : read the optional attribute: MaxConstPressure\n"); - err = TestReadTheOptionalAttributeMaxConstPressure_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : read the optional attribute: MinCompPressure\n"); - err = TestReadTheOptionalAttributeMinCompPressure_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : read the optional attribute: MaxCompPressure\n"); - err = TestReadTheOptionalAttributeMaxCompPressure_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : read the optional attribute: MinConstSpeed\n"); - err = TestReadTheOptionalAttributeMinConstSpeed_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : read the optional attribute: MaxConstSpeed\n"); - err = TestReadTheOptionalAttributeMaxConstSpeed_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : read the optional attribute: MinConstFlow\n"); - err = TestReadTheOptionalAttributeMinConstFlow_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : read the optional attribute: MaxConstFlow\n"); - err = TestReadTheOptionalAttributeMaxConstFlow_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : read the optional attribute: MinConstTemp\n"); - err = TestReadTheOptionalAttributeMinConstTemp_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : read the optional attribute: MaxConstTemp\n"); - err = TestReadTheOptionalAttributeMaxConstTemp_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : read the optional attribute: Speed\n"); - err = TestReadTheOptionalAttributeSpeed_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : read the optional attribute: Power\n"); - err = TestReadTheOptionalAttributePower_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_49(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_14() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 50; + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); + } + + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_1() + CHIP_ERROR TestSendOnCommand_15() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxSpeed_2() + CHIP_ERROR TestReadsOnOffAttributeFromDut_16() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxSpeed", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxFlow_3() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_17() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxFlow", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_4() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_18() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_5() + CHIP_ERROR TestSendOffCommand_19() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Off Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeCapacity_6() + CHIP_ERROR TestReadsOnOffAttributeFromDut_20() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCapacityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: Capacity Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_7() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_21() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxSpeed_8() + CHIP_ERROR TestReadsOnOffAttributeFromDut_22() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxSpeed", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxFlow_9() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_23() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxFlow", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_10() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_24() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_11() + CHIP_ERROR TestSendOnCommand_25() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeCapacity_12() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_26() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCapacityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: Capacity Error: %@", err); + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinConstPressure_13() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_27() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstPressure Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minConstPressure", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxConstPressure_14() + CHIP_ERROR TestSendOffCommand_28() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstPressure Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Off Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxConstPressure", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinCompPressure_15() + CHIP_ERROR TestReadsOnOffAttributeFromDut_29() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinCompPressure Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minCompPressure", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxCompPressure_16() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_30() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxCompPressure Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxCompPressure", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinConstSpeed_17() + CHIP_ERROR TestReadsOnOffAttributeFromDut_31() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstSpeed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minConstSpeed", "", "uint16")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstSpeed_18() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstSpeed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); } - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("maxConstSpeed", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinConstFlow_19() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_32() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstFlow Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minConstFlow", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxConstFlow_20() + CHIP_ERROR TestSendOnCommand_33() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstFlow Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send On Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxConstFlow", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinConstTemp_21() + CHIP_ERROR TestReadsOnOffAttributeFromDut_34() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstTemp Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minConstTemp", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minConstTemp", [value shortValue], -27315)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 1)); } NextTest(); @@ -26106,27 +27191,20 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxConstTemp_22() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_35() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstTemp Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxConstTemp", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", [value shortValue], -27315)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); } NextTest(); @@ -26135,27 +27213,20 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_23() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_36() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("PumpStatus", actualValue, 0U)); + VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); } NextTest(); @@ -26164,78 +27235,59 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_24() + CHIP_ERROR TestSendOffCommand_37() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Off Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("pumpStatus", "", "map16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeSpeed_25() + CHIP_ERROR TestReadsOnOffAttributeFromDut_38() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Speed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("speed", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_26() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_39() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LifetimeRunningHours", actualValue)); - VerifyOrReturn(CheckValue("LifetimeRunningHours", actualValue, 0UL)); + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); } NextTest(); @@ -26244,78 +27296,64 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_27() + CHIP_ERROR TestReadsOnOffAttributeFromDut_40() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("lifetimeRunningHours", "", "uint24")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributePower_28() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_41() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributePowerWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Power Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("power", "", "uint24")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_29() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_42() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LifetimeEnergyConsumed", actualValue)); - VerifyOrReturn(CheckValue("LifetimeEnergyConsumed", actualValue, 0UL)); + VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); } NextTest(); @@ -26324,314 +27362,372 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_30() + CHIP_ERROR TestReadsOnOffAttributeFromDut_43() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOnOffWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("lifetimeEnergyConsumed", "", "uint32")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteToTheOptionalAttributeLifetimeEnergyConsumed_31() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_44() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write to the optional attribute: LifetimeEnergyConsumed Error: %@", err); + [cluster readAttributeOnTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnTime", actualValue, 0U)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinConstPressure_32() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_45() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstPressure Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOffWaitTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minConstPressure", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OffWaitTime", actualValue, 0U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxConstPressure_33() + CHIP_ERROR TestSendOffCommand_46() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstPressure Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Send Off Command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxConstPressure", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadTheOptionalAttributeMinCompPressure_34() +class Test_TC_PS_1_1 : public TestCommandBridge { +public: + Test_TC_PS_1_1() + : TestCommandBridge("Test_TC_PS_1_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - [cluster readAttributeMinCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinCompPressure Error: %@", err); + ~Test_TC_PS_1_1() {} - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturn(CheckValue("status", err, 0)); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PS_1_1\n"); + } - VerifyOrReturn(CheckConstraintType("minCompPressure", "", "int16")); - NextTest(); - }]; + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PS_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxCompPressure_35() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxCompPressure Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxCompPressure", "", "int16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinConstSpeed_36() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstSpeed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minConstSpeed", "", "uint16")); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxConstSpeed_37() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstSpeed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxConstSpeed", "", "uint16")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMinConstFlow_38() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstFlow Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minConstFlow", "", "uint16")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadTheOptionalAttributeMaxConstFlow_39() +class Test_TC_PS_2_1 : public TestCommandBridge { +public: + Test_TC_PS_2_1() + : TestCommandBridge("Test_TC_PS_2_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstFlow Error: %@", err); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + ~Test_TC_PS_2_1() {} - VerifyOrReturn(CheckValue("status", err, 0)); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturn(CheckConstraintType("maxConstFlow", "", "uint16")); - NextTest(); - }]; + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PS_2_1\n"); + } - return CHIP_NO_ERROR; - } + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PS_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - CHIP_ERROR TestReadTheOptionalAttributeMinConstTemp_40() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + Wait(); - [cluster readAttributeMinConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MinConstTemp Error: %@", err); + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Test Harness Client reads Status attribute from Server DUT\n"); + err = TestTestHarnessClientReadsStatusAttributeFromServerDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Test Harness Client reads Order attribute from Server DUT\n"); + err = TestTestHarnessClientReadsOrderAttributeFromServerDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Test Harness Client reads Description attribute from Server DUT\n"); + err = TestTestHarnessClientReadsDescriptionAttributeFromServerDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Test Harness Client reads BatVoltage from Server DUT\n"); + err = TestTestHarnessClientReadsBatVoltageFromServerDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Test Harness Client reads BatPercentRemaining from Server DUT\n"); + err = TestTestHarnessClientReadsBatPercentRemainingFromServerDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Test Harness Client reads BatTimeRemaining from Server DUT\n"); + err = TestTestHarnessClientReadsBatTimeRemainingFromServerDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Test Harness Client reads BatChargeLevel from Server DUT\n"); + err = TestTestHarnessClientReadsBatChargeLevelFromServerDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Test Harness Client reads ActiveBatFaults from Server DUT\n"); + err = TestTestHarnessClientReadsActiveBatFaultsFromServerDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Test Harness Client reads BatChargeState from Server DUT\n"); + err = TestTestHarnessClientReadsBatChargeStateFromServerDut_9(); + break; + } - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } - VerifyOrReturn(CheckValue("status", err, 0)); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckConstraintType("minConstTemp", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minConstTemp", [value shortValue], -27315)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minConstTemp", [value shortValue], 32767)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 10; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeMaxConstTemp_41() + CHIP_ERROR TestTestHarnessClientReadsStatusAttributeFromServerDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: MaxConstTemp Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads Status attribute from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxConstTemp", "", "int16")); + VerifyOrReturn(CheckConstraintType("status", "", "enum8")); if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", [value shortValue], -27315)); + VerifyOrReturn(CheckConstraintMinValue("status", [value unsignedCharValue], 0)); } if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxConstTemp", [value shortValue], 32767)); + VerifyOrReturn(CheckConstraintMaxValue("status", [value unsignedCharValue], 3)); } NextTest(); @@ -26640,102 +27736,77 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_42() + CHIP_ERROR TestTestHarnessClientReadsOrderAttributeFromServerDut_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOrderWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads Order attribute from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("PumpStatus", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("order", "", "uint8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_43() + CHIP_ERROR TestTestHarnessClientReadsDescriptionAttributeFromServerDut_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: PumpStatus Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads Description attribute from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("pumpStatus", "", "map16")); + VerifyOrReturn(CheckConstraintType("description", "", "string")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeSpeed_44() + CHIP_ERROR TestTestHarnessClientReadsBatVoltageFromServerDut_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Speed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeBatteryVoltageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads BatVoltage from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("speed", "", "uint16")); + VerifyOrReturn(CheckConstraintType("batteryVoltage", "", "uint32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_45() + CHIP_ERROR TestTestHarnessClientReadsBatPercentRemainingFromServerDut_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); + [cluster readAttributeBatteryPercentRemainingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads BatPercentRemaining from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LifetimeRunningHours", actualValue)); - VerifyOrReturn(CheckValue("LifetimeRunningHours", actualValue, 0UL)); + VerifyOrReturn(CheckConstraintType("batteryPercentRemaining", "", "uint8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("batteryPercentRemaining", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("batteryPercentRemaining", [value unsignedCharValue], 200)); } NextTest(); @@ -26744,105 +27815,86 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_46() + CHIP_ERROR TestTestHarnessClientReadsBatTimeRemainingFromServerDut_6() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeBatteryTimeRemainingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads BatTimeRemaining from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("lifetimeRunningHours", "", "uint24")); + VerifyOrReturn(CheckConstraintType("batteryTimeRemaining", "", "uint32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributePower_47() + CHIP_ERROR TestTestHarnessClientReadsBatChargeLevelFromServerDut_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributePowerWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Power Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeBatteryChargeLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads BatChargeLevel from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("power", "", "uint24")); + VerifyOrReturn(CheckConstraintType("batteryChargeLevel", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("batteryChargeLevel", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("batteryChargeLevel", [value unsignedCharValue], 2)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_48() + CHIP_ERROR TestTestHarnessClientReadsActiveBatFaultsFromServerDut_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeActiveBatteryFaultsWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads ActiveBatFaults from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LifetimeEnergyConsumed", actualValue)); - VerifyOrReturn(CheckValue("LifetimeEnergyConsumed", actualValue, 0UL)); - } - + VerifyOrReturn(CheckConstraintType("activeBatteryFaults", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_49() + CHIP_ERROR TestTestHarnessClientReadsBatChargeStateFromServerDut_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeBatteryChargeStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Test Harness Client reads BatChargeState from Server DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("lifetimeEnergyConsumed", "", "uint32")); + VerifyOrReturn(CheckConstraintType("batteryChargeState", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("batteryChargeState", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("batteryChargeState", [value unsignedCharValue], 3)); + } + NextTest(); }]; @@ -26850,10 +27902,10 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { } }; -class Test_TC_PCC_2_2 : public TestCommandBridge { +class Test_TC_PRS_1_1 : public TestCommandBridge { public: - Test_TC_PCC_2_2() - : TestCommandBridge("Test_TC_PCC_2_2") + Test_TC_PRS_1_1() + : TestCommandBridge("Test_TC_PRS_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -26862,7 +27914,7 @@ class Test_TC_PCC_2_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_PCC_2_2() {} + ~Test_TC_PRS_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -26870,11 +27922,11 @@ class Test_TC_PCC_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -26891,28 +27943,17 @@ class Test_TC_PCC_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write 1 to the OperationMode attribute to DUT: OperationMode\n"); - if (ShouldSkip("A_OPERATIONMODE")) { - NextTest(); - return; - } - err = TestWrite1ToTheOperationModeAttributeToDutOperationMode_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Write 2 to the OperationMode attribute to DUT: OperationMode\n"); - if (ShouldSkip("A_OPERATIONMODE")) { - NextTest(); - return; - } - err = TestWrite2ToTheOperationModeAttributeToDutOperationMode_2(); + ChipLogProgress( + chipTool, " ***** Test Step 2 : Write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write 3 to the OperationMode attribute to DUT: OperationMode\n"); - if (ShouldSkip("A_OPERATIONMODE")) { - NextTest(); - return; - } - err = TestWrite3ToTheOperationModeAttributeToDutOperationMode_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute constraints: AttributeList\n"); + err = TestReadTheGlobalAttributeConstraintsAttributeList_3(); break; } @@ -26942,77 +27983,74 @@ class Test_TC_PCC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite1ToTheOperationModeAttributeToDutOperationMode_1() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id operationModeArgument; - operationModeArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeOperationModeWithValue:operationModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 1 to the OperationMode attribute to DUT: OperationMode Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite2ToTheOperationModeAttributeToDutOperationMode_2() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id operationModeArgument; - operationModeArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster writeAttributeOperationModeWithValue:operationModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 2 to the OperationMode attribute to DUT: OperationMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog( + @"Write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite3ToTheOperationModeAttributeToDutOperationMode_3() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsAttributeList_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id operationModeArgument; - operationModeArgument = [NSNumber numberWithUnsignedChar:3]; - [cluster writeAttributeOperationModeWithValue:operationModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 3 to the OperationMode attribute to DUT: OperationMode Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: AttributeList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } }; -class Test_TC_PCC_2_3 : public TestCommandBridge { +class Test_TC_PRS_2_1 : public TestCommandBridge { public: - Test_TC_PCC_2_3() - : TestCommandBridge("Test_TC_PCC_2_3") + Test_TC_PRS_2_1() + : TestCommandBridge("Test_TC_PRS_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -27021,7 +28059,7 @@ class Test_TC_PCC_2_3 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_PCC_2_3() {} + ~Test_TC_PRS_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -27029,11 +28067,11 @@ class Test_TC_PCC_2_3 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -27050,76 +28088,40 @@ class Test_TC_PCC_2_3 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write 0 to the OperationMode attribute to DUT\n"); - if (ShouldSkip("A_OPERATIONMODE")) { - NextTest(); - return; - } - err = TestWrite0ToTheOperationModeAttributeToDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the mandatory attribute constraints: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeConstraintsMeasuredValue_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the attribute: EffectiveOperationMode\n"); - if (ShouldSkip("A_EFFECTIVEOPERATIONMODE")) { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveOperationMode_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Write the default values to mandatory attribute: MeasuredValue\n"); + err = TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write 0 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) { - NextTest(); - return; - } - err = TestWrite0ToTheControlModeAttributeToDut_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back mandatory attribute: MeasuredValue\n"); + err = TestReadsBackMandatoryAttributeMeasuredValue_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the attribute: EffectiveControlMode\n"); - if (ShouldSkip("A_EFFECTIVECONTROLMODE")) { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveControlMode_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute constraints: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write 1 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) { - NextTest(); - return; - } - err = TestWrite1ToTheControlModeAttributeToDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Write the default values to mandatory attribute: MinMeasuredValue\n"); + err = TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Write 2 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) { - NextTest(); - return; - } - err = TestWrite2ToTheControlModeAttributeToDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back mandatory attribute: MinMeasuredValue\n"); + err = TestReadsBackMandatoryAttributeMinMeasuredValue_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Write 3 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) { - NextTest(); - return; - } - err = TestWrite3ToTheControlModeAttributeToDut_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the mandatory attribute constraints: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Write 5 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) { - NextTest(); - return; - } - err = TestWrite5ToTheControlModeAttributeToDut_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Write the default values to mandatory attribute: MaxMeasuredValue\n"); + err = TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write 7 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) { - NextTest(); - return; - } - err = TestWrite7ToTheControlModeAttributeToDut_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads back mandatory attribute: MaxMeasuredValue\n"); + err = TestReadsBackMandatoryAttributeMaxMeasuredValue_9(); break; } @@ -27149,90 +28151,64 @@ class Test_TC_PCC_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite0ToTheOperationModeAttributeToDut_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id operationModeArgument; - operationModeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeOperationModeWithValue:operationModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 0 to the OperationMode attribute to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_2() + CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMeasuredValue_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveOperationMode Error: %@", err); + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the mandatory attribute constraints: MeasuredValue Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("EffectiveOperationMode", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite0ToTheControlModeAttributeToDut_3() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 0 to the ControlMode attribute to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id measuredValueArgument; + measuredValueArgument = [NSNumber numberWithShort:0]; + [cluster writeAttributeMeasuredValueWithValue:measuredValueArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write the default values to mandatory attribute: MeasuredValue Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_4() + CHIP_ERROR TestReadsBackMandatoryAttributeMeasuredValue_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads back mandatory attribute: MeasuredValue Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("EffectiveControlMode", actualValue, 0)); + VerifyOrReturn(CheckValueNonNull("MeasuredValue", actualValue)); + VerifyOrReturn(CheckValue("MeasuredValue", actualValue, 0)); } NextTest(); @@ -27241,121 +28217,145 @@ class Test_TC_PCC_2_3 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite1ToTheControlModeAttributeToDut_5() + CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 1 to the ControlMode attribute to DUT Error: %@", err); + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the mandatory attribute constraints: MinMeasuredValue Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite2ToTheControlModeAttributeToDut_6() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster writeAttributeControlModeWithValue:controlModeArgument + id minMeasuredValueArgument; + minMeasuredValueArgument = [NSNumber numberWithShort:0]; + [cluster + writeAttributeMinMeasuredValueWithValue:minMeasuredValueArgument completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 2 to the ControlMode attribute to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + NSLog(@"Write the default values to mandatory attribute: MinMeasuredValue Error: %@", err); + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite3ToTheControlModeAttributeToDut_7() + CHIP_ERROR TestReadsBackMandatoryAttributeMinMeasuredValue_6() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:3]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 3 to the ControlMode attribute to DUT Error: %@", err); + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads back mandatory attribute: MinMeasuredValue Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("MinMeasuredValue", actualValue)); + VerifyOrReturn(CheckValue("MinMeasuredValue", actualValue, 0)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite5ToTheControlModeAttributeToDut_8() + CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:5]; - [cluster writeAttributeControlModeWithValue:controlModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 5 to the ControlMode attribute to DUT Error: %@", err); + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the mandatory attribute constraints: MaxMeasuredValue Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWrite7ToTheControlModeAttributeToDut_9() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id controlModeArgument; - controlModeArgument = [NSNumber numberWithUnsignedChar:7]; - [cluster writeAttributeControlModeWithValue:controlModeArgument + id maxMeasuredValueArgument; + maxMeasuredValueArgument = [NSNumber numberWithShort:0]; + [cluster + writeAttributeMaxMeasuredValueWithValue:maxMeasuredValueArgument completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write 7 to the ControlMode attribute to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + NSLog(@"Write the default values to mandatory attribute: MaxMeasuredValue Error: %@", err); + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); NextTest(); }]; return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadsBackMandatoryAttributeMaxMeasuredValue_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads back mandatory attribute: MaxMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("MaxMeasuredValue", actualValue)); + VerifyOrReturn(CheckValue("MaxMeasuredValue", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; -class Test_TC_RH_1_1 : public TestCommandBridge { +class Test_TC_PCC_1_1 : public TestCommandBridge { public: - Test_TC_RH_1_1() - : TestCommandBridge("Test_TC_RH_1_1") + Test_TC_PCC_1_1() + : TestCommandBridge("Test_TC_PCC_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -27364,7 +28364,7 @@ class Test_TC_RH_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_RH_1_1() {} + ~Test_TC_PCC_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -27372,11 +28372,11 @@ class Test_TC_RH_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -27397,16 +28397,37 @@ class Test_TC_RH_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); + ChipLogProgress( + chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); break; } @@ -27423,7 +28444,7 @@ class Test_TC_RH_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 10; chip::Optional mNodeId; chip::Optional mCluster; @@ -27439,7 +28460,7 @@ class Test_TC_RH_1_1 : public TestCommandBridge { CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); @@ -27456,10 +28477,33 @@ class Test_TC_RH_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog( + @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); @@ -27476,10 +28520,10 @@ class Test_TC_RH_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); @@ -27496,10 +28540,10 @@ class Test_TC_RH_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); @@ -27515,168 +28559,91 @@ class Test_TC_RH_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } -}; - -class Test_TC_RH_2_1 : public TestCommandBridge { -public: - Test_TC_RH_2_1() - : TestCommandBridge("Test_TC_RH_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RH_2_1() {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads constraints of attribute: MinMeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMinMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads constraints of attribute: Tolerance\n"); - err = TestReadsConstraintsOfAttributeTolerance_3(); - break; - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + VerifyOrReturn(CheckValue("status", err, 0)); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfAttributeMeasuredValue_1() + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of attribute: MeasuredValue Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 10000U)); - } - + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_2() + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of attribute: MinMeasuredValue Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 9999U)); - } + id featureMapArgument; + featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfAttributeTolerance_3() + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of attribute: Tolerance Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); } + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); }]; @@ -27684,10 +28651,10 @@ class Test_TC_RH_2_1 : public TestCommandBridge { } }; -class Test_TC_RH_2_2 : public TestCommandBridge { +class Test_TC_PCC_2_1 : public TestCommandBridge { public: - Test_TC_RH_2_2() - : TestCommandBridge("Test_TC_RH_2_2") + Test_TC_PCC_2_1() + : TestCommandBridge("Test_TC_PCC_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -27696,7 +28663,7 @@ class Test_TC_RH_2_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_RH_2_2() {} + ~Test_TC_PCC_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -27704,11 +28671,11 @@ class Test_TC_RH_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -27725,191 +28692,200 @@ class Test_TC_RH_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MinMeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMinMeasuredValue_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MaxPressure\n"); + err = TestReadTheMandatoryAttributeMaxPressure_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads MeasuredValue attribute from DUT\n"); - if (ShouldSkip("A_RELATIVEHUMIDITY")) { - NextTest(); - return; - } - err = TestReadsMeasuredValueAttributeFromDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxSpeed\n"); + err = TestReadTheMandatoryAttributeMaxSpeed_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the mandatory attribute: MeasuredValue\n"); - if (ShouldSkip("A_RELATIVEHUMIDITY")) { - NextTest(); - return; - } - err = TestReadTheMandatoryAttributeMeasuredValue_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxFlow\n"); + err = TestReadTheMandatoryAttributeMaxFlow_3(); break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of attribute: MinMeasuredValue Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 9999U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 10000U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SWTCH_2_1 : public TestCommandBridge { -public: - Test_TC_SWTCH_2_1() - : TestCommandBridge("Test_TC_SWTCH_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWTCH_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: EffectiveOperationMode\n"); + err = TestReadTheMandatoryAttributeEffectiveOperationMode_4(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read NumberOfPositions attribute\n"); - err = TestReadNumberOfPositionsAttribute_1(); + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: EffectiveControlMode\n"); + err = TestReadTheMandatoryAttributeEffectiveControlMode_5(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read NumberOfPositions attribute\n"); - err = TestReadNumberOfPositionsAttribute_2(); + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: Capacity\n"); + err = TestReadTheMandatoryAttributeCapacity_6(); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); - err = TestReadCurrentPositionAttribute_3(); + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxPressure\n"); + err = TestReadTheMandatoryAttributeMaxPressure_7(); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentPosition attribute\n"); - err = TestReadCurrentPositionAttribute_4(); + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : read the mandatory attribute: MaxSpeed\n"); + err = TestReadTheMandatoryAttributeMaxSpeed_8(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read MultiPressMax attribute\n"); - err = TestReadMultiPressMaxAttribute_5(); + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: MaxFlow\n"); + err = TestReadTheMandatoryAttributeMaxFlow_9(); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read MultiPressMax attribute\n"); - err = TestReadMultiPressMaxAttribute_6(); + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : read the mandatory attribute: EffectiveOperationMode\n"); + err = TestReadTheMandatoryAttributeEffectiveOperationMode_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : read the mandatory attribute: EffectiveControlMode\n"); + err = TestReadTheMandatoryAttributeEffectiveControlMode_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : read the mandatory attribute: Capacity\n"); + err = TestReadTheMandatoryAttributeCapacity_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : read the optional attribute: MinConstPressure\n"); + err = TestReadTheOptionalAttributeMinConstPressure_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : read the optional attribute: MaxConstPressure\n"); + err = TestReadTheOptionalAttributeMaxConstPressure_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : read the optional attribute: MinCompPressure\n"); + err = TestReadTheOptionalAttributeMinCompPressure_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : read the optional attribute: MaxCompPressure\n"); + err = TestReadTheOptionalAttributeMaxCompPressure_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : read the optional attribute: MinConstSpeed\n"); + err = TestReadTheOptionalAttributeMinConstSpeed_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : read the optional attribute: MaxConstSpeed\n"); + err = TestReadTheOptionalAttributeMaxConstSpeed_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : read the optional attribute: MinConstFlow\n"); + err = TestReadTheOptionalAttributeMinConstFlow_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : read the optional attribute: MaxConstFlow\n"); + err = TestReadTheOptionalAttributeMaxConstFlow_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : read the optional attribute: MinConstTemp\n"); + err = TestReadTheOptionalAttributeMinConstTemp_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : read the optional attribute: MaxConstTemp\n"); + err = TestReadTheOptionalAttributeMaxConstTemp_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : read the optional attribute: PumpStatus\n"); + err = TestReadTheOptionalAttributePumpStatus_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : read the optional attribute: PumpStatus\n"); + err = TestReadTheOptionalAttributePumpStatus_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : read the optional attribute: Speed\n"); + err = TestReadTheOptionalAttributeSpeed_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : read the optional attribute: LifetimeRunningHours\n"); + err = TestReadTheOptionalAttributeLifetimeRunningHours_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : read the optional attribute: LifetimeRunningHours\n"); + err = TestReadTheOptionalAttributeLifetimeRunningHours_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : read the optional attribute: Power\n"); + err = TestReadTheOptionalAttributePower_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : read the optional attribute: LifetimeEnergyConsumed\n"); + err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : read the optional attribute: LifetimeEnergyConsumed\n"); + err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : write to the optional attribute: LifetimeEnergyConsumed\n"); + err = TestWriteToTheOptionalAttributeLifetimeEnergyConsumed_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : read the optional attribute: MinConstPressure\n"); + err = TestReadTheOptionalAttributeMinConstPressure_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : read the optional attribute: MaxConstPressure\n"); + err = TestReadTheOptionalAttributeMaxConstPressure_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : read the optional attribute: MinCompPressure\n"); + err = TestReadTheOptionalAttributeMinCompPressure_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : read the optional attribute: MaxCompPressure\n"); + err = TestReadTheOptionalAttributeMaxCompPressure_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : read the optional attribute: MinConstSpeed\n"); + err = TestReadTheOptionalAttributeMinConstSpeed_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : read the optional attribute: MaxConstSpeed\n"); + err = TestReadTheOptionalAttributeMaxConstSpeed_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : read the optional attribute: MinConstFlow\n"); + err = TestReadTheOptionalAttributeMinConstFlow_38(); + break; + case 39: + ChipLogProgress(chipTool, " ***** Test Step 39 : read the optional attribute: MaxConstFlow\n"); + err = TestReadTheOptionalAttributeMaxConstFlow_39(); + break; + case 40: + ChipLogProgress(chipTool, " ***** Test Step 40 : read the optional attribute: MinConstTemp\n"); + err = TestReadTheOptionalAttributeMinConstTemp_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : read the optional attribute: MaxConstTemp\n"); + err = TestReadTheOptionalAttributeMaxConstTemp_41(); + break; + case 42: + ChipLogProgress(chipTool, " ***** Test Step 42 : read the optional attribute: PumpStatus\n"); + err = TestReadTheOptionalAttributePumpStatus_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : read the optional attribute: PumpStatus\n"); + err = TestReadTheOptionalAttributePumpStatus_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : read the optional attribute: Speed\n"); + err = TestReadTheOptionalAttributeSpeed_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : read the optional attribute: LifetimeRunningHours\n"); + err = TestReadTheOptionalAttributeLifetimeRunningHours_45(); + break; + case 46: + ChipLogProgress(chipTool, " ***** Test Step 46 : read the optional attribute: LifetimeRunningHours\n"); + err = TestReadTheOptionalAttributeLifetimeRunningHours_46(); + break; + case 47: + ChipLogProgress(chipTool, " ***** Test Step 47 : read the optional attribute: Power\n"); + err = TestReadTheOptionalAttributePower_47(); + break; + case 48: + ChipLogProgress(chipTool, " ***** Test Step 48 : read the optional attribute: LifetimeEnergyConsumed\n"); + err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_48(); + break; + case 49: + ChipLogProgress(chipTool, " ***** Test Step 49 : read the optional attribute: LifetimeEnergyConsumed\n"); + err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_49(); break; } @@ -27926,7 +28902,7 @@ class Test_TC_SWTCH_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; + const uint16_t mTestCount = 50; chip::Optional mNodeId; chip::Optional mCluster; @@ -27939,381 +28915,5470 @@ class Test_TC_SWTCH_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadNumberOfPositionsAttribute_1() + CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read NumberOfPositions attribute Error: %@", err); + [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("number of positions", actualValue, 2)); - } - + VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadNumberOfPositionsAttribute_2() + CHIP_ERROR TestReadTheMandatoryAttributeMaxSpeed_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read NumberOfPositions attribute Error: %@", err); + [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("numberOfPositions", "", "uint8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("numberOfPositions", [value unsignedCharValue], 2)); - } + VerifyOrReturn(CheckConstraintType("maxSpeed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxFlow_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("maxFlow", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadCurrentPositionAttribute_3() + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); + [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current position", actualValue, 0)); - } + VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadCurrentPositionAttribute_4() + CHIP_ERROR TestReadTheMandatoryAttributeCapacity_6() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); + [cluster readAttributeCapacityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: Capacity Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("currentPosition", "", "uint8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("currentPosition", [value unsignedCharValue], 0)); - } + VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadMultiPressMaxAttribute_5() + CHIP_ERROR TestReadTheMandatoryAttributeMaxSpeed_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read MultiPressMax attribute Error: %@", err); + [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("multi press max", actualValue, 2)); - } + VerifyOrReturn(CheckConstraintType("maxSpeed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + CHIP_ERROR TestReadTheMandatoryAttributeMaxFlow_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxFlow", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadMultiPressMaxAttribute_6() + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_10() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read MultiPressMax attribute Error: %@", err); + [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("multiPressMax", "", "uint8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("multiPressMax", [value unsignedCharValue], 2)); - } + VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); NextTest(); }]; return CHIP_NO_ERROR; } -}; -class Test_TC_SWTCH_2_2 : public TestCommandBridge { -public: - Test_TC_SWTCH_2_2() - : TestCommandBridge("Test_TC_SWTCH_2_2") - , mTestIndex(0) + CHIP_ERROR TestReadTheMandatoryAttributeCapacity_12() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCapacityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: Capacity Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; } - ~Test_TC_SWTCH_2_2() {} + CHIP_ERROR TestReadTheOptionalAttributeMinConstPressure_13() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - /////////// TestCommand Interface ///////// - void NextTest() override + [cluster readAttributeMinConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstPressure Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstPressure_14() { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_2\n"); - } + [cluster readAttributeMaxConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstPressure Error: %@", err); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } - Wait(); + VerifyOrReturn(CheckValue("status", err, 0)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : User interaction needed\n"); - err = TestUserInteractionNeeded_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : User interaction needed\n"); - err = TestUserInteractionNeeded_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); + VerifyOrReturn(CheckConstraintType("maxConstPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinCompPressure_15() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinCompPressure Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minCompPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxCompPressure_16() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxCompPressure Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxCompPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinConstSpeed_17() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstSpeed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstSpeed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstSpeed_18() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstSpeed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxConstSpeed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinConstFlow_19() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstFlow Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstFlow", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstFlow_20() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstFlow Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxConstFlow", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinConstTemp_21() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstTemp Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstTemp", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minConstTemp", [value shortValue], -27315)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstTemp_22() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstTemp Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxConstTemp", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", [value shortValue], -27315)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributePumpStatus_23() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: PumpStatus Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("PumpStatus", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributePumpStatus_24() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: PumpStatus Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("pumpStatus", "", "map16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeSpeed_25() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: Speed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("speed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_26() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeRunningHours", actualValue)); + VerifyOrReturn(CheckValue("LifetimeRunningHours", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_27() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("lifetimeRunningHours", "", "uint24")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributePower_28() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePowerWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: Power Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("power", "", "uint24")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_29() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeEnergyConsumed", actualValue)); + VerifyOrReturn(CheckValue("LifetimeEnergyConsumed", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_30() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("lifetimeEnergyConsumed", "", "uint32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWriteToTheOptionalAttributeLifetimeEnergyConsumed_31() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id lifetimeEnergyConsumedArgument; + lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:0UL]; + [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write to the optional attribute: LifetimeEnergyConsumed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinConstPressure_32() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstPressure Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstPressure_33() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxConstPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstPressure Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxConstPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinCompPressure_34() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinCompPressure Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minCompPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxCompPressure_35() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxCompPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxCompPressure Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxCompPressure", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinConstSpeed_36() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstSpeed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstSpeed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstSpeed_37() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxConstSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstSpeed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxConstSpeed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinConstFlow_38() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstFlow Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstFlow", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstFlow_39() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxConstFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstFlow Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxConstFlow", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMinConstTemp_40() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MinConstTemp Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minConstTemp", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minConstTemp", [value shortValue], -27315)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minConstTemp", [value shortValue], 32767)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeMaxConstTemp_41() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxConstTempWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: MaxConstTemp Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxConstTemp", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", [value shortValue], -27315)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxConstTemp", [value shortValue], 32767)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributePumpStatus_42() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: PumpStatus Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("PumpStatus", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributePumpStatus_43() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePumpStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: PumpStatus Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("pumpStatus", "", "map16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeSpeed_44() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: Speed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("speed", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_45() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeRunningHours", actualValue)); + VerifyOrReturn(CheckValue("LifetimeRunningHours", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_46() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeRunningHours Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("lifetimeRunningHours", "", "uint24")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributePower_47() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePowerWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: Power Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("power", "", "uint24")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_48() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeEnergyConsumed", actualValue)); + VerifyOrReturn(CheckValue("LifetimeEnergyConsumed", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_49() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: LifetimeEnergyConsumed Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("lifetimeEnergyConsumed", "", "uint32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PCC_2_2 : public TestCommandBridge { +public: + Test_TC_PCC_2_2() + : TestCommandBridge("Test_TC_PCC_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PCC_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Write 1 to the OperationMode attribute to DUT: OperationMode\n"); + if (ShouldSkip("A_OPERATIONMODE")) { + NextTest(); + return; + } + err = TestWrite1ToTheOperationModeAttributeToDutOperationMode_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Write 2 to the OperationMode attribute to DUT: OperationMode\n"); + if (ShouldSkip("A_OPERATIONMODE")) { + NextTest(); + return; + } + err = TestWrite2ToTheOperationModeAttributeToDutOperationMode_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Write 3 to the OperationMode attribute to DUT: OperationMode\n"); + if (ShouldSkip("A_OPERATIONMODE")) { + NextTest(); + return; + } + err = TestWrite3ToTheOperationModeAttributeToDutOperationMode_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite1ToTheOperationModeAttributeToDutOperationMode_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id operationModeArgument; + operationModeArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeOperationModeWithValue:operationModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 1 to the OperationMode attribute to DUT: OperationMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite2ToTheOperationModeAttributeToDutOperationMode_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id operationModeArgument; + operationModeArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeOperationModeWithValue:operationModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 2 to the OperationMode attribute to DUT: OperationMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite3ToTheOperationModeAttributeToDutOperationMode_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id operationModeArgument; + operationModeArgument = [NSNumber numberWithUnsignedChar:3]; + [cluster writeAttributeOperationModeWithValue:operationModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 3 to the OperationMode attribute to DUT: OperationMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PCC_2_3 : public TestCommandBridge { +public: + Test_TC_PCC_2_3() + : TestCommandBridge("Test_TC_PCC_2_3") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PCC_2_3() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_3\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Write 0 to the OperationMode attribute to DUT\n"); + if (ShouldSkip("A_OPERATIONMODE")) { + NextTest(); + return; + } + err = TestWrite0ToTheOperationModeAttributeToDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the attribute: EffectiveOperationMode\n"); + if (ShouldSkip("A_EFFECTIVEOPERATIONMODE")) { + NextTest(); + return; + } + err = TestReadsTheAttributeEffectiveOperationMode_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Write 0 to the ControlMode attribute to DUT\n"); + if (ShouldSkip("A_CONTROLMODE")) { + NextTest(); + return; + } + err = TestWrite0ToTheControlModeAttributeToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the attribute: EffectiveControlMode\n"); + if (ShouldSkip("A_EFFECTIVECONTROLMODE")) { + NextTest(); + return; + } + err = TestReadsTheAttributeEffectiveControlMode_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Write 1 to the ControlMode attribute to DUT\n"); + if (ShouldSkip("A_CONTROLMODE")) { + NextTest(); + return; + } + err = TestWrite1ToTheControlModeAttributeToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Write 2 to the ControlMode attribute to DUT\n"); + if (ShouldSkip("A_CONTROLMODE")) { + NextTest(); + return; + } + err = TestWrite2ToTheControlModeAttributeToDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Write 3 to the ControlMode attribute to DUT\n"); + if (ShouldSkip("A_CONTROLMODE")) { + NextTest(); + return; + } + err = TestWrite3ToTheControlModeAttributeToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Write 5 to the ControlMode attribute to DUT\n"); + if (ShouldSkip("A_CONTROLMODE")) { + NextTest(); + return; + } + err = TestWrite5ToTheControlModeAttributeToDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Write 7 to the ControlMode attribute to DUT\n"); + if (ShouldSkip("A_CONTROLMODE")) { + NextTest(); + return; + } + err = TestWrite7ToTheControlModeAttributeToDut_9(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 10; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite0ToTheOperationModeAttributeToDut_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id operationModeArgument; + operationModeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeOperationModeWithValue:operationModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 0 to the OperationMode attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the attribute: EffectiveOperationMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EffectiveOperationMode", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite0ToTheControlModeAttributeToDut_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id controlModeArgument; + controlModeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeControlModeWithValue:controlModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 0 to the ControlMode attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the attribute: EffectiveControlMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EffectiveControlMode", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite1ToTheControlModeAttributeToDut_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id controlModeArgument; + controlModeArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeControlModeWithValue:controlModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 1 to the ControlMode attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite2ToTheControlModeAttributeToDut_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id controlModeArgument; + controlModeArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeControlModeWithValue:controlModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 2 to the ControlMode attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite3ToTheControlModeAttributeToDut_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id controlModeArgument; + controlModeArgument = [NSNumber numberWithUnsignedChar:3]; + [cluster writeAttributeControlModeWithValue:controlModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 3 to the ControlMode attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite5ToTheControlModeAttributeToDut_8() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id controlModeArgument; + controlModeArgument = [NSNumber numberWithUnsignedChar:5]; + [cluster writeAttributeControlModeWithValue:controlModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 5 to the ControlMode attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite7ToTheControlModeAttributeToDut_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id controlModeArgument; + controlModeArgument = [NSNumber numberWithUnsignedChar:7]; + [cluster writeAttributeControlModeWithValue:controlModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 7 to the ControlMode attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PCC_2_4 : public TestCommandBridge { +public: + Test_TC_PCC_2_4() + : TestCommandBridge("Test_TC_PCC_2_4") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PCC_2_4() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_4\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Write 1 to the LifetimeRunningHours attribute to DUT\n"); + err = TestWrite1ToTheLifetimeRunningHoursAttributeToDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the attribute: LifetimeRunningHours\n"); + err = TestReadsTheAttributeLifetimeRunningHours_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Write 2 to the LifetimeRunningHours attribute to DUT\n"); + err = TestWrite2ToTheLifetimeRunningHoursAttributeToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the attribute: LifetimeRunningHours\n"); + err = TestReadsTheAttributeLifetimeRunningHours_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Write 3 to the LifetimeRunningHours attribute to DUT\n"); + err = TestWrite3ToTheLifetimeRunningHoursAttributeToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the attribute: LifetimeRunningHours\n"); + err = TestReadsTheAttributeLifetimeRunningHours_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Write 1 to the LifetimeEnergyConsumed attribute to DUT\n"); + err = TestWrite1ToTheLifetimeEnergyConsumedAttributeToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Write 2 to the LifetimeEnergyConsumed attribute to DUT\n"); + err = TestWrite2ToTheLifetimeEnergyConsumedAttributeToDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads the attribute: LifetimeEnergyConsumed\n"); + err = TestReadsTheAttributeLifetimeEnergyConsumed_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Write 3 to the LifetimeEnergyConsumed attribute to DUT\n"); + err = TestWrite3ToTheLifetimeEnergyConsumedAttributeToDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the attribute: LifetimeEnergyConsumed\n"); + err = TestReadsTheAttributeLifetimeEnergyConsumed_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite1ToTheLifetimeRunningHoursAttributeToDut_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id lifetimeRunningHoursArgument; + lifetimeRunningHoursArgument = [NSNumber numberWithUnsignedInt:1UL]; + [cluster writeAttributeLifetimeRunningHoursWithValue:lifetimeRunningHoursArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 1 to the LifetimeRunningHours attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheAttributeLifetimeRunningHours_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the attribute: LifetimeRunningHours Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeRunningHours", actualValue)); + VerifyOrReturn(CheckValue("LifetimeRunningHours", actualValue, 1UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite2ToTheLifetimeRunningHoursAttributeToDut_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id lifetimeRunningHoursArgument; + lifetimeRunningHoursArgument = [NSNumber numberWithUnsignedInt:2UL]; + [cluster writeAttributeLifetimeRunningHoursWithValue:lifetimeRunningHoursArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 2 to the LifetimeRunningHours attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheAttributeLifetimeRunningHours_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the attribute: LifetimeRunningHours Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeRunningHours", actualValue)); + VerifyOrReturn(CheckValue("LifetimeRunningHours", actualValue, 2UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite3ToTheLifetimeRunningHoursAttributeToDut_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id lifetimeRunningHoursArgument; + lifetimeRunningHoursArgument = [NSNumber numberWithUnsignedInt:3UL]; + [cluster writeAttributeLifetimeRunningHoursWithValue:lifetimeRunningHoursArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 3 to the LifetimeRunningHours attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheAttributeLifetimeRunningHours_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeRunningHoursWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the attribute: LifetimeRunningHours Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeRunningHours", actualValue)); + VerifyOrReturn(CheckValue("LifetimeRunningHours", actualValue, 3UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite1ToTheLifetimeEnergyConsumedAttributeToDut_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id lifetimeEnergyConsumedArgument; + lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:1UL]; + [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 1 to the LifetimeEnergyConsumed attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite2ToTheLifetimeEnergyConsumedAttributeToDut_8() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id lifetimeEnergyConsumedArgument; + lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:2UL]; + [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 2 to the LifetimeEnergyConsumed attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheAttributeLifetimeEnergyConsumed_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the attribute: LifetimeEnergyConsumed Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeEnergyConsumed", actualValue)); + VerifyOrReturn(CheckValue("LifetimeEnergyConsumed", actualValue, 2UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWrite3ToTheLifetimeEnergyConsumedAttributeToDut_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id lifetimeEnergyConsumedArgument; + lifetimeEnergyConsumedArgument = [NSNumber numberWithUnsignedInt:3UL]; + [cluster writeAttributeLifetimeEnergyConsumedWithValue:lifetimeEnergyConsumedArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write 3 to the LifetimeEnergyConsumed attribute to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsTheAttributeLifetimeEnergyConsumed_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLifetimeEnergyConsumedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the attribute: LifetimeEnergyConsumed Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LifetimeEnergyConsumed", actualValue)); + VerifyOrReturn(CheckValue("LifetimeEnergyConsumed", actualValue, 3UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_RH_1_1 : public TestCommandBridge { +public: + Test_TC_RH_1_1() + : TestCommandBridge("Test_TC_RH_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_RH_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_RH_2_1 : public TestCommandBridge { +public: + Test_TC_RH_2_1() + : TestCommandBridge("Test_TC_RH_2_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_RH_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MeasuredValue\n"); + err = TestReadsConstraintsOfAttributeMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads constraints of attribute: MinMeasuredValue\n"); + err = TestReadsConstraintsOfAttributeMinMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads constraints of attribute: Tolerance\n"); + err = TestReadsConstraintsOfAttributeTolerance_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfAttributeMeasuredValue_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of attribute: MeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 10000U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of attribute: MinMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 9999U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfAttributeTolerance_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of attribute: Tolerance Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_RH_2_2 : public TestCommandBridge { +public: + Test_TC_RH_2_2() + : TestCommandBridge("Test_TC_RH_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_RH_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MinMeasuredValue\n"); + err = TestReadsConstraintsOfAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads MeasuredValue attribute from DUT\n"); + if (ShouldSkip("A_RELATIVEHUMIDITY")) { + NextTest(); + return; + } + err = TestReadsMeasuredValueAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the mandatory attribute: MeasuredValue\n"); + if (ShouldSkip("A_RELATIVEHUMIDITY")) { + NextTest(); + return; + } + err = TestReadTheMandatoryAttributeMeasuredValue_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of attribute: MinMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 9999U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 10000U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SWTCH_2_1 : public TestCommandBridge { +public: + Test_TC_SWTCH_2_1() + : TestCommandBridge("Test_TC_SWTCH_2_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_SWTCH_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read NumberOfPositions attribute\n"); + err = TestReadNumberOfPositionsAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read NumberOfPositions attribute\n"); + err = TestReadNumberOfPositionsAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); + err = TestReadCurrentPositionAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentPosition attribute\n"); + err = TestReadCurrentPositionAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read MultiPressMax attribute\n"); + err = TestReadMultiPressMaxAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read MultiPressMax attribute\n"); + err = TestReadMultiPressMaxAttribute_6(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 7; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadNumberOfPositionsAttribute_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read NumberOfPositions attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("number of positions", actualValue, 2)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadNumberOfPositionsAttribute_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read NumberOfPositions attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("numberOfPositions", "", "uint8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("numberOfPositions", [value unsignedCharValue], 2)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentPositionAttribute_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("current position", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentPositionAttribute_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("currentPosition", "", "uint8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("currentPosition", [value unsignedCharValue], 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadMultiPressMaxAttribute_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read MultiPressMax attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("multi press max", actualValue, 2)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadMultiPressMaxAttribute_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read MultiPressMax attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("multiPressMax", "", "uint8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("multiPressMax", [value unsignedCharValue], 2)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SWTCH_2_2 : public TestCommandBridge { +public: + Test_TC_SWTCH_2_2() + : TestCommandBridge("Test_TC_SWTCH_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_SWTCH_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : User interaction needed\n"); + err = TestUserInteractionNeeded_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : User interaction needed\n"); + err = TestUserInteractionNeeded_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); err = TestReadCurrentPositionAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : User interaction needed\n"); - err = TestUserInteractionNeeded_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : User interaction needed\n"); + err = TestUserInteractionNeeded_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : User interaction needed\n"); + err = TestUserInteractionNeeded_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : User interaction needed\n"); + err = TestUserInteractionNeeded_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read CurrentPosition attribute\n"); + err = TestReadCurrentPositionAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : User interaction needed\n"); + err = TestUserInteractionNeeded_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : User interaction needed\n"); + err = TestUserInteractionNeeded_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : User interaction needed\n"); + err = TestUserInteractionNeeded_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : User interaction needed\n"); + err = TestUserInteractionNeeded_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : User interaction needed\n"); + err = TestUserInteractionNeeded_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : User interaction needed\n"); + err = TestUserInteractionNeeded_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : User interaction needed\n"); + err = TestUserInteractionNeeded_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 3000ms\n"); + err = TestWait3000ms_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : User interaction needed\n"); + err = TestUserInteractionNeeded_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : User interaction needed\n"); + err = TestUserInteractionNeeded_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : User interaction needed\n"); + err = TestUserInteractionNeeded_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : User interaction needed\n"); + err = TestUserInteractionNeeded_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : User interaction needed\n"); + err = TestUserInteractionNeeded_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : User interaction needed\n"); + err = TestUserInteractionNeeded_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Wait 3000ms\n"); + err = TestWait3000ms_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : User interaction needed\n"); + err = TestUserInteractionNeeded_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : User interaction needed\n"); + err = TestUserInteractionNeeded_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : User interaction needed\n"); + err = TestUserInteractionNeeded_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : User interaction needed\n"); + err = TestUserInteractionNeeded_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : User interaction needed\n"); + err = TestUserInteractionNeeded_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : User interaction needed\n"); + err = TestUserInteractionNeeded_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : User interaction needed\n"); + err = TestUserInteractionNeeded_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : User interaction needed\n"); + err = TestUserInteractionNeeded_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : User interaction needed\n"); + err = TestUserInteractionNeeded_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : User interaction needed\n"); + err = TestUserInteractionNeeded_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : User interaction needed\n"); + err = TestUserInteractionNeeded_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : User interaction needed\n"); + err = TestUserInteractionNeeded_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : User interaction needed\n"); + err = TestUserInteractionNeeded_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : User interaction needed\n"); + err = TestUserInteractionNeeded_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : User interaction needed\n"); + err = TestUserInteractionNeeded_37(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 38; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_1() + { + UserPrompt(@"Set up subscription to SwitchLatched event"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_2() + { + UserPrompt(@"Operator sets switch to first position"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentPositionAttribute_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("current position", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_4() + { + UserPrompt(@"Operator sets switch to second position"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_5() + { + UserPrompt(@"Set up subscription to InitialPress event"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_6() + { + UserPrompt(@"Operator does not operate switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentPositionAttribute_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("current position", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_8() + { + UserPrompt(@"Operator sets switch to second position"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_9() + { + UserPrompt(@"Operator does not operate switch (release switch)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_10() + { + UserPrompt(@"Set up subscription to InitialPress and ShortRelease events"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_11() + { + UserPrompt(@"Operator does not operate switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_12() + { + UserPrompt(@"Operator operates switch (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_13() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_14() + { + UserPrompt(@"Operator operates switch for 5 seconds"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait3000ms_15() + { + WaitForMs(3000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_16() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_17() + { + UserPrompt(@"Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_18() + { + UserPrompt(@"Operator does not operate switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_19() + { + UserPrompt(@"Operator operates switch (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_20() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_21() + { + UserPrompt(@"Operator operates switch for 5 seconds"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait3000ms_22() + { + WaitForMs(3000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_23() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_24() + { + UserPrompt(@"Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_25() + { + UserPrompt(@"Operator does not operate switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_26() + { + UserPrompt(@"Operator operates switch (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_27() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_28() + { + UserPrompt(@"Operator operates switch (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_29() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_30() + { + UserPrompt(@"Operator operates switch again (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_31() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_32() + { + UserPrompt(@"Operator operates switch again (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_33() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_34() + { + UserPrompt(@"Operator operates switch again (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_35() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_36() + { + UserPrompt(@"Operator operates switch again (press briefly)"); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestUserInteractionNeeded_37() + { + UserPrompt(@"Operator releases switch"); + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TM_1_1 : public TestCommandBridge { +public: + Test_TC_TM_1_1() + : TestCommandBridge("Test_TC_TM_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TM_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TM_2_1 : public TestCommandBridge { +public: + Test_TC_TM_2_1() + : TestCommandBridge("Test_TC_TM_2_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TM_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read the optional attribute: Tolerance\n"); + err = TestReadTheOptionalAttributeTolerance_4(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -27315)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -27314)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeTolerance_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: Tolerance Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TM_2_2 : public TestCommandBridge { +public: + Test_TC_TM_2_2() + : TestCommandBridge("Test_TC_TM_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TM_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads MeasuredValue attribute from DUT\n"); + if (ShouldSkip("A_TEMPERATURE")) { + NextTest(); + return; + } + err = TestReadsMeasuredValueAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute: MeasuredValue\n"); + if (ShouldSkip("A_TEMPERATURE")) { + NextTest(); + return; + } + err = TestReadTheMandatoryAttributeMeasuredValue_4(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -27315)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -27314)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TSTAT_1_1 : public TestCommandBridge { +public: + Test_TC_TSTAT_1_1() + : TestCommandBridge("Test_TC_TSTAT_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TSTAT_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the optional global attribute constraints: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional global attribute constraints: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TSTAT_2_1 : public TestCommandBridge { +public: + Test_TC_TSTAT_2_1() + : TestCommandBridge("Test_TC_TSTAT_2_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TSTAT_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress( + chipTool, " ***** Test Step 1 : Reads constraints of mandatory attributes from DUT: LocalTemperature\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1(); + break; + case 2: + ChipLogProgress( + chipTool, " ***** Test Step 2 : Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7(); + break; + case 8: + ChipLogProgress( + chipTool, " ***** Test Step 8 : Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8(); + break; + case 9: + ChipLogProgress( + chipTool, " ***** Test Step 9 : Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Reads constraints of optional attributes from DUT: MinCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10(); + break; + case 11: + ChipLogProgress( + chipTool, " ***** Test Step 11 : Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads constraints of mandatory attributes from DUT: SystemMode\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13(); + break; + case 14: + ChipLogProgress( + chipTool, " ***** Test Step 14 : Reads constraints of optional attributes from DUT: MinSetpointDeadBand\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads constraints of optional attributes from DUT: StartOfWeek\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15(); + break; + case 16: + ChipLogProgress( + chipTool, " ***** Test Step 16 : Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16(); + break; + case 17: + ChipLogProgress( + chipTool, " ***** Test Step 17 : Reads constraints of optional attributes from DUT: NumberOfDailyTransitions\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 18; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLocalTemperatureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: LocalTemperature Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("localTemperature", "", "int16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAbsMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("absMinHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("absMinHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("absMinHeatSetpointLimit", [value shortValue], 3000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("absMaxHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("absMaxHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("absMaxHeatSetpointLimit", [value shortValue], 3000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("absMinCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("absMinCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("absMinCoolSetpointLimit", [value shortValue], 3200)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("absMaxCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("absMaxCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("absMaxCoolSetpointLimit", [value shortValue], 3200)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", [value shortValue], 2600)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", [value shortValue], 2600)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", [value shortValue], 3000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", [value shortValue], 3000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MinCoolSetpointLimit Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", [value shortValue], 3200)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", [value shortValue], 3200)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster + readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", [value unsignedCharValue], 5)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: SystemMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("systemMode", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("systemMode", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("systemMode", [value unsignedCharValue], 9)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minSetpointDeadBand", "", "int8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minSetpointDeadBand", [value charValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minSetpointDeadBand", [value charValue], 25)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeStartOfWeekWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: StartOfWeek Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("startOfWeek", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("startOfWeek", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("startOfWeek", [value unsignedCharValue], 6)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster + readAttributeNumberOfWeeklyTransitionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("numberOfWeeklyTransitions", "", "uint8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNumberOfDailyTransitionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: NumberOfDailyTransitions Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("numberOfDailyTransitions", "", "uint8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TSTAT_2_2 : public TestCommandBridge { +public: + Test_TC_TSTAT_2_2() + : TestCommandBridge("Test_TC_TSTAT_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TSTAT_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is " + "within range\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestReadsOccupiedCoolingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_1(); + break; + case 2: + ChipLogProgress(chipTool, + " ***** Test Step 2 : Writes a value back that is different but valid for OccupiedCoolingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestWritesAValueBackThatIsDifferentButValidForOccupiedCoolingSetpointAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedCoolingSetpointAttribute_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfMinCoolSetpointLimitToOccupiedCoolingSetpointAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : User interaction needed\n"); - err = TestUserInteractionNeeded_5(); + ChipLogProgress( + chipTool, " ***** Test Step 5 : Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfMaxCoolSetpointLimitToOccupiedCoolingSetpointAttribute_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : User interaction needed\n"); - err = TestUserInteractionNeeded_6(); + ChipLogProgress(chipTool, + " ***** Test Step 6 : Reads OccupiedHeatingSetpoint attribute from Server DUT and verifies that the value is " + "within range\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestReadsOccupiedHeatingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read CurrentPosition attribute\n"); - err = TestReadCurrentPositionAttribute_7(); + ChipLogProgress(chipTool, + " ***** Test Step 7 : Writes a value back that is different but valid for OccupiedHeatingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestWritesAValueBackThatIsDifferentButValidForOccupiedHeatingSetpointAttribute_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : User interaction needed\n"); - err = TestUserInteractionNeeded_8(); + ChipLogProgress(chipTool, + " ***** Test Step 8 : Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedHeatingSetpointAttribute_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : User interaction needed\n"); - err = TestUserInteractionNeeded_9(); + ChipLogProgress( + chipTool, " ***** Test Step 9 : Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfMinHeatSetpointLimitToOccupiedHeatingSetpointAttribute_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : User interaction needed\n"); - err = TestUserInteractionNeeded_10(); + ChipLogProgress( + chipTool, " ***** Test Step 10 : Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint attribute\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfMaxHeatSetpointLimitToOccupiedHeatingSetpointAttribute_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : User interaction needed\n"); - err = TestUserInteractionNeeded_11(); + ChipLogProgress(chipTool, + " ***** Test Step 11 : Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within " + "range\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsMinHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : User interaction needed\n"); - err = TestUserInteractionNeeded_12(); + ChipLogProgress(chipTool, + " ***** Test Step 12 : Writes a value back that is different but valid for MinHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesAValueBackThatIsDifferentButValidForMinHeatSetpointLimitAttribute_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : User interaction needed\n"); - err = TestUserInteractionNeeded_13(); + ChipLogProgress(chipTool, + " ***** Test Step 13 : Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinHeatSetpointLimitAttribute_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : User interaction needed\n"); - err = TestUserInteractionNeeded_14(); + ChipLogProgress( + chipTool, " ***** Test Step 14 : Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfAbsMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 3000ms\n"); - err = TestWait3000ms_15(); + ChipLogProgress( + chipTool, " ***** Test Step 15 : Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : User interaction needed\n"); - err = TestUserInteractionNeeded_16(); + ChipLogProgress(chipTool, + " ***** Test Step 16 : Reads MaxHeatSetpointLimit attribute from Server DUT and verifies that the value is within " + "range\n"); + if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsMaxHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : User interaction needed\n"); - err = TestUserInteractionNeeded_17(); + ChipLogProgress(chipTool, + " ***** Test Step 17 : Writes a value back that is different but valid for MaxHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesAValueBackThatIsDifferentButValidForMaxHeatSetpointLimitAttribute_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : User interaction needed\n"); - err = TestUserInteractionNeeded_18(); + ChipLogProgress(chipTool, + " ***** Test Step 18 : Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxHeatSetpointLimitAttribute_18(); break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : User interaction needed\n"); - err = TestUserInteractionNeeded_19(); + ChipLogProgress( + chipTool, " ***** Test Step 19 : Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfAbsMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_19(); break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : User interaction needed\n"); - err = TestUserInteractionNeeded_20(); + ChipLogProgress( + chipTool, " ***** Test Step 20 : Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_20(); break; case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : User interaction needed\n"); - err = TestUserInteractionNeeded_21(); + ChipLogProgress(chipTool, + " ***** Test Step 21 : Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within " + "range\n"); + if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsMinCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_21(); break; case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Wait 3000ms\n"); - err = TestWait3000ms_22(); + ChipLogProgress(chipTool, + " ***** Test Step 22 : Writes a value back that is different but valid for MinCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesAValueBackThatIsDifferentButValidForMinCoolSetpointLimitAttribute_22(); break; case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : User interaction needed\n"); - err = TestUserInteractionNeeded_23(); + ChipLogProgress(chipTool, + " ***** Test Step 23 : Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinCoolSetpointLimitAttribute_23(); break; case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : User interaction needed\n"); - err = TestUserInteractionNeeded_24(); + ChipLogProgress( + chipTool, " ***** Test Step 24 : Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfAbsMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_24(); break; case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : User interaction needed\n"); - err = TestUserInteractionNeeded_25(); + ChipLogProgress( + chipTool, " ***** Test Step 25 : Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_25(); break; case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : User interaction needed\n"); - err = TestUserInteractionNeeded_26(); + ChipLogProgress(chipTool, + " ***** Test Step 26 : Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within " + "range\n"); + if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsMaxCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_26(); break; case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : User interaction needed\n"); - err = TestUserInteractionNeeded_27(); + ChipLogProgress(chipTool, + " ***** Test Step 27 : Writes a value back that is different but valid for MaxCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesAValueBackThatIsDifferentButValidForMaxCoolSetpointLimitAttribute_27(); break; case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : User interaction needed\n"); - err = TestUserInteractionNeeded_28(); + ChipLogProgress(chipTool, + " ***** Test Step 28 : Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxCoolSetpointLimitAttribute_28(); break; case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : User interaction needed\n"); - err = TestUserInteractionNeeded_29(); + ChipLogProgress( + chipTool, " ***** Test Step 29 : Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfAbsMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_29(); break; case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : User interaction needed\n"); - err = TestUserInteractionNeeded_30(); + ChipLogProgress( + chipTool, " ***** Test Step 30 : Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_30(); break; case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : User interaction needed\n"); - err = TestUserInteractionNeeded_31(); + ChipLogProgress(chipTool, + " ***** Test Step 31 : Writes (sets back) the limit of MinHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_31(); break; case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : User interaction needed\n"); - err = TestUserInteractionNeeded_32(); + ChipLogProgress(chipTool, + " ***** Test Step 32 : Writes (sets back) the limit of MaxHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_32(); break; case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : User interaction needed\n"); - err = TestUserInteractionNeeded_33(); + ChipLogProgress(chipTool, + " ***** Test Step 33 : Writes (sets back) the limit of MinHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_33(); break; case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : User interaction needed\n"); - err = TestUserInteractionNeeded_34(); + ChipLogProgress(chipTool, + " ***** Test Step 34 : Writes (sets back) the limit of MaxHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); + if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_34(); break; case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : User interaction needed\n"); - err = TestUserInteractionNeeded_35(); + ChipLogProgress(chipTool, + " ***** Test Step 35 : Writes (sets back) the limit of MinCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_35(); break; case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : User interaction needed\n"); - err = TestUserInteractionNeeded_36(); + ChipLogProgress(chipTool, + " ***** Test Step 36 : Writes (sets back) the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_36(); break; case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : User interaction needed\n"); - err = TestUserInteractionNeeded_37(); + ChipLogProgress(chipTool, + " ***** Test Step 37 : Writes (sets back) the limit of MinCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_37(); + break; + case 38: + ChipLogProgress(chipTool, + " ***** Test Step 38 : Writes (sets back) the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); + if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { + NextTest(); + return; + } + err = TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_38(); + break; + case 39: + ChipLogProgress(chipTool, + " ***** Test Step 39 : Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid\n"); + if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) { + NextTest(); + return; + } + err = TestReadsControlSequenceOfOperationFromServerDutAndVerifiesThatTheValueIsValid_39(); + break; + case 40: + ChipLogProgress( + chipTool, " ***** Test Step 40 : Write Attribute command for ControlSequenceOfOperation with a new valid value\n"); + if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) { + NextTest(); + return; + } + err = TestWriteAttributeCommandForControlSequenceOfOperationWithANewValidValue_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : Read it back again to confirm the successful write\n"); + if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) { + NextTest(); + return; + } + err = TestReadItBackAgainToConfirmTheSuccessfulWrite_41(); + break; + case 42: + ChipLogProgress(chipTool, " ***** Test Step 42 : Sets OccupiedHeatingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedHeatingSetpointToDefaultValue_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Sets OccupiedHeatingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedHeatingSetpointToDefaultValue_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : Sets OccupiedCoolingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedCoolingSetpointToDefaultValue_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Sets OccupiedCoolingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedCoolingSetpointToDefaultValue_45(); + break; + case 46: + ChipLogProgress(chipTool, " ***** Test Step 46 : Sets OccupiedCoolingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedCoolingSetpointToDefaultValue_46(); + break; + case 47: + ChipLogProgress(chipTool, " ***** Test Step 47 : Sets OccupiedHeatingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedHeatingSetpointToDefaultValue_47(); + break; + case 48: + ChipLogProgress(chipTool, " ***** Test Step 48 : Sets OccupiedCoolingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedCoolingSetpointToDefaultValue_48(); + break; + case 49: + ChipLogProgress(chipTool, " ***** Test Step 49 : Sets OccupiedHeatingSetpoint to default value\n"); + if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { + NextTest(); + return; + } + err = TestSetsOccupiedHeatingSetpointToDefaultValue_49(); break; } - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 50; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsOccupiedCoolingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is within range Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("occupied cooling setpoint", actualValue, 2600)); + } + + VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", [value shortValue], 2600)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForOccupiedCoolingSetpointAttribute_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id occupiedCoolingSetpointArgument; + occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value back that is different but valid for " + @"OccupiedCoolingSetpoint attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedCoolingSetpointAttribute_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("occupied cooling setpoint", actualValue, 2000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesTheLimitOfMinCoolSetpointLimitToOccupiedCoolingSetpointAttribute_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id occupiedCoolingSetpointArgument; + occupiedCoolingSetpointArgument = [NSNumber numberWithShort:1600]; + [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint " + @"attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToOccupiedCoolingSetpointAttribute_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id occupiedCoolingSetpointArgument; + occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; + [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint " + @"attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsOccupiedHeatingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads OccupiedHeatingSetpoint attribute from Server DUT and verifies that the value is within range Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("occupied heating setpoint", actualValue, 2000)); + } + + VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", [value shortValue], 3000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForOccupiedHeatingSetpointAttribute_7() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id occupiedHeatingSetpointArgument; + occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2100]; + [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value back that is different but valid for " + @"OccupiedHeatingSetpoint attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedHeatingSetpointAttribute_8() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("occupied heating setpoint", actualValue, 2100)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesTheLimitOfMinHeatSetpointLimitToOccupiedHeatingSetpointAttribute_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id occupiedHeatingSetpointArgument; + occupiedHeatingSetpointArgument = [NSNumber numberWithShort:700]; + [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint " + @"attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesTheLimitOfMaxHeatSetpointLimitToOccupiedHeatingSetpointAttribute_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id occupiedHeatingSetpointArgument; + occupiedHeatingSetpointArgument = [NSNumber numberWithShort:3000]; + [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint " + @"attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsMinHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("min heat setpoint limit", actualValue, 700)); + } + + VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", [value shortValue], 3000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMinHeatSetpointLimitAttribute_12() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id minHeatSetpointLimitArgument; + minHeatSetpointLimitArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value back that is different but valid for MinHeatSetpointLimit " + @"attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinHeatSetpointLimitAttribute_13() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("min heat setpoint limit", actualValue, 2000)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 38; + CHIP_ERROR TestWritesTheLimitOfAbsMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_14() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + id minHeatSetpointLimitArgument; + minHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; + [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit " + @"attribute Error: %@", + err); - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_15() { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id minHeatSetpointLimitArgument; + minHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; + [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit " + @"attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_1() + CHIP_ERROR TestReadsMaxHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_16() { - UserPrompt(@"Set up subscription to SwitchLatched event"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"Reads MaxHeatSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("max heat setpoint limit", actualValue, 3000)); + } + + VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", [value shortValue], 3000)); + } + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_2() + CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMaxHeatSetpointLimitAttribute_17() { - UserPrompt(@"Operator sets switch to first position"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxHeatSetpointLimitArgument; + maxHeatSetpointLimitArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value back that is different but valid for MaxHeatSetpointLimit " + @"attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadCurrentPositionAttribute_3() + CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxHeatSetpointLimitAttribute_18() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); + [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("current position", actualValue, 0)); + VerifyOrReturn(CheckValue("max heat setpoint limit", actualValue, 2000)); } NextTest(); @@ -28322,38 +34387,132 @@ class Test_TC_SWTCH_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_4() + CHIP_ERROR TestWritesTheLimitOfAbsMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_19() { - UserPrompt(@"Operator sets switch to second position"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxHeatSetpointLimitArgument; + maxHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; + [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit " + @"attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_5() + CHIP_ERROR TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_20() { - UserPrompt(@"Set up subscription to InitialPress event"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxHeatSetpointLimitArgument; + maxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; + [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit " + @"attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_6() + CHIP_ERROR TestReadsMinCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_21() { - UserPrompt(@"Operator does not operate switch"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("min cool setpoint limit", actualValue, 1600)); + } + + VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", [value shortValue], 3200)); + } + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadCurrentPositionAttribute_7() + CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMinCoolSetpointLimitAttribute_22() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentPosition attribute Error: %@", err); + id minCoolSetpointLimitArgument; + minCoolSetpointLimitArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value back that is different but valid for MinCoolSetpointLimit " + @"attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinCoolSetpointLimitAttribute_23() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("current position", actualValue, 0)); + VerifyOrReturn(CheckValue("min cool setpoint limit", actualValue, 2000)); } NextTest(); @@ -28362,499 +34521,661 @@ class Test_TC_SWTCH_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_8() + CHIP_ERROR TestWritesTheLimitOfAbsMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_24() { - UserPrompt(@"Operator sets switch to second position"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id minCoolSetpointLimitArgument; + minCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; + [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit " + @"attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_9() + CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_25() { - UserPrompt(@"Operator does not operate switch (release switch)"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id minCoolSetpointLimitArgument; + minCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; + [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute " + @"Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_10() + CHIP_ERROR TestReadsMaxCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_26() { - UserPrompt(@"Set up subscription to InitialPress and ShortRelease events"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("max cool setpoint limit", actualValue, 3200)); + } + + VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", [value shortValue], 3200)); + } + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_11() + CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMaxCoolSetpointLimitAttribute_27() { - UserPrompt(@"Operator does not operate switch"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxCoolSetpointLimitArgument; + maxCoolSetpointLimitArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value back that is different but valid for MaxCoolSetpointLimit " + @"attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_12() + CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxCoolSetpointLimitAttribute_28() { - UserPrompt(@"Operator operates switch (press briefly)"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("max cool setpoint limit", actualValue, 2000)); + } + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_13() + CHIP_ERROR TestWritesTheLimitOfAbsMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_29() { - UserPrompt(@"Operator releases switch"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxCoolSetpointLimitArgument; + maxCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; + [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit " + @"attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_14() + CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_30() { - UserPrompt(@"Operator operates switch for 5 seconds"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxCoolSetpointLimitArgument; + maxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; + [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute " + @"Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestWait3000ms_15() + CHIP_ERROR TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_31() { - WaitForMs(3000); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id minHeatSetpointLimitArgument; + minHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; + [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MinHeatSetpointLimit to " + @"MinHeatSetpointLimit attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_32() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id minHeatSetpointLimitArgument; + minHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; + [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MaxHeatSetpointLimit to " + @"MinHeatSetpointLimit attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_16() - { - UserPrompt(@"Operator releases switch"); + CHIP_ERROR TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_33() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxHeatSetpointLimitArgument; + maxHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; + [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MinHeatSetpointLimit to " + @"MaxHeatSetpointLimit attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_17() + CHIP_ERROR TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_34() { - UserPrompt(@"Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); - return CHIP_NO_ERROR; - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestUserInteractionNeeded_18() - { - UserPrompt(@"Operator does not operate switch"); - return CHIP_NO_ERROR; - } + id maxHeatSetpointLimitArgument; + maxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; + [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MaxHeatSetpointLimit to " + @"MaxHeatSetpointLimit attribute Error: %@", + err); - CHIP_ERROR TestUserInteractionNeeded_19() - { - UserPrompt(@"Operator operates switch (press briefly)"); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err, 0)); - CHIP_ERROR TestUserInteractionNeeded_20() - { - UserPrompt(@"Operator releases switch"); - return CHIP_NO_ERROR; - } + NextTest(); + }]; - CHIP_ERROR TestUserInteractionNeeded_21() - { - UserPrompt(@"Operator operates switch for 5 seconds"); return CHIP_NO_ERROR; } - CHIP_ERROR TestWait3000ms_22() + CHIP_ERROR TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_35() { - WaitForMs(3000); - return CHIP_NO_ERROR; - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestUserInteractionNeeded_23() - { - UserPrompt(@"Operator releases switch"); - return CHIP_NO_ERROR; - } + id minCoolSetpointLimitArgument; + minCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; + [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MinCoolSetpointLimit to " + @"MinCoolSetpointLimit attribute Error: %@", + err); - CHIP_ERROR TestUserInteractionNeeded_24() - { - UserPrompt(@"Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); - return CHIP_NO_ERROR; - } + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } - CHIP_ERROR TestUserInteractionNeeded_25() - { - UserPrompt(@"Operator does not operate switch"); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err, 0)); - CHIP_ERROR TestUserInteractionNeeded_26() - { - UserPrompt(@"Operator operates switch (press briefly)"); - return CHIP_NO_ERROR; - } + NextTest(); + }]; - CHIP_ERROR TestUserInteractionNeeded_27() - { - UserPrompt(@"Operator releases switch"); return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_28() + CHIP_ERROR TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_36() { - UserPrompt(@"Operator operates switch (press briefly)"); - return CHIP_NO_ERROR; - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestUserInteractionNeeded_29() - { - UserPrompt(@"Operator releases switch"); - return CHIP_NO_ERROR; - } + id minCoolSetpointLimitArgument; + minCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; + [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MaxCoolSetpointLimit to " + @"MinCoolSetpointLimit attribute Error: %@", + err); - CHIP_ERROR TestUserInteractionNeeded_30() - { - UserPrompt(@"Operator operates switch again (press briefly)"); - return CHIP_NO_ERROR; - } + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } - CHIP_ERROR TestUserInteractionNeeded_31() - { - UserPrompt(@"Operator releases switch"); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("status", err, 0)); - CHIP_ERROR TestUserInteractionNeeded_32() - { - UserPrompt(@"Operator operates switch again (press briefly)"); - return CHIP_NO_ERROR; - } + NextTest(); + }]; - CHIP_ERROR TestUserInteractionNeeded_33() - { - UserPrompt(@"Operator releases switch"); return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_34() + CHIP_ERROR TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_37() { - UserPrompt(@"Operator operates switch again (press briefly)"); - return CHIP_NO_ERROR; - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestUserInteractionNeeded_35() - { - UserPrompt(@"Operator releases switch"); - return CHIP_NO_ERROR; - } + id maxCoolSetpointLimitArgument; + maxCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; + [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MinCoolSetpointLimit to " + @"MaxCoolSetpointLimit attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; - CHIP_ERROR TestUserInteractionNeeded_36() - { - UserPrompt(@"Operator operates switch again (press briefly)"); return CHIP_NO_ERROR; } - CHIP_ERROR TestUserInteractionNeeded_37() + CHIP_ERROR TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_38() { - UserPrompt(@"Operator releases switch"); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id maxCoolSetpointLimitArgument; + maxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; + [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes (sets back) the limit of MaxCoolSetpointLimit to " + @"MaxCoolSetpointLimit attribute Error: %@", + err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + return CHIP_NO_ERROR; } -}; -class Test_TC_TM_1_1 : public TestCommandBridge { -public: - Test_TC_TM_1_1() - : TestCommandBridge("Test_TC_TM_1_1") - , mTestIndex(0) + CHIP_ERROR TestReadsControlSequenceOfOperationFromServerDutAndVerifiesThatTheValueIsValid_39() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TM_1_1() {} + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + [cluster + readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid Error: %@", err); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_1_1\n"); - } + VerifyOrReturn(CheckValue("status", err, 0)); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("control sequence of operation", actualValue, 4)); + } - Wait(); + VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", [value unsignedCharValue], 5)); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestWriteAttributeCommandForControlSequenceOfOperationWithANewValidValue_40() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + id controlSequenceOfOperationArgument; + controlSequenceOfOperationArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeControlSequenceOfOperationWithValue:controlSequenceOfOperationArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write Attribute command for ControlSequenceOfOperation with a new " + @"valid value Error: %@", + err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + CHIP_ERROR TestReadItBackAgainToConfirmTheSuccessfulWrite_41() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster + readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read it back again to confirm the successful write Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("control sequence of operation", actualValue, 2)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_42() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + id occupiedHeatingSetpointArgument; + occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } -}; -class Test_TC_TM_2_1 : public TestCommandBridge { -public: - Test_TC_TM_2_1() - : TestCommandBridge("Test_TC_TM_2_1") - , mTestIndex(0) + CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_43() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - ~Test_TC_TM_2_1() {} + id occupiedHeatingSetpointArgument; + occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - /////////// TestCommand Interface ///////// - void NextTest() override + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_44() { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_1\n"); - } + id occupiedCoolingSetpointArgument; + occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; + [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } - Wait(); + VerifyOrReturn(CheckValue("status", err, 0)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the optional attribute: Tolerance\n"); - err = TestReadTheOptionalAttributeTolerance_4(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_45() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + id occupiedCoolingSetpointArgument; + occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; + [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() + CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_46() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + id occupiedCoolingSetpointArgument; + occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; + [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_2() + CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_47() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id occupiedHeatingSetpointArgument; + occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -27315)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_3() + CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_48() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + id occupiedCoolingSetpointArgument; + occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; + [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -27314)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeTolerance_4() + CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_49() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: Tolerance Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); + id occupiedHeatingSetpointArgument; + occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; + [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); - VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } }; -class Test_TC_TM_2_2 : public TestCommandBridge { +class Test_TC_TSUIC_1_1 : public TestCommandBridge { public: - Test_TC_TM_2_2() - : TestCommandBridge("Test_TC_TM_2_2") + Test_TC_TSUIC_1_1() + : TestCommandBridge("Test_TC_TSUIC_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -28863,7 +35184,7 @@ class Test_TC_TM_2_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_TM_2_2() {} + ~Test_TC_TSUIC_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -28871,11 +35192,11 @@ class Test_TC_TM_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -28892,28 +35213,20 @@ class Test_TC_TM_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads MeasuredValue attribute from DUT\n"); - if (ShouldSkip("A_TEMPERATURE")) { - NextTest(); - return; - } - err = TestReadsMeasuredValueAttributeFromDut_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute: MeasuredValue\n"); - if (ShouldSkip("A_TEMPERATURE")) { - NextTest(); - return; - } - err = TestReadTheMandatoryAttributeMeasuredValue_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -28943,94 +35256,76 @@ class Test_TC_TM_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -27315)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); - } - + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -27314)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); - } - + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_4() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; @@ -29038,10 +35333,10 @@ class Test_TC_TM_2_2 : public TestCommandBridge { } }; -class Test_TC_TSTAT_1_1 : public TestCommandBridge { +class Test_TC_TSUIC_2_1 : public TestCommandBridge { public: - Test_TC_TSTAT_1_1() - : TestCommandBridge("Test_TC_TSTAT_1_1") + Test_TC_TSUIC_2_1() + : TestCommandBridge("Test_TC_TSUIC_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -29050,7 +35345,7 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_TSTAT_1_1() {} + ~Test_TC_TSUIC_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29058,11 +35353,11 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29079,16 +35374,28 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: TemperatureDisplayMode\n"); + err = TestReadTheMandatoryAttributeTemperatureDisplayMode_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: TemperatureDisplayMode\n"); + err = TestReadTheMandatoryAttributeTemperatureDisplayMode_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the optional global attribute constraints: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_6(); break; } @@ -29105,7 +35412,7 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 7; chip::Optional mNodeId; chip::Optional mCluster; @@ -29118,65 +35425,160 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("temperature display mode", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("temperatureDisplayMode", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("temperatureDisplayMode", [value unsignedCharValue], 1)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3() + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional global attribute constraints: FeatureMap Error: %@", err); + [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("keypad lockout", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("keypadLockout", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("keypadLockout", [value unsignedCharValue], 5)); + } + NextTest(); }]; return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster + readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("schedule programming visibility", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster + readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("scheduleProgrammingVisibility", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("scheduleProgrammingVisibility", [value unsignedCharValue], 1)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; -class Test_TC_TSTAT_2_1 : public TestCommandBridge { +class Test_TC_TSUIC_2_2 : public TestCommandBridge { public: - Test_TC_TSTAT_2_1() - : TestCommandBridge("Test_TC_TSTAT_2_1") + Test_TC_TSUIC_2_2() + : TestCommandBridge("Test_TC_TSUIC_2_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -29185,7 +35587,7 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_TSTAT_2_1() {} + ~Test_TC_TSUIC_2_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29193,11 +35595,11 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29214,87 +35616,112 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress( - chipTool, " ***** Test Step 1 : Reads constraints of mandatory attributes from DUT: LocalTemperature\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Writes a value of 0 to TemperatureDisplayMode attribute of DUT\n"); + if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { + NextTest(); + return; + } + err = TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_1(); break; case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Writes a value of 1 to TemperatureDisplayMode attribute of DUT\n"); + if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { + NextTest(); + return; + } + err = TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2(); break; case 3: ChipLogProgress( - chipTool, " ***** Test Step 3 : Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3(); + chipTool, " ***** Test Step 3 : Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT\n"); + if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { + NextTest(); + return; + } + err = TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3(); break; case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4(); break; case 5: - ChipLogProgress( - chipTool, " ***** Test Step 5 : Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5(); break; case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6(); break; case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7(); break; case 8: - ChipLogProgress( - chipTool, " ***** Test Step 8 : Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8(); break; case 9: - ChipLogProgress( - chipTool, " ***** Test Step 9 : Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9(); break; case 10: - ChipLogProgress( - chipTool, " ***** Test Step 10 : Reads constraints of optional attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Writes a value of greater than 5 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10(); break; case 11: ChipLogProgress( - chipTool, " ***** Test Step 11 : Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11(); + chipTool, " ***** Test Step 11 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); + if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { + NextTest(); + return; + } + err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11(); break; case 12: ChipLogProgress( - chipTool, " ***** Test Step 12 : Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12(); + chipTool, " ***** Test Step 12 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); + if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { + NextTest(); + return; + } + err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads constraints of mandatory attributes from DUT: SystemMode\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13(); - break; - case 14: - ChipLogProgress( - chipTool, " ***** Test Step 14 : Reads constraints of optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reads constraints of optional attributes from DUT: StartOfWeek\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15(); - break; - case 16: - ChipLogProgress( - chipTool, " ***** Test Step 16 : Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16(); - break; - case 17: - ChipLogProgress( - chipTool, " ***** Test Step 17 : Reads constraints of optional attributes from DUT: NumberOfDailyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17(); + ChipLogProgress(chipTool, + " ***** Test Step 13 : Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT\n"); + if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { + NextTest(); + return; + } + err = TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13(); break; } @@ -29311,7 +35738,7 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 14; chip::Optional mNodeId; chip::Optional mCluster; @@ -29324,451 +35751,401 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1() + CHIP_ERROR TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLocalTemperatureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: LocalTemperature Error: %@", err); + id temperatureDisplayModeArgument; + temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster + writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 0 to TemperatureDisplayMode attribute of DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("localTemperature", "", "int16")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2() + CHIP_ERROR TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAbsMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id temperatureDisplayModeArgument; + temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster + writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 1 to TemperatureDisplayMode attribute of DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("absMinHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("absMinHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("absMinHeatSetpointLimit", [value shortValue], 3000)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3() + CHIP_ERROR TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("absMaxHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("absMaxHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("absMaxHeatSetpointLimit", [value shortValue], 3000)); - } + id temperatureDisplayModeArgument; + temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 1 to TemperatureDisplayMode attribute of " + @"DUT Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4() + CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 0 to KeypadLockout attribute of DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("absMinCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("absMinCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("absMinCoolSetpointLimit", [value shortValue], 3200)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5() + CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 1 to KeypadLockout attribute of DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("absMaxCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("absMaxCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("absMaxCoolSetpointLimit", [value shortValue], 3200)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6() + CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 2 to KeypadLockout attribute of DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", [value shortValue], 2600)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7() + CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:3]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 3 to KeypadLockout attribute of DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", [value shortValue], 2600)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8() + CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:4]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 4 to KeypadLockout attribute of DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", [value shortValue], 3000)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9() + CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:5]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 5 to KeypadLockout attribute of DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", [value shortValue], 3000)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10() + CHIP_ERROR TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", [value shortValue], 3200)); - } + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:6]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 5 to KeypadLockout attribute of DUT Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11() + CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); + id scheduleProgrammingVisibilityArgument; + scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:0]; + [cluster writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 0 to ScheduleProgrammingVisibility attribute of " + @"DUT Error: %@", + err); - VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", [value shortValue], 3200)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12() + CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster - readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + id scheduleProgrammingVisibilityArgument; + scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of 1 to ScheduleProgrammingVisibility attribute of " + @"DUT Error: %@", + err); - VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", [value unsignedCharValue], 5)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13() + CHIP_ERROR TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: SystemMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("systemMode", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("systemMode", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("systemMode", [value unsignedCharValue], 9)); - } + id scheduleProgrammingVisibilityArgument; + scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster + writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 1 to ScheduleProgrammingVisibility " + @"attribute of DUT Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14() +class Test_TC_DIAG_TH_NW_1_1 : public TestCommandBridge { +public: + Test_TC_DIAG_TH_NW_1_1() + : TestCommandBridge("Test_TC_DIAG_TH_NW_1_1") + , mTestIndex(0) { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand Error: %@", err); + ~Test_TC_DIAG_TH_NW_1_1() {} - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturn(CheckValue("status", err, 0)); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_TH_NW_1_1\n"); + } - VerifyOrReturn(CheckConstraintType("minSetpointDeadBand", "", "int8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minSetpointDeadBand", [value charValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minSetpointDeadBand", [value charValue], 25)); - } + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_TH_NW_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - NextTest(); - }]; + Wait(); - return CHIP_NO_ERROR; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Sends ResetCounts command\n"); + err = TestSendsResetCountsCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the Overruncount attribute\n"); + err = TestReadTheOverruncountAttribute_2(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15() + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeStartOfWeekWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: StartOfWeek Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckConstraintType("startOfWeek", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("startOfWeek", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("startOfWeek", [value unsignedCharValue], 6)); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; - NextTest(); - }]; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16() + CHIP_ERROR TestSendsResetCountsCommand_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster - readAttributeNumberOfWeeklyTransitionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster resetCountsWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends ResetCounts command Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("numberOfWeeklyTransitions", "", "uint8")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17() + CHIP_ERROR TestReadTheOverruncountAttribute_2() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNumberOfDailyTransitionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: NumberOfDailyTransitions Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeOverrunCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the Overruncount attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("numberOfDailyTransitions", "", "uint8")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("OverrunCount", actualValue, 0ULL)); + } + NextTest(); }]; @@ -29776,10 +36153,10 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { } }; -class Test_TC_TSTAT_2_2 : public TestCommandBridge { +class Test_TC_DIAG_TH_NW_1_2 : public TestCommandBridge { public: - Test_TC_TSTAT_2_2() - : TestCommandBridge("Test_TC_TSTAT_2_2") + Test_TC_DIAG_TH_NW_1_2() + : TestCommandBridge("Test_TC_DIAG_TH_NW_1_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -29788,7 +36165,7 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_TSTAT_2_2() {} + ~Test_TC_DIAG_TH_NW_1_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29796,11 +36173,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_TH_NW_1_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_TH_NW_1_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29817,442 +36194,409 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is " - "within range\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestReadsOccupiedCoolingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : Writes a value back that is different but valid for OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForOccupiedCoolingSetpointAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedCoolingSetpointAttribute_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfMinCoolSetpointLimitToOccupiedCoolingSetpointAttribute_4(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Validate constraints of attribute: Channel\n"); + err = TestValidateConstraintsOfAttributeChannel_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Validate constraints of attribute: NetworkName\n"); + err = TestValidateConstraintsOfAttributeNetworkName_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Validate constraints of attribute: PanId\n"); + err = TestValidateConstraintsOfAttributePanId_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Validate constraints of attribute: ExtendedPanId\n"); + err = TestValidateConstraintsOfAttributeExtendedPanId_4(); break; case 5: - ChipLogProgress( - chipTool, " ***** Test Step 5 : Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxCoolSetpointLimitToOccupiedCoolingSetpointAttribute_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Validate constraints of attribute: OverrunCount\n"); + err = TestValidateConstraintsOfAttributeOverrunCount_5(); break; case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Reads OccupiedHeatingSetpoint attribute from Server DUT and verifies that the value is " - "within range\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestReadsOccupiedHeatingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : read PartitionId attribute value\n"); + err = TestReadPartitionIdAttributeValue_6(); break; case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Writes a value back that is different but valid for OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForOccupiedHeatingSetpointAttribute_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Validate constraints of attribute: PartitionId\n"); + err = TestValidateConstraintsOfAttributePartitionId_7(); break; case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedHeatingSetpointAttribute_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : read Weighting attribute value\n"); + err = TestReadWeightingAttributeValue_8(); break; case 9: - ChipLogProgress( - chipTool, " ***** Test Step 9 : Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfMinHeatSetpointLimitToOccupiedHeatingSetpointAttribute_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Validate constraints of attribute: weighting\n"); + err = TestValidateConstraintsOfAttributeWeighting_9(); break; case 10: - ChipLogProgress( - chipTool, " ***** Test Step 10 : Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxHeatSetpointLimitToOccupiedHeatingSetpointAttribute_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : read DataVersion attribute value\n"); + err = TestReadDataVersionAttributeValue_10(); break; case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within " - "range\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsMinHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Validate constraints of attribute: DataVersion\n"); + err = TestValidateConstraintsOfAttributeDataVersion_11(); break; case 12: - ChipLogProgress(chipTool, - " ***** Test Step 12 : Writes a value back that is different but valid for MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMinHeatSetpointLimitAttribute_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : read StableDataVersion attribute value\n"); + err = TestReadStableDataVersionAttributeValue_12(); break; case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinHeatSetpointLimitAttribute_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Validate constraints of attribute: StableDataVersion\n"); + err = TestValidateConstraintsOfAttributeStableDataVersion_13(); break; case 14: - ChipLogProgress( - chipTool, " ***** Test Step 14 : Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : read LeaderRouterId attribute value\n"); + err = TestReadLeaderRouterIdAttributeValue_14(); break; case 15: - ChipLogProgress( - chipTool, " ***** Test Step 15 : Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : Validate constraints of attribute: LeaderRouterId\n"); + err = TestValidateConstraintsOfAttributeLeaderRouterId_15(); break; case 16: - ChipLogProgress(chipTool, - " ***** Test Step 16 : Reads MaxHeatSetpointLimit attribute from Server DUT and verifies that the value is within " - "range\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsMaxHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_16(); + ChipLogProgress(chipTool, " ***** Test Step 16 : read DetachedRoleCount attribute value\n"); + err = TestReadDetachedRoleCountAttributeValue_16(); break; case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : Writes a value back that is different but valid for MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMaxHeatSetpointLimitAttribute_17(); + ChipLogProgress(chipTool, " ***** Test Step 17 : Validate constraints of attribute: DetachedRoleCount\n"); + err = TestValidateConstraintsOfAttributeDetachedRoleCount_17(); break; case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxHeatSetpointLimitAttribute_18(); + ChipLogProgress(chipTool, " ***** Test Step 18 : read ChildRoleCount attribute value\n"); + err = TestReadChildRoleCountAttributeValue_18(); break; case 19: - ChipLogProgress( - chipTool, " ***** Test Step 19 : Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_19(); + ChipLogProgress(chipTool, " ***** Test Step 19 : Validate constraints of attribute: ChildRoleCount\n"); + err = TestValidateConstraintsOfAttributeChildRoleCount_19(); break; case 20: - ChipLogProgress( - chipTool, " ***** Test Step 20 : Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_20(); + ChipLogProgress(chipTool, " ***** Test Step 20 : read RouterRoleCount attribute value\n"); + err = TestReadRouterRoleCountAttributeValue_20(); break; case 21: - ChipLogProgress(chipTool, - " ***** Test Step 21 : Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within " - "range\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsMinCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_21(); + ChipLogProgress(chipTool, " ***** Test Step 21 : Validate constraints of attribute: RouterRoleCount\n"); + err = TestValidateConstraintsOfAttributeRouterRoleCount_21(); break; case 22: - ChipLogProgress(chipTool, - " ***** Test Step 22 : Writes a value back that is different but valid for MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMinCoolSetpointLimitAttribute_22(); + ChipLogProgress(chipTool, " ***** Test Step 22 : read LeaderRoleCount attribute value\n"); + err = TestReadLeaderRoleCountAttributeValue_22(); break; case 23: - ChipLogProgress(chipTool, - " ***** Test Step 23 : Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinCoolSetpointLimitAttribute_23(); + ChipLogProgress(chipTool, " ***** Test Step 23 : Validate constraints of attribute: LeaderRoleCount\n"); + err = TestValidateConstraintsOfAttributeLeaderRoleCount_23(); break; case 24: - ChipLogProgress( - chipTool, " ***** Test Step 24 : Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_24(); + ChipLogProgress(chipTool, " ***** Test Step 24 : read AttachAttemptCount attribute value\n"); + err = TestReadAttachAttemptCountAttributeValue_24(); break; case 25: - ChipLogProgress( - chipTool, " ***** Test Step 25 : Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_25(); + ChipLogProgress(chipTool, " ***** Test Step 25 : Validate constraints of attribute: AttachAttemptCount\n"); + err = TestValidateConstraintsOfAttributeAttachAttemptCount_25(); break; case 26: - ChipLogProgress(chipTool, - " ***** Test Step 26 : Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within " - "range\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsMaxCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_26(); + ChipLogProgress(chipTool, " ***** Test Step 26 : read PartitionIdChangeCount attribute value\n"); + err = TestReadPartitionIdChangeCountAttributeValue_26(); break; case 27: - ChipLogProgress(chipTool, - " ***** Test Step 27 : Writes a value back that is different but valid for MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMaxCoolSetpointLimitAttribute_27(); + ChipLogProgress(chipTool, " ***** Test Step 27 : Validate constraints of attribute: PartitionIdChangeCount\n"); + err = TestValidateConstraintsOfAttributePartitionIdChangeCount_27(); break; case 28: - ChipLogProgress(chipTool, - " ***** Test Step 28 : Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxCoolSetpointLimitAttribute_28(); + ChipLogProgress(chipTool, " ***** Test Step 28 : read BetterPartitionAttachAttemptCount attribute value\n"); + err = TestReadBetterPartitionAttachAttemptCountAttributeValue_28(); break; case 29: ChipLogProgress( - chipTool, " ***** Test Step 29 : Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_29(); + chipTool, " ***** Test Step 29 : Validate constraints of attribute: BetterPartitionAttachAttemptCount\n"); + err = TestValidateConstraintsOfAttributeBetterPartitionAttachAttemptCount_29(); break; case 30: - ChipLogProgress( - chipTool, " ***** Test Step 30 : Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_30(); + ChipLogProgress(chipTool, " ***** Test Step 30 : read ParentChangeCount attribute value\n"); + err = TestReadParentChangeCountAttributeValue_30(); break; case 31: - ChipLogProgress(chipTool, - " ***** Test Step 31 : Writes (sets back) the limit of MinHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_31(); + ChipLogProgress(chipTool, " ***** Test Step 31 : Validate constraints of attribute: ParentChangeCount\n"); + err = TestValidateConstraintsOfAttributeParentChangeCount_31(); break; case 32: - ChipLogProgress(chipTool, - " ***** Test Step 32 : Writes (sets back) the limit of MaxHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_32(); + ChipLogProgress(chipTool, " ***** Test Step 32 : read TxTotalCount attribute value\n"); + err = TestReadTxTotalCountAttributeValue_32(); break; case 33: - ChipLogProgress(chipTool, - " ***** Test Step 33 : Writes (sets back) the limit of MinHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_33(); + ChipLogProgress(chipTool, " ***** Test Step 33 : Validate constraints of attribute: TxTotalCount\n"); + err = TestValidateConstraintsOfAttributeTxTotalCount_33(); break; case 34: - ChipLogProgress(chipTool, - " ***** Test Step 34 : Writes (sets back) the limit of MaxHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_34(); + ChipLogProgress(chipTool, " ***** Test Step 34 : read TxUnicastCount attribute value\n"); + err = TestReadTxUnicastCountAttributeValue_34(); break; case 35: - ChipLogProgress(chipTool, - " ***** Test Step 35 : Writes (sets back) the limit of MinCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_35(); + ChipLogProgress(chipTool, " ***** Test Step 35 : Validate constraints of attribute: TxUnicastCount\n"); + err = TestValidateConstraintsOfAttributeTxUnicastCount_35(); break; case 36: - ChipLogProgress(chipTool, - " ***** Test Step 36 : Writes (sets back) the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_36(); + ChipLogProgress(chipTool, " ***** Test Step 36 : read TxBroadcastCount attribute value\n"); + err = TestReadTxBroadcastCountAttributeValue_36(); break; case 37: - ChipLogProgress(chipTool, - " ***** Test Step 37 : Writes (sets back) the limit of MinCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_37(); + ChipLogProgress(chipTool, " ***** Test Step 37 : Validate constraints of attribute: TxBroadcastCount\n"); + err = TestValidateConstraintsOfAttributeTxBroadcastCount_37(); break; case 38: - ChipLogProgress(chipTool, - " ***** Test Step 38 : Writes (sets back) the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_38(); + ChipLogProgress(chipTool, " ***** Test Step 38 : read TxNoAckRequestedCount attribute value\n"); + err = TestReadTxNoAckRequestedCountAttributeValue_38(); break; case 39: - ChipLogProgress(chipTool, - " ***** Test Step 39 : Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid\n"); - if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) { - NextTest(); - return; - } - err = TestReadsControlSequenceOfOperationFromServerDutAndVerifiesThatTheValueIsValid_39(); + ChipLogProgress(chipTool, " ***** Test Step 39 : Validate constraints of attribute: TxNoAckRequestedCount\n"); + err = TestValidateConstraintsOfAttributeTxNoAckRequestedCount_39(); break; case 40: - ChipLogProgress( - chipTool, " ***** Test Step 40 : Write Attribute command for ControlSequenceOfOperation with a new valid value\n"); - if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) { - NextTest(); - return; - } - err = TestWriteAttributeCommandForControlSequenceOfOperationWithANewValidValue_40(); + ChipLogProgress(chipTool, " ***** Test Step 40 : read TxDataCount attribute value\n"); + err = TestReadTxDataCountAttributeValue_40(); break; case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Read it back again to confirm the successful write\n"); - if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) { - NextTest(); - return; - } - err = TestReadItBackAgainToConfirmTheSuccessfulWrite_41(); + ChipLogProgress(chipTool, " ***** Test Step 41 : Validate constraints of attribute: TxDataCount\n"); + err = TestValidateConstraintsOfAttributeTxDataCount_41(); break; case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_42(); + ChipLogProgress(chipTool, " ***** Test Step 42 : read TxDataPollCount attribute value\n"); + err = TestReadTxDataPollCountAttributeValue_42(); break; case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_43(); + ChipLogProgress(chipTool, " ***** Test Step 43 : Validate constraints of attribute: TxDataPollCount\n"); + err = TestValidateConstraintsOfAttributeTxDataPollCount_43(); break; case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_44(); + ChipLogProgress(chipTool, " ***** Test Step 44 : read TxBeaconCount attribute value\n"); + err = TestReadTxBeaconCountAttributeValue_44(); break; case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_45(); + ChipLogProgress(chipTool, " ***** Test Step 45 : Validate constraints of attribute: TxBeaconCount\n"); + err = TestValidateConstraintsOfAttributeTxBeaconCount_45(); break; case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_46(); + ChipLogProgress(chipTool, " ***** Test Step 46 : read TxBeaconRequestCount attribute value\n"); + err = TestReadTxBeaconRequestCountAttributeValue_46(); break; case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_47(); + ChipLogProgress(chipTool, " ***** Test Step 47 : Validate constraints of attribute: TxBeaconRequestCount\n"); + err = TestValidateConstraintsOfAttributeTxBeaconRequestCount_47(); break; case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_48(); + ChipLogProgress(chipTool, " ***** Test Step 48 : read TxOtherCount attribute value\n"); + err = TestReadTxOtherCountAttributeValue_48(); break; case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_49(); + ChipLogProgress(chipTool, " ***** Test Step 49 : Validate constraints of attribute: TxOtherCount\n"); + err = TestValidateConstraintsOfAttributeTxOtherCount_49(); + break; + case 50: + ChipLogProgress(chipTool, " ***** Test Step 50 : read TxRetryCount attribute value\n"); + err = TestReadTxRetryCountAttributeValue_50(); + break; + case 51: + ChipLogProgress(chipTool, " ***** Test Step 51 : Validate constraints of attribute: TxRetryCount\n"); + err = TestValidateConstraintsOfAttributeTxRetryCount_51(); + break; + case 52: + ChipLogProgress(chipTool, " ***** Test Step 52 : read TxDirectMaxRetryExpiryCount attribute value\n"); + err = TestReadTxDirectMaxRetryExpiryCountAttributeValue_52(); + break; + case 53: + ChipLogProgress(chipTool, " ***** Test Step 53 : Validate constraints of attribute: TxDirectMaxRetryExpiryCount\n"); + err = TestValidateConstraintsOfAttributeTxDirectMaxRetryExpiryCount_53(); + break; + case 54: + ChipLogProgress(chipTool, " ***** Test Step 54 : read TxIndirectMaxRetryExpiryCount attribute value\n"); + err = TestReadTxIndirectMaxRetryExpiryCountAttributeValue_54(); + break; + case 55: + ChipLogProgress(chipTool, " ***** Test Step 55 : Validate constraints of attribute: TxIndirectMaxRetryExpiryCount\n"); + err = TestValidateConstraintsOfAttributeTxIndirectMaxRetryExpiryCount_55(); + break; + case 56: + ChipLogProgress(chipTool, " ***** Test Step 56 : read TxErrCcaCount attribute value\n"); + err = TestReadTxErrCcaCountAttributeValue_56(); + break; + case 57: + ChipLogProgress(chipTool, " ***** Test Step 57 : Validate constraints of attribute: TxErrCcaCount\n"); + err = TestValidateConstraintsOfAttributeTxErrCcaCount_57(); + break; + case 58: + ChipLogProgress(chipTool, " ***** Test Step 58 : read TxErrAbortCount attribute value\n"); + err = TestReadTxErrAbortCountAttributeValue_58(); + break; + case 59: + ChipLogProgress(chipTool, " ***** Test Step 59 : Validate constraints of attribute: TxErrAbortCount\n"); + err = TestValidateConstraintsOfAttributeTxErrAbortCount_59(); + break; + case 60: + ChipLogProgress(chipTool, " ***** Test Step 60 : read TxErrBusyChannelCount attribute value\n"); + err = TestReadTxErrBusyChannelCountAttributeValue_60(); + break; + case 61: + ChipLogProgress(chipTool, " ***** Test Step 61 : Validate constraints of attribute: TxErrBusyChannelCount\n"); + err = TestValidateConstraintsOfAttributeTxErrBusyChannelCount_61(); + break; + case 62: + ChipLogProgress(chipTool, " ***** Test Step 62 : read RxTotalCount attribute value\n"); + err = TestReadRxTotalCountAttributeValue_62(); + break; + case 63: + ChipLogProgress(chipTool, " ***** Test Step 63 : Validate constraints of attribute: RxTotalCount\n"); + err = TestValidateConstraintsOfAttributeRxTotalCount_63(); + break; + case 64: + ChipLogProgress(chipTool, " ***** Test Step 64 : read RxUnicastCount attribute value\n"); + err = TestReadRxUnicastCountAttributeValue_64(); + break; + case 65: + ChipLogProgress(chipTool, " ***** Test Step 65 : Validate constraints of attribute: RxUnicastCount\n"); + err = TestValidateConstraintsOfAttributeRxUnicastCount_65(); + break; + case 66: + ChipLogProgress(chipTool, " ***** Test Step 66 : read RxBroadcastCount attribute value\n"); + err = TestReadRxBroadcastCountAttributeValue_66(); + break; + case 67: + ChipLogProgress(chipTool, " ***** Test Step 67 : Validate constraints of attribute: RxBroadcastCount\n"); + err = TestValidateConstraintsOfAttributeRxBroadcastCount_67(); + break; + case 68: + ChipLogProgress(chipTool, " ***** Test Step 68 : read RxDataCount attribute value\n"); + err = TestReadRxDataCountAttributeValue_68(); + break; + case 69: + ChipLogProgress(chipTool, " ***** Test Step 69 : Validate constraints of attribute: RxDataCount\n"); + err = TestValidateConstraintsOfAttributeRxDataCount_69(); + break; + case 70: + ChipLogProgress(chipTool, " ***** Test Step 70 : read RxDataPollCount attribute value\n"); + err = TestReadRxDataPollCountAttributeValue_70(); + break; + case 71: + ChipLogProgress(chipTool, " ***** Test Step 71 : Validate constraints of attribute: RxDataPollCount\n"); + err = TestValidateConstraintsOfAttributeRxDataPollCount_71(); + break; + case 72: + ChipLogProgress(chipTool, " ***** Test Step 72 : read RxBeaconCount attribute value\n"); + err = TestReadRxBeaconCountAttributeValue_72(); + break; + case 73: + ChipLogProgress(chipTool, " ***** Test Step 73 : Validate constraints of attribute: RxBeaconCount\n"); + err = TestValidateConstraintsOfAttributeRxBeaconCount_73(); + break; + case 74: + ChipLogProgress(chipTool, " ***** Test Step 74 : read RxBeaconRequestCount attribute value\n"); + err = TestReadRxBeaconRequestCountAttributeValue_74(); + break; + case 75: + ChipLogProgress(chipTool, " ***** Test Step 75 : Validate constraints of attribute: RxBeaconRequestCount\n"); + err = TestValidateConstraintsOfAttributeRxBeaconRequestCount_75(); + break; + case 76: + ChipLogProgress(chipTool, " ***** Test Step 76 : read RxOtherCount attribute value\n"); + err = TestReadRxOtherCountAttributeValue_76(); + break; + case 77: + ChipLogProgress(chipTool, " ***** Test Step 77 : Validate constraints of attribute: RxOtherCount\n"); + err = TestValidateConstraintsOfAttributeRxOtherCount_77(); + break; + case 78: + ChipLogProgress(chipTool, " ***** Test Step 78 : read RxAddressFilteredCount attribute value\n"); + err = TestReadRxAddressFilteredCountAttributeValue_78(); + break; + case 79: + ChipLogProgress(chipTool, " ***** Test Step 79 : Validate constraints of attribute: RxAddressFilteredCount\n"); + err = TestValidateConstraintsOfAttributeRxAddressFilteredCount_79(); + break; + case 80: + ChipLogProgress(chipTool, " ***** Test Step 80 : read RxDestAddrFilteredCount attribute value\n"); + err = TestReadRxDestAddrFilteredCountAttributeValue_80(); + break; + case 81: + ChipLogProgress(chipTool, " ***** Test Step 81 : Validate constraints of attribute: RxDestAddrFilteredCount\n"); + err = TestValidateConstraintsOfAttributeRxDestAddrFilteredCount_81(); + break; + case 82: + ChipLogProgress(chipTool, " ***** Test Step 82 : read RxDuplicatedCount attribute value\n"); + err = TestReadRxDuplicatedCountAttributeValue_82(); + break; + case 83: + ChipLogProgress(chipTool, " ***** Test Step 83 : Validate constraints of attribute: RxDuplicatedCount\n"); + err = TestValidateConstraintsOfAttributeRxDuplicatedCount_83(); + break; + case 84: + ChipLogProgress(chipTool, " ***** Test Step 84 : read RxErrNoFrameCount attribute value\n"); + err = TestReadRxErrNoFrameCountAttributeValue_84(); + break; + case 85: + ChipLogProgress(chipTool, " ***** Test Step 85 : Validate constraints of attribute: RxErrNoFrameCount\n"); + err = TestValidateConstraintsOfAttributeRxErrNoFrameCount_85(); + break; + case 86: + ChipLogProgress(chipTool, " ***** Test Step 86 : read RxErrUnknownNeighborCount attribute value\n"); + err = TestReadRxErrUnknownNeighborCountAttributeValue_86(); + break; + case 87: + ChipLogProgress(chipTool, " ***** Test Step 87 : Validate constraints of attribute: RxErrUnknownNeighborCount\n"); + err = TestValidateConstraintsOfAttributeRxErrUnknownNeighborCount_87(); + break; + case 88: + ChipLogProgress(chipTool, " ***** Test Step 88 : read RxErrInvalidScrAddrCount attribute value\n"); + err = TestReadRxErrInvalidScrAddrCountAttributeValue_88(); + break; + case 89: + ChipLogProgress(chipTool, " ***** Test Step 89 : Validate constraints of attribute: RxErrInvalidSrcAddrCount\n"); + err = TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_89(); + break; + case 90: + ChipLogProgress(chipTool, " ***** Test Step 90 : read RxErrSecCount attribute value\n"); + err = TestReadRxErrSecCountAttributeValue_90(); + break; + case 91: + ChipLogProgress(chipTool, " ***** Test Step 91 : Validate constraints of attribute: RxErrInvalidSrcAddrCount\n"); + err = TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_91(); + break; + case 92: + ChipLogProgress(chipTool, " ***** Test Step 92 : read RxErrFcsCount attribute value\n"); + err = TestReadRxErrFcsCountAttributeValue_92(); + break; + case 93: + ChipLogProgress(chipTool, " ***** Test Step 93 : Validate constraints of attribute: RxErrFcsCount\n"); + err = TestValidateConstraintsOfAttributeRxErrFcsCount_93(); + break; + case 94: + ChipLogProgress(chipTool, " ***** Test Step 94 : read RxErrOtherCount attribute value\n"); + err = TestReadRxErrOtherCountAttributeValue_94(); + break; + case 95: + ChipLogProgress(chipTool, " ***** Test Step 95 : Validate constraints of attribute: RxErrOtherCount\n"); + err = TestValidateConstraintsOfAttributeRxErrOtherCount_95(); + break; + case 96: + ChipLogProgress(chipTool, " ***** Test Step 96 : read ActiveTimestamp attribute value\n"); + err = TestReadActiveTimestampAttributeValue_96(); + break; + case 97: + ChipLogProgress(chipTool, " ***** Test Step 97 : Validate constraints of attribute: ActiveTimestamp\n"); + err = TestValidateConstraintsOfAttributeActiveTimestamp_97(); + break; + case 98: + ChipLogProgress(chipTool, " ***** Test Step 98 : read PendingTimestamp attribute value\n"); + err = TestReadPendingTimestampAttributeValue_98(); + break; + case 99: + ChipLogProgress(chipTool, " ***** Test Step 99 : Validate constraints of attribute: PendingTimestamp\n"); + err = TestValidateConstraintsOfAttributePendingTimestamp_99(); + break; + case 100: + ChipLogProgress(chipTool, " ***** Test Step 100 : read Delay attribute value\n"); + err = TestReadDelayAttributeValue_100(); + break; + case 101: + ChipLogProgress(chipTool, " ***** Test Step 101 : Validate constraints of attribute: delay\n"); + err = TestValidateConstraintsOfAttributeDelay_101(); break; } @@ -30269,7 +36613,7 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 50; + const uint16_t mTestCount = 102; chip::Optional mNodeId; chip::Optional mCluster; @@ -30282,34 +36626,123 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOccupiedCoolingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_1() + CHIP_ERROR TestValidateConstraintsOfAttributeChannel_1() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is within range Error: %@", - err); + [cluster readAttributeChannelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: Channel Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("channel", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestValidateConstraintsOfAttributeNetworkName_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNetworkNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: NetworkName Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("networkName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("networkName", [value length], 16)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestValidateConstraintsOfAttributePanId_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePanIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: PanId Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("panId", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestValidateConstraintsOfAttributeExtendedPanId_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExtendedPanIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: ExtendedPanId Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("extendedPanId", "", "uint64")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestValidateConstraintsOfAttributeOverrunCount_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOverrunCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: OverrunCount Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("overrunCount", "", "uint64")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadPartitionIdAttributeValue_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePartitionIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read PartitionId attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("occupied cooling setpoint", actualValue, 2600)); - } - - VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", [value shortValue], 2600)); + VerifyOrReturn(CheckValue("PartitionId", actualValue, 0UL)); } NextTest(); @@ -30318,52 +36751,42 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForOccupiedCoolingSetpointAttribute_2() + CHIP_ERROR TestValidateConstraintsOfAttributePartitionId_7() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value back that is different but valid for " - @"OccupiedCoolingSetpoint attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributePartitionIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: PartitionId Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("partitionId", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedCoolingSetpointAttribute_3() + CHIP_ERROR TestReadWeightingAttributeValue_8() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeWeightingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read Weighting attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("occupied cooling setpoint", actualValue, 2000)); + VerifyOrReturn(CheckValue("weighting", actualValue, 0)); } NextTest(); @@ -30372,83 +36795,86 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfMinCoolSetpointLimitToOccupiedCoolingSetpointAttribute_4() + CHIP_ERROR TestValidateConstraintsOfAttributeWeighting_9() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint " - @"attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeWeightingWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: weighting Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("weighting", "", "uint8")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToOccupiedCoolingSetpointAttribute_5() + CHIP_ERROR TestReadDataVersionAttributeValue_10() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint " - @"attribute Error: %@", - err); + [cluster readAttributeDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read DataVersion attribute value Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("DataVersion", actualValue, 0)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOccupiedHeatingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_6() + CHIP_ERROR TestValidateConstraintsOfAttributeDataVersion_11() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads OccupiedHeatingSetpoint attribute from Server DUT and verifies that the value is within range Error: %@", - err); + [cluster readAttributeDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: DataVersion Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("dataVersion", "", "uint8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadStableDataVersionAttributeValue_12() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeStableDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read StableDataVersion attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("occupied heating setpoint", actualValue, 2000)); - } - - VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", [value shortValue], 3000)); + VerifyOrReturn(CheckValue("StableDataVersion", actualValue, 0)); } NextTest(); @@ -30457,42 +36883,42 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForOccupiedHeatingSetpointAttribute_7() + CHIP_ERROR TestValidateConstraintsOfAttributeStableDataVersion_13() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2100]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value back that is different but valid for " - @"OccupiedHeatingSetpoint attribute Error: %@", - err); + [cluster readAttributeStableDataVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: StableDataVersion Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("stableDataVersion", "", "uint8")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedHeatingSetpointAttribute_8() + CHIP_ERROR TestReadLeaderRouterIdAttributeValue_14() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute Error: %@", err); + [cluster readAttributeLeaderRouterIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read LeaderRouterId attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("occupied heating setpoint", actualValue, 2100)); + VerifyOrReturn(CheckValue("LeaderRouterId", actualValue, 0)); } NextTest(); @@ -30501,73 +36927,86 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfMinHeatSetpointLimitToOccupiedHeatingSetpointAttribute_9() + CHIP_ERROR TestValidateConstraintsOfAttributeLeaderRouterId_15() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint " - @"attribute Error: %@", - err); + [cluster readAttributeLeaderRouterIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: LeaderRouterId Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("leaderRouterId", "", "uint8")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfMaxHeatSetpointLimitToOccupiedHeatingSetpointAttribute_10() + CHIP_ERROR TestReadDetachedRoleCountAttributeValue_16() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint " - @"attribute Error: %@", - err); + [cluster readAttributeDetachedRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read DetachedRoleCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("DetachedRoleCount", actualValue, 0U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMinHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_11() + CHIP_ERROR TestValidateConstraintsOfAttributeDetachedRoleCount_17() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog( - @"Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + [cluster readAttributeDetachedRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: DetachedRoleCount Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("detachedRoleCount", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadChildRoleCountAttributeValue_18() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChildRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read ChildRoleCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("min heat setpoint limit", actualValue, 700)); - } - - VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", [value shortValue], 3000)); + VerifyOrReturn(CheckValue("ChildRoleCount", actualValue, 0U)); } NextTest(); @@ -30576,42 +37015,42 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMinHeatSetpointLimitAttribute_12() + CHIP_ERROR TestValidateConstraintsOfAttributeChildRoleCount_19() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value back that is different but valid for MinHeatSetpointLimit " - @"attribute Error: %@", - err); + [cluster readAttributeChildRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: ChildRoleCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("childRoleCount", "", "uint16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinHeatSetpointLimitAttribute_13() + CHIP_ERROR TestReadRouterRoleCountAttributeValue_20() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute Error: %@", err); + [cluster readAttributeRouterRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RouterRoleCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("min heat setpoint limit", actualValue, 2000)); + VerifyOrReturn(CheckValue("RouterRoleCount", actualValue, 0U)); } NextTest(); @@ -30620,73 +37059,86 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfAbsMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_14() + CHIP_ERROR TestValidateConstraintsOfAttributeRouterRoleCount_21() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit " - @"attribute Error: %@", - err); + [cluster readAttributeRouterRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RouterRoleCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("routerRoleCount", "", "uint16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_15() + CHIP_ERROR TestReadLeaderRoleCountAttributeValue_22() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit " - @"attribute Error: %@", - err); + [cluster readAttributeLeaderRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read LeaderRoleCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("LeaderRoleCount", actualValue, 0U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMaxHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_16() + CHIP_ERROR TestValidateConstraintsOfAttributeLeaderRoleCount_23() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog( - @"Reads MaxHeatSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + [cluster readAttributeLeaderRoleCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: LeaderRoleCount Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("leaderRoleCount", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadAttachAttemptCountAttributeValue_24() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttachAttemptCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read AttachAttemptCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("max heat setpoint limit", actualValue, 3000)); - } - - VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", [value shortValue], 3000)); + VerifyOrReturn(CheckValue("AttachAttemptCount", actualValue, 0U)); } NextTest(); @@ -30695,42 +37147,42 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMaxHeatSetpointLimitAttribute_17() + CHIP_ERROR TestValidateConstraintsOfAttributeAttachAttemptCount_25() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value back that is different but valid for MaxHeatSetpointLimit " - @"attribute Error: %@", - err); + [cluster readAttributeAttachAttemptCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: AttachAttemptCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("attachAttemptCount", "", "uint16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxHeatSetpointLimitAttribute_18() + CHIP_ERROR TestReadPartitionIdChangeCountAttributeValue_26() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute Error: %@", err); + [cluster readAttributePartitionIdChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read PartitionIdChangeCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("max heat setpoint limit", actualValue, 2000)); + VerifyOrReturn(CheckValue("PartitionIdChangeCount", actualValue, 0U)); } NextTest(); @@ -30739,78 +37191,88 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfAbsMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_19() + CHIP_ERROR TestValidateConstraintsOfAttributePartitionIdChangeCount_27() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit " - @"attribute Error: %@", - err); + [cluster readAttributePartitionIdChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: PartitionIdChangeCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("partitionIdChangeCount", "", "uint16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_20() + CHIP_ERROR TestReadBetterPartitionAttachAttemptCountAttributeValue_28() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit " - @"attribute Error: %@", - err); + [cluster readAttributeBetterPartitionAttachAttemptCountWithCompletionHandler:^( + NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read BetterPartitionAttachAttemptCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("BetterPartitionAttachAttemptCount", actualValue, 0U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMinCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_21() + CHIP_ERROR TestValidateConstraintsOfAttributeBetterPartitionAttachAttemptCount_29() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog( - @"Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + [cluster readAttributeBetterPartitionAttachAttemptCountWithCompletionHandler:^( + NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: BetterPartitionAttachAttemptCount Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("betterPartitionAttachAttemptCount", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadParentChangeCountAttributeValue_30() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeParentChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read ParentChangeCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("min cool setpoint limit", actualValue, 1600)); - } - - VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", [value shortValue], 3200)); + VerifyOrReturn(CheckValue("ParentChangeCount", actualValue, 0U)); } NextTest(); @@ -30819,52 +37281,42 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMinCoolSetpointLimitAttribute_22() + CHIP_ERROR TestValidateConstraintsOfAttributeParentChangeCount_31() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value back that is different but valid for MinCoolSetpointLimit " - @"attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeParentChangeCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: ParentChangeCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("parentChangeCount", "", "uint16")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinCoolSetpointLimitAttribute_23() + CHIP_ERROR TestReadTxTotalCountAttributeValue_32() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxTotalCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("min cool setpoint limit", actualValue, 2000)); + VerifyOrReturn(CheckValue("TxTotalCount", actualValue, 0UL)); } NextTest(); @@ -30873,88 +37325,86 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfAbsMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_24() + CHIP_ERROR TestValidateConstraintsOfAttributeTxTotalCount_33() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit " - @"attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxTotalCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txTotalCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_25() + CHIP_ERROR TestReadTxUnicastCountAttributeValue_34() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute " - @"Error: %@", - err); + [cluster readAttributeTxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxUnicastCount attribute value Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxUnicastCount", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + CHIP_ERROR TestValidateConstraintsOfAttributeTxUnicastCount_35() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturn(CheckValue("status", err, 0)); + [cluster readAttributeTxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxUnicastCount Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("txUnicastCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMaxCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_26() + CHIP_ERROR TestReadTxBroadcastCountAttributeValue_36() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog( - @"Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxBroadcastCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("max cool setpoint limit", actualValue, 3200)); - } - - VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", [value shortValue], 3200)); + VerifyOrReturn(CheckValue("TxBroadcastCount", actualValue, 0UL)); } NextTest(); @@ -30963,52 +37413,42 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMaxCoolSetpointLimitAttribute_27() + CHIP_ERROR TestValidateConstraintsOfAttributeTxBroadcastCount_37() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value back that is different but valid for MaxCoolSetpointLimit " - @"attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxBroadcastCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txBroadcastCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxCoolSetpointLimitAttribute_28() + CHIP_ERROR TestReadTxNoAckRequestedCountAttributeValue_38() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxNoAckRequestedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxNoAckRequestedCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("max cool setpoint limit", actualValue, 2000)); + VerifyOrReturn(CheckValue("TxNoAckRequestedCount", actualValue, 0UL)); } NextTest(); @@ -31017,781 +37457,662 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfAbsMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_29() + CHIP_ERROR TestValidateConstraintsOfAttributeTxNoAckRequestedCount_39() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit " - @"attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxNoAckRequestedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxNoAckRequestedCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txNoAckRequestedCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_30() + CHIP_ERROR TestReadTxDataCountAttributeValue_40() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute " - @"Error: %@", - err); + [cluster readAttributeTxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxDataCount attribute value Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxDataCount", actualValue, 0UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_31() + CHIP_ERROR TestValidateConstraintsOfAttributeTxDataCount_41() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MinHeatSetpointLimit to " - @"MinHeatSetpointLimit attribute Error: %@", - err); + [cluster readAttributeTxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxDataCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txDataCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_32() + CHIP_ERROR TestReadTxDataPollCountAttributeValue_42() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MaxHeatSetpointLimit to " - @"MinHeatSetpointLimit attribute Error: %@", - err); + [cluster readAttributeTxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxDataPollCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxDataPollCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_33() + CHIP_ERROR TestValidateConstraintsOfAttributeTxDataPollCount_43() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MinHeatSetpointLimit to " - @"MaxHeatSetpointLimit attribute Error: %@", - err); + [cluster readAttributeTxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxDataPollCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txDataPollCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_34() + CHIP_ERROR TestReadTxBeaconCountAttributeValue_44() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MaxHeatSetpointLimit to " - @"MaxHeatSetpointLimit attribute Error: %@", - err); + [cluster readAttributeTxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxBeaconCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxBeaconCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_35() + CHIP_ERROR TestValidateConstraintsOfAttributeTxBeaconCount_45() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MinCoolSetpointLimit to " - @"MinCoolSetpointLimit attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxBeaconCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txBeaconCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_36() + CHIP_ERROR TestReadTxBeaconRequestCountAttributeValue_46() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MaxCoolSetpointLimit to " - @"MinCoolSetpointLimit attribute Error: %@", - err); + [cluster readAttributeTxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxBeaconRequestCount attribute value Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxBeaconRequestCount", actualValue, 0UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_37() + CHIP_ERROR TestValidateConstraintsOfAttributeTxBeaconRequestCount_47() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MinCoolSetpointLimit to " - @"MaxCoolSetpointLimit attribute Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeTxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxBeaconRequestCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txBeaconRequestCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_38() + CHIP_ERROR TestReadTxOtherCountAttributeValue_48() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes (sets back) the limit of MaxCoolSetpointLimit to " - @"MaxCoolSetpointLimit attribute Error: %@", - err); + [cluster readAttributeTxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxOtherCount attribute value Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxOtherCount", actualValue, 0UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsControlSequenceOfOperationFromServerDutAndVerifiesThatTheValueIsValid_39() + CHIP_ERROR TestValidateConstraintsOfAttributeTxOtherCount_49() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster - readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("control sequence of operation", actualValue, 4)); - } + [cluster readAttributeTxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxOtherCount Error: %@", err); - VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", [value unsignedCharValue], 5)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txOtherCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteAttributeCommandForControlSequenceOfOperationWithANewValidValue_40() + CHIP_ERROR TestReadTxRetryCountAttributeValue_50() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id controlSequenceOfOperationArgument; - controlSequenceOfOperationArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster writeAttributeControlSequenceOfOperationWithValue:controlSequenceOfOperationArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write Attribute command for ControlSequenceOfOperation with a new " - @"valid value Error: %@", - err); + [cluster readAttributeTxRetryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxRetryCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxRetryCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadItBackAgainToConfirmTheSuccessfulWrite_41() + CHIP_ERROR TestValidateConstraintsOfAttributeTxRetryCount_51() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster - readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read it back again to confirm the successful write Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + [cluster readAttributeTxRetryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxRetryCount Error: %@", err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("control sequence of operation", actualValue, 2)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txRetryCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_42() + CHIP_ERROR TestReadTxDirectMaxRetryExpiryCountAttributeValue_52() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); + [cluster + readAttributeTxDirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxDirectMaxRetryExpiryCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxDirectMaxRetryExpiryCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_43() + CHIP_ERROR TestValidateConstraintsOfAttributeTxDirectMaxRetryExpiryCount_53() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); + [cluster + readAttributeTxDirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxDirectMaxRetryExpiryCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txDirectMaxRetryExpiryCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_44() + CHIP_ERROR TestReadTxIndirectMaxRetryExpiryCountAttributeValue_54() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + [cluster + readAttributeTxIndirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxIndirectMaxRetryExpiryCount attribute value Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxIndirectMaxRetryExpiryCount", actualValue, 0UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_45() + CHIP_ERROR TestValidateConstraintsOfAttributeTxIndirectMaxRetryExpiryCount_55() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster + readAttributeTxIndirectMaxRetryExpiryCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxIndirectMaxRetryExpiryCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txIndirectMaxRetryExpiryCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_46() + CHIP_ERROR TestReadTxErrCcaCountAttributeValue_56() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + [cluster readAttributeTxErrCcaCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxErrCcaCount attribute value Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxErrCcaCount", actualValue, 0UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_47() + CHIP_ERROR TestValidateConstraintsOfAttributeTxErrCcaCount_57() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); + [cluster readAttributeTxErrCcaCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxErrCcaCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txErrCcaCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_48() + CHIP_ERROR TestReadTxErrAbortCountAttributeValue_58() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + [cluster readAttributeTxErrAbortCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxErrAbortCount attribute value Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxErrAbortCount", actualValue, 0UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_49() + CHIP_ERROR TestValidateConstraintsOfAttributeTxErrAbortCount_59() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sets OccupiedHeatingSetpoint to default value Error: %@", err); + [cluster readAttributeTxErrAbortCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxErrAbortCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("txErrAbortCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } -}; - -class Test_TC_TSUIC_1_1 : public TestCommandBridge { -public: - Test_TC_TSUIC_1_1() - : TestCommandBridge("Test_TC_TSUIC_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_1_1() {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadTxErrBusyChannelCountAttributeValue_60() { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_1_1\n"); - } + [cluster readAttributeTxErrBusyChannelCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read TxErrBusyChannelCount attribute value Error: %@", err); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - Wait(); + { + id actualValue = value; + VerifyOrReturn(CheckValue("TxErrBusyChannelCount", actualValue, 0UL)); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestValidateConstraintsOfAttributeTxErrBusyChannelCount_61() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + [cluster readAttributeTxErrBusyChannelCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: TxErrBusyChannelCount Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("txErrBusyChannelCount", "", "uint32")); + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + CHIP_ERROR TestReadRxTotalCountAttributeValue_62() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeRxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxTotalCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxTotalCount", actualValue, 0UL)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + CHIP_ERROR TestValidateConstraintsOfAttributeRxTotalCount_63() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeRxTotalCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxTotalCount Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("rxTotalCount", "", "uint32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + CHIP_ERROR TestReadRxUnicastCountAttributeValue_64() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster readAttributeRxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxUnicastCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxUnicastCount", actualValue, 0UL)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + CHIP_ERROR TestValidateConstraintsOfAttributeRxUnicastCount_65() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + [cluster readAttributeRxUnicastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxUnicastCount Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + VerifyOrReturn(CheckConstraintType("rxUnicastCount", "", "uint32")); NextTest(); }]; return CHIP_NO_ERROR; } -}; - -class Test_TC_TSUIC_2_1 : public TestCommandBridge { -public: - Test_TC_TSUIC_2_1() - : TestCommandBridge("Test_TC_TSUIC_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_2_1() {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadRxBroadcastCountAttributeValue_66() { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_1\n"); - } + [cluster readAttributeRxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxBroadcastCount attribute value Error: %@", err); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - Wait(); + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxBroadcastCount", actualValue, 0UL)); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_6(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestValidateConstraintsOfAttributeRxBroadcastCount_67() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; + [cluster readAttributeRxBroadcastCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxBroadcastCount Error: %@", err); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rxBroadcastCount", "", "uint32")); + NextTest(); + }]; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_1() + CHIP_ERROR TestReadRxDataCountAttributeValue_68() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); + [cluster readAttributeRxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxDataCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("temperature display mode", actualValue, 0)); + VerifyOrReturn(CheckValue("RxDataCount", actualValue, 0UL)); } NextTest(); @@ -31800,47 +38121,42 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_2() + CHIP_ERROR TestValidateConstraintsOfAttributeRxDataCount_69() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); + [cluster readAttributeRxDataCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxDataCount Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("temperatureDisplayMode", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("temperatureDisplayMode", [value unsignedCharValue], 1)); - } - + VerifyOrReturn(CheckConstraintType("rxDataCount", "", "uint32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_3() + CHIP_ERROR TestReadRxDataPollCountAttributeValue_70() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + [cluster readAttributeRxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxDataPollCount attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("keypad lockout", actualValue, 0)); + VerifyOrReturn(CheckValue("RxDataPollCount", actualValue, 0UL)); } NextTest(); @@ -31849,619 +38165,601 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_4() + CHIP_ERROR TestValidateConstraintsOfAttributeRxDataPollCount_71() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + [cluster readAttributeRxDataPollCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxDataPollCount Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("keypadLockout", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("keypadLockout", [value unsignedCharValue], 5)); - } - + VerifyOrReturn(CheckConstraintType("rxDataPollCount", "", "uint32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_5() + CHIP_ERROR TestReadRxBeaconCountAttributeValue_72() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + [cluster readAttributeRxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxBeaconCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("schedule programming visibility", actualValue, 0)); - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxBeaconCount", actualValue, 0UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_6() + CHIP_ERROR TestValidateConstraintsOfAttributeRxBeaconCount_73() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); + [cluster readAttributeRxBeaconCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxBeaconCount Error: %@", err); - VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("scheduleProgrammingVisibility", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("scheduleProgrammingVisibility", [value unsignedCharValue], 1)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rxBeaconCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } -}; -class Test_TC_TSUIC_2_2 : public TestCommandBridge { -public: - Test_TC_TSUIC_2_2() - : TestCommandBridge("Test_TC_TSUIC_2_2") - , mTestIndex(0) + CHIP_ERROR TestReadRxBeaconRequestCountAttributeValue_74() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - ~Test_TC_TSUIC_2_2() {} + [cluster readAttributeRxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxBeaconRequestCount attribute value Error: %@", err); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("status", err, 0)); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_2\n"); - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxBeaconRequestCount", actualValue, 0UL)); + } - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + NextTest(); + }]; - Wait(); + return CHIP_NO_ERROR; + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Writes a value of 0 to TemperatureDisplayMode attribute of DUT\n"); - if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { - NextTest(); - return; - } - err = TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Writes a value of 1 to TemperatureDisplayMode attribute of DUT\n"); - if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { - NextTest(); - return; - } - err = TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT\n"); - if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { - NextTest(); - return; - } - err = TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { - NextTest(); - return; - } - err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { - NextTest(); - return; - } - err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { - NextTest(); - return; - } - err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { - NextTest(); - return; - } - err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { - NextTest(); - return; - } - err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { - NextTest(); - return; - } - err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Writes a value of greater than 5 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { - NextTest(); - return; - } - err = TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10(); - break; - case 11: - ChipLogProgress( - chipTool, " ***** Test Step 11 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); - if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { - NextTest(); - return; - } - err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11(); - break; - case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); - if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { - NextTest(); - return; - } - err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12(); - break; - case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT\n"); - if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { - NextTest(); - return; - } - err = TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13(); - break; - } + CHIP_ERROR TestValidateConstraintsOfAttributeRxBeaconRequestCount_75() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRxBeaconRequestCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxBeaconRequestCount Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rxBeaconRequestCount", "", "uint32")); + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestReadRxOtherCountAttributeValue_76() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxOtherCount attribute value Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxOtherCount", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + CHIP_ERROR TestValidateConstraintsOfAttributeRxOtherCount_77() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + [cluster readAttributeRxOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxOtherCount Error: %@", err); - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rxOtherCount", "", "uint32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadRxAddressFilteredCountAttributeValue_78() { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRxAddressFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxAddressFilteredCount attribute value Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxAddressFilteredCount", actualValue, 0UL)); + } + + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_1() + CHIP_ERROR TestValidateConstraintsOfAttributeRxAddressFilteredCount_79() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id temperatureDisplayModeArgument; - temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 0 to TemperatureDisplayMode attribute of DUT Error: %@", err); + [cluster readAttributeRxAddressFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxAddressFilteredCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rxAddressFilteredCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2() + CHIP_ERROR TestReadRxDestAddrFilteredCountAttributeValue_80() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id temperatureDisplayModeArgument; - temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster - writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 1 to TemperatureDisplayMode attribute of DUT Error: %@", err); + [cluster readAttributeRxDestAddrFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxDestAddrFilteredCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxDestAddrFilteredCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3() + CHIP_ERROR TestValidateConstraintsOfAttributeRxDestAddrFilteredCount_81() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id temperatureDisplayModeArgument; - temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of greater than 1 to TemperatureDisplayMode attribute of " - @"DUT Error: %@", - err); + [cluster readAttributeRxDestAddrFilteredCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxDestAddrFilteredCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rxDestAddrFilteredCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4() + CHIP_ERROR TestReadRxDuplicatedCountAttributeValue_82() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 0 to KeypadLockout attribute of DUT Error: %@", err); + [cluster readAttributeRxDuplicatedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxDuplicatedCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxDuplicatedCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5() + CHIP_ERROR TestValidateConstraintsOfAttributeRxDuplicatedCount_83() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 1 to KeypadLockout attribute of DUT Error: %@", err); + [cluster readAttributeRxDuplicatedCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxDuplicatedCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rxDuplicatedCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6() + CHIP_ERROR TestReadRxErrNoFrameCountAttributeValue_84() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 2 to KeypadLockout attribute of DUT Error: %@", err); + [cluster readAttributeRxErrNoFrameCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxErrNoFrameCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxErrNoFrameCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7() + CHIP_ERROR TestValidateConstraintsOfAttributeRxErrNoFrameCount_85() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:3]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 3 to KeypadLockout attribute of DUT Error: %@", err); + [cluster readAttributeRxErrNoFrameCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxErrNoFrameCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rxErrNoFrameCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8() + CHIP_ERROR TestReadRxErrUnknownNeighborCountAttributeValue_86() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:4]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 4 to KeypadLockout attribute of DUT Error: %@", err); + [cluster + readAttributeRxErrUnknownNeighborCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxErrUnknownNeighborCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxErrUnknownNeighborCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9() + CHIP_ERROR TestValidateConstraintsOfAttributeRxErrUnknownNeighborCount_87() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:5]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 5 to KeypadLockout attribute of DUT Error: %@", err); + [cluster + readAttributeRxErrUnknownNeighborCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxErrUnknownNeighborCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rxErrUnknownNeighborCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10() + CHIP_ERROR TestReadRxErrInvalidScrAddrCountAttributeValue_88() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:6]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of greater than 5 to KeypadLockout attribute of DUT Error: %@", err); + [cluster readAttributeRxErrInvalidSrcAddrCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxErrInvalidScrAddrCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxErrInvalidSrcAddrCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11() + CHIP_ERROR TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_89() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 0 to ScheduleProgrammingVisibility attribute of " - @"DUT Error: %@", - err); + [cluster readAttributeRxErrInvalidSrcAddrCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxErrInvalidSrcAddrCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rxErrInvalidSrcAddrCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12() + CHIP_ERROR TestReadRxErrSecCountAttributeValue_90() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of 1 to ScheduleProgrammingVisibility attribute of " - @"DUT Error: %@", - err); + [cluster readAttributeRxErrSecCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxErrSecCount attribute value Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxErrSecCount", actualValue, 0UL)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13() + CHIP_ERROR TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_91() { CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:2]; - [cluster - writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes a value of greater than 1 to ScheduleProgrammingVisibility " - @"attribute of DUT Error: %@", - err); + [cluster readAttributeRxErrSecCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxErrInvalidSrcAddrCount Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rxErrSecCount", "", "uint32")); + NextTest(); + }]; return CHIP_NO_ERROR; } -}; -class Test_TC_DIAG_TH_NW_1_1 : public TestCommandBridge { -public: - Test_TC_DIAG_TH_NW_1_1() - : TestCommandBridge("Test_TC_DIAG_TH_NW_1_1") - , mTestIndex(0) + CHIP_ERROR TestReadRxErrFcsCountAttributeValue_92() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRxErrFcsCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxErrFcsCount attribute value Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxErrFcsCount", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - ~Test_TC_DIAG_TH_NW_1_1() {} + CHIP_ERROR TestValidateConstraintsOfAttributeRxErrFcsCount_93() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - /////////// TestCommand Interface ///////// - void NextTest() override + [cluster readAttributeRxErrFcsCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxErrFcsCount Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rxErrFcsCount", "", "uint32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadRxErrOtherCountAttributeValue_94() { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_TH_NW_1_1\n"); - } + [cluster readAttributeRxErrOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read RxErrOtherCount attribute value Error: %@", err); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_TH_NW_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - Wait(); + { + id actualValue = value; + VerifyOrReturn(CheckValue("RxErrOtherCount", actualValue, 0UL)); + } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sends ResetCounts command\n"); - err = TestSendsResetCountsCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the Overruncount attribute\n"); - err = TestReadTheOverruncountAttribute_2(); - break; - } + NextTest(); + }]; - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + CHIP_ERROR TestValidateConstraintsOfAttributeRxErrOtherCount_95() { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRxErrOtherCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: RxErrOtherCount Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rxErrOtherCount", "", "uint32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + CHIP_ERROR TestReadActiveTimestampAttributeValue_96() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + [cluster readAttributeActiveTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read ActiveTimestamp attribute value Error: %@", err); - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ActiveTimestamp", actualValue, 0ULL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestValidateConstraintsOfAttributeActiveTimestamp_97() { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeActiveTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: ActiveTimestamp Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("activeTimestamp", "", "uint64")); + NextTest(); + }]; + return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsResetCountsCommand_1() + CHIP_ERROR TestReadPendingTimestampAttributeValue_98() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device @@ -32469,18 +38767,23 @@ class Test_TC_DIAG_TH_NW_1_1 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster resetCountsWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends ResetCounts command Error: %@", err); + [cluster readAttributePendingTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read PendingTimestamp attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("PendingTimestamp", actualValue, 0ULL)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOverruncountAttribute_2() + CHIP_ERROR TestValidateConstraintsOfAttributePendingTimestamp_99() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device @@ -32488,14 +38791,34 @@ class Test_TC_DIAG_TH_NW_1_1 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOverrunCountWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the Overruncount attribute Error: %@", err); + [cluster readAttributePendingTimestampWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: PendingTimestamp Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("pendingTimestamp", "", "uint64")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadDelayAttributeValue_100() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDelayWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read Delay attribute value Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OverrunCount", actualValue, 0ULL)); + VerifyOrReturn(CheckValue("delay", actualValue, 0UL)); } NextTest(); @@ -32503,6 +38826,26 @@ class Test_TC_DIAG_TH_NW_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestValidateConstraintsOfAttributeDelay_101() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThreadNetworkDiagnostics * cluster = [[CHIPTestThreadNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDelayWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Validate constraints of attribute: delay Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("delay", "", "uint32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; class Test_TC_WIFIDIAG_1_1 : public TestCommandBridge { @@ -56139,7 +62482,12 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -56148,6 +62496,17 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -56171,6 +62530,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -56179,12 +62540,14 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -56200,6 +62563,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 021c0fec5bb7da..6a353b575ccfce 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -72,9 +72,12 @@ class TestList : public Command printf("Test_TC_FLW_1_1\n"); printf("Test_TC_FLW_2_1\n"); printf("Test_TC_FLW_2_2\n"); + printf("Test_TC_GC_1_1\n"); printf("Test_TC_I_1_1\n"); printf("Test_TC_I_2_1\n"); + printf("Test_TC_I_2_3\n"); printf("Test_TC_ILL_1_1\n"); + printf("Test_TC_ILL_2_1\n"); printf("Test_TC_LVL_1_1\n"); printf("Test_TC_LVL_2_1\n"); printf("Test_TC_LVL_2_2\n"); @@ -117,6 +120,9 @@ class TestList : public Command printf("Test_TC_MC_7_2\n"); printf("Test_TC_MC_8_1\n"); printf("Test_TC_MC_9_1\n"); + printf("Test_TC_MC_10_1\n"); + printf("Test_TC_MOD_1_1\n"); + printf("Test_TC_MF_1_4\n"); printf("Test_TC_OCC_1_1\n"); printf("Test_TC_OCC_2_1\n"); printf("Test_TC_OCC_2_2\n"); @@ -262,15 +268,12 @@ class ManualTestList : public Command printf("Test_TC_DIAG_LOG_1_3\n"); printf("Test_TC_DESC_1_1\n"); printf("Test_TC_ETHDIAG_1_2\n"); - printf("Test_TC_GC_1_1\n"); printf("Test_TC_GC_1_2\n"); printf("Test_TC_GC_1_3\n"); printf("Test_TC_GENDIAG_1_1\n"); printf("Test_TC_GENDIAG_1_2\n"); printf("Test_TC_GENDIAG_2_1\n"); printf("Test_TC_I_2_2\n"); - printf("Test_TC_I_2_3\n"); - printf("Test_TC_ILL_2_1\n"); printf("Test_TC_ILL_2_2\n"); printf("Test_TC_IDM_1_1\n"); printf("Test_TC_IDM_1_2\n"); @@ -291,7 +294,6 @@ class ManualTestList : public Command printf("Test_TC_MC_4_1\n"); printf("Test_TC_MC_8_2\n"); printf("Test_TC_MC_9_2\n"); - printf("Test_TC_MC_10_1\n"); printf("Test_TC_MC_10_2\n"); printf("Test_TC_MC_10_3\n"); printf("Test_TC_MC_10_4\n"); @@ -299,7 +301,7 @@ class ManualTestList : public Command printf("Test_TC_MC_10_6\n"); printf("Test_TC_MF_1_1\n"); printf("Test_TC_MF_1_2\n"); - printf("Test_TC_MF_1_4\n"); + printf("Test_TC_MF_1_3\n"); printf("Test_TC_MF_1_5\n"); printf("Test_TC_MF_1_6\n"); printf("Test_TC_MF_1_7\n"); @@ -324,7 +326,6 @@ class ManualTestList : public Command printf("Test_TC_MF_1_26\n"); printf("Test_TC_MF_1_27\n"); printf("Test_TC_MF_1_28\n"); - printf("Test_TC_MOD_1_1\n"); printf("Test_TC_MOD_1_2\n"); printf("Test_TC_MOD_2_1\n"); printf("Test_TC_MOD_2_2\n"); @@ -21971,11 +21972,11 @@ class Test_TC_FLW_2_2Suite : public TestCommand } }; -class Test_TC_I_1_1Suite : public TestCommand +class Test_TC_GC_1_1Suite : public TestCommand { public: - Test_TC_I_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_I_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_GC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_GC_1_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -21983,7 +21984,7 @@ class Test_TC_I_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_I_1_1Suite() {} + ~Test_TC_GC_1_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -21992,12 +21993,12 @@ class Test_TC_I_1_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_GC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -22015,20 +22016,24 @@ class Test_TC_I_1_1Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of ClusterRevision attribute\n"); - err = TestReadsConstraintsOfClusterRevisionAttribute_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads the BreadCrumb Attribute from the DUT\n"); + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH1 writes the BreadCrumb attribute as 1 to the DUT\n"); + err = TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : TH1 reads the BreadCrumb attribute from the DUT\n"); + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : TH1 reads the RegulatoryConfig attribute from the DUT\n"); + err = TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH1 reads the LocationCapability attribute from the DUT\n"); + err = TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5(); break; } @@ -22046,7 +22051,7 @@ class Test_TC_I_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 6; chip::Optional mNodeId; chip::Optional mCluster; @@ -22063,44 +22068,51 @@ class Test_TC_I_1_1Suite : public TestCommand static void OnFailureCallback_1(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); + (static_cast(context))->OnFailureResponse_1(error); } - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_1(void * context, uint64_t breadcrumb) { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); + (static_cast(context))->OnSuccessResponse_1(breadcrumb); } static void OnFailureCallback_2(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); + (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } + static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } static void OnFailureCallback_3(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); + (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) + static void OnSuccessCallback_3(void * context, uint64_t breadcrumb) { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); + (static_cast(context))->OnSuccessResponse_3(breadcrumb); } static void OnFailureCallback_4(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); + (static_cast(context))->OnFailureResponse_4(error); } static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType regulatoryConfig) { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); + (static_cast(context))->OnSuccessResponse_4(regulatoryConfig); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context, + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType locationCapability) + { + (static_cast(context))->OnSuccessResponse_5(locationCapability); } // @@ -22113,13 +22125,13 @@ class Test_TC_I_1_1Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsConstraintsOfClusterRevisionAttribute_1() + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::GeneralCommissioningClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_1, OnFailureCallback_1, true)); return CHIP_NO_ERROR; } @@ -22130,20 +22142,24 @@ class Test_TC_I_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_1(uint16_t clusterRevision) + void OnSuccessResponse_1(uint64_t breadcrumb) { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + VerifyOrReturn(CheckValue("breadcrumb", breadcrumb, 0ULL)); + NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + CHIP_ERROR TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::GeneralCommissioningClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + uint64_t breadcrumbArgument; + breadcrumbArgument = 1ULL; + + ReturnErrorOnFailure(cluster.WriteAttribute( + breadcrumbArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); return CHIP_NO_ERROR; } @@ -22153,19 +22169,15 @@ class Test_TC_I_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } + void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::GeneralCommissioningClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } @@ -22176,202 +22188,69 @@ class Test_TC_I_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_I_2_1Suite : public TestCommand -{ -public: - Test_TC_I_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_I_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_I_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); - err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); - err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override + void OnSuccessResponse_3(uint64_t breadcrumb) { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + VerifyOrReturn(CheckValue("breadcrumb", breadcrumb, 1ULL)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); NextTest(); } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t identifyTime) - { - (static_cast(context))->OnSuccessResponse_1(identifyTime); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4() { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t identifyType) - { - (static_cast(context))->OnSuccessResponse_2(identifyType); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::GeneralCommissioningClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_1(CHIP_ERROR error) + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_1(uint16_t identifyTime) + void OnSuccessResponse_4(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType regulatoryConfig) { - VerifyOrReturn(CheckConstraintType("identifyTime", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("regulatoryConfig", regulatoryConfig, 0)); + VerifyOrReturn(CheckConstraintMaxValue("regulatoryConfig", regulatoryConfig, 2)); NextTest(); } - CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() + CHIP_ERROR TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::GeneralCommissioningClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_2(CHIP_ERROR error) + void OnFailureResponse_5(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t identifyType) + void OnSuccessResponse_5(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType locationCapability) { - VerifyOrReturn(CheckConstraintType("identifyType", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("identifyType", identifyType, 0)); - VerifyOrReturn(CheckConstraintMaxValue("identifyType", identifyType, 5)); + VerifyOrReturn(CheckConstraintMinValue("locationCapability", locationCapability, 0)); + VerifyOrReturn(CheckConstraintMaxValue("locationCapability", locationCapability, 2)); NextTest(); } }; -class Test_TC_ILL_1_1Suite : public TestCommand +class Test_TC_I_1_1Suite : public TestCommand { public: - Test_TC_ILL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ILL_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_I_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_I_1_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -22379,7 +22258,7 @@ class Test_TC_ILL_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ILL_1_1Suite() {} + ~Test_TC_I_1_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -22388,12 +22267,12 @@ class Test_TC_ILL_1_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -22411,8 +22290,961 @@ class Test_TC_ILL_1_1Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of ClusterRevision attribute\n"); + err = TestReadsConstraintsOfClusterRevisionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) + { + (static_cast(context))->OnSuccessResponse_2(attributeList); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) + { + (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) + { + (static_cast(context))->OnSuccessResponse_4(generatedCommandList); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR TestReadsConstraintsOfClusterRevisionAttribute_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IdentifyClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1(uint16_t clusterRevision) + { + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IdentifyClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) + { + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IdentifyClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) + { + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IdentifyClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) + { + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + } +}; + +class Test_TC_I_2_1Suite : public TestCommand +{ +public: + Test_TC_I_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_I_2_1", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_I_2_1Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); + err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); + err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, uint16_t identifyTime) + { + (static_cast(context))->OnSuccessResponse_1(identifyTime); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, uint8_t identifyType) + { + (static_cast(context))->OnSuccessResponse_2(identifyType); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IdentifyClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1(uint16_t identifyTime) + { + VerifyOrReturn(CheckConstraintType("identifyTime", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IdentifyClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(uint8_t identifyType) + { + VerifyOrReturn(CheckConstraintType("identifyType", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("identifyType", identifyType, 0)); + VerifyOrReturn(CheckConstraintMaxValue("identifyType", identifyType, 5)); + NextTest(); + } +}; + +class Test_TC_I_2_3Suite : public TestCommand +{ +public: + Test_TC_I_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_I_2_3", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_I_2_3Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : 1.Wait for the commissioned device to be retrieved\n"); + err = Test1WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0x00 blink and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Manually check DUT executes a blink effect\n"); + err = TestManuallyCheckDutExecutesABlinkEffect_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0x01 breathe and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : check DUT executes a breathe effect\n"); + err = TestCheckDutExecutesABreatheEffect_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0x02 okay and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : check DUT executes an okay effect\n"); + err = TestCheckDutExecutesAnOkayEffect_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0x0b channel change and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : check DUT executes a channel change effect\n"); + err = TestCheckDutExecutesAChannelChangeEffect_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0x01 breathe and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : check DUT executes a breathe effect\n"); + err = TestCheckDutExecutesABreatheEffect_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0xfe finish effect and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Manually check DUT stops the breathe effect after the current effect sequence\n"); + err = TestManuallyCheckDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0x01 breathe and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Manually check DUT executes a breathe effect\n"); + err = TestManuallyCheckDutExecutesABreatheEffect_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0xff stop effect and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Check DUT stops the breathe effect as soon as possible.\n"); + err = TestCheckDutStopsTheBreatheEffectAsSoonAsPossible_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0x00 blink and the effect variant field set to 0x42 unknown\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Check DUT executes a blink effect.\n"); + err = TestCheckDutExecutesABlinkEffect_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : TH sends TriggerEffect command to DUT with the effect identifier field set to " + "0xff stop effect and the effect variant field set to 0x00 default\n"); + err = + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check DUT stops any effect that may be still running as soon as possible\n"); + err = TestCheckDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 21; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR Test1WaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(0); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_1(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestManuallyCheckDutExecutesABlinkEffect_2() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a blink effect"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(1); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_3(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR TestCheckDutExecutesABreatheEffect_4() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a breathe effect"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(2); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_5(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR TestCheckDutExecutesAnOkayEffect_6() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes an okay effect"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(11); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_7(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestCheckDutExecutesAChannelChangeEffect_8() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a channel change effect"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(1); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_9(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestCheckDutExecutesABreatheEffect_10() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a breathe effect"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(254); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_11(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestManuallyCheckDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT stops the breathe effect after the current effect sequence"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(1); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_13(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_13() { NextTest(); } + + CHIP_ERROR TestManuallyCheckDutExecutesABreatheEffect_14() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a breathe effect"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(255); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_15(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_15(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_15() { NextTest(); } + + CHIP_ERROR TestCheckDutStopsTheBreatheEffectAsSoonAsPossible_16() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT stops the breathe effect as soon as possible"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(0); + request.effectVariant = static_cast(66); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_17(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_17(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_17(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_17() { NextTest(); } + + CHIP_ERROR TestCheckDutExecutesABlinkEffect_18() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a blink effect"); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + + RequestType request; + request.effectIdentifier = static_cast(255); + request.effectVariant = static_cast(0); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_19(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_19(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_19(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_19() { NextTest(); } + + CHIP_ERROR TestCheckDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT stops any effect that may be still running as soon as possible"); + } +}; + +class Test_TC_ILL_1_1Suite : public TestCommand +{ +public: + Test_TC_ILL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ILL_1_1", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ILL_1_1Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); @@ -22606,6 +23438,248 @@ class Test_TC_ILL_1_1Suite : public TestCommand } }; +class Test_TC_ILL_2_1Suite : public TestCommand +{ +public: + Test_TC_ILL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ILL_2_1", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ILL_2_1Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); + err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); + err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads Tolerance attribute from DUT\n"); + err = TestThReadsToleranceAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads LightSensorType attribute from DUT\n"); + err = TestThReadsLightSensorTypeAttributeFromDut_4(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, uint16_t tolerance) + { + (static_cast(context))->OnSuccessResponse_3(tolerance); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, const chip::app::DataModel::Nullable & lightSensorType) + { + (static_cast(context))->OnSuccessResponse_4(lightSensorType); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IlluminanceMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1(const chip::app::DataModel::Nullable & minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 65533U)); + NextTest(); + } + + CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IlluminanceMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(const chip::app::DataModel::Nullable & maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", maxMeasuredValue, 2U)); + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", maxMeasuredValue, 65534U)); + NextTest(); + } + + CHIP_ERROR TestThReadsToleranceAttributeFromDut_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IlluminanceMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(uint16_t tolerance) + { + VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("tolerance", tolerance, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("tolerance", tolerance, 2048U)); + NextTest(); + } + + CHIP_ERROR TestThReadsLightSensorTypeAttributeFromDut_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::IlluminanceMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::Nullable & lightSensorType) + { + VerifyOrReturn(CheckConstraintType("lightSensorType", "", "enum8")); + NextTest(); + } +}; + class Test_TC_LVL_1_1Suite : public TestCommand { public: @@ -28896,11 +29970,436 @@ class Test_TC_MC_3_2Suite : public TestCommand } }; -class Test_TC_MC_3_3Suite : public TestCommand +class Test_TC_MC_3_3Suite : public TestCommand +{ +public: + Test_TC_MC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_3", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MC_3_3Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } +}; + +class Test_TC_MC_3_4Suite : public TestCommand +{ +public: + Test_TC_MC_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_4", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MC_3_4Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } +}; + +class Test_TC_MC_3_5Suite : public TestCommand +{ +public: + Test_TC_MC_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_5", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MC_3_5Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } +}; + +class Test_TC_MC_3_6Suite : public TestCommand +{ +public: + Test_TC_MC_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_6", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MC_3_6Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } +}; + +class Test_TC_MC_3_7Suite : public TestCommand +{ +public: + Test_TC_MC_3_7Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_7", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MC_3_7Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } +}; + +class Test_TC_MC_3_8Suite : public TestCommand { public: - Test_TC_MC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_3", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_3_8Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_8", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -28908,7 +30407,7 @@ class Test_TC_MC_3_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_3Suite() {} + ~Test_TC_MC_3_8Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -28917,12 +30416,12 @@ class Test_TC_MC_3_3Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -28981,11 +30480,11 @@ class Test_TC_MC_3_3Suite : public TestCommand } }; -class Test_TC_MC_3_4Suite : public TestCommand +class Test_TC_MC_3_9Suite : public TestCommand { public: - Test_TC_MC_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_4", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_3_9Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_9", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -28993,7 +30492,7 @@ class Test_TC_MC_3_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_4Suite() {} + ~Test_TC_MC_3_9Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29002,12 +30501,12 @@ class Test_TC_MC_3_4Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29066,11 +30565,11 @@ class Test_TC_MC_3_4Suite : public TestCommand } }; -class Test_TC_MC_3_5Suite : public TestCommand +class Test_TC_MC_3_10Suite : public TestCommand { public: - Test_TC_MC_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_5", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_10", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29078,7 +30577,7 @@ class Test_TC_MC_3_5Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_5Suite() {} + ~Test_TC_MC_3_10Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29087,12 +30586,12 @@ class Test_TC_MC_3_5Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29151,11 +30650,11 @@ class Test_TC_MC_3_5Suite : public TestCommand } }; -class Test_TC_MC_3_6Suite : public TestCommand +class Test_TC_MC_3_11Suite : public TestCommand { public: - Test_TC_MC_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_6", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_3_11", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29163,7 +30662,7 @@ class Test_TC_MC_3_6Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_6Suite() {} + ~Test_TC_MC_3_11Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29172,12 +30671,12 @@ class Test_TC_MC_3_6Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29236,11 +30735,11 @@ class Test_TC_MC_3_6Suite : public TestCommand } }; -class Test_TC_MC_3_7Suite : public TestCommand +class Test_TC_MC_5_1Suite : public TestCommand { public: - Test_TC_MC_3_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_7", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_5_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29248,7 +30747,7 @@ class Test_TC_MC_3_7Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_7Suite() {} + ~Test_TC_MC_5_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29257,12 +30756,12 @@ class Test_TC_MC_3_7Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29279,6 +30778,10 @@ class Test_TC_MC_3_7Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the ChannelList attribute from the DUT\n"); + err = TestReadsTheChannelListAttributeFromTheDut_1(); + break; } if (CHIP_NO_ERROR != err) @@ -29295,7 +30798,7 @@ class Test_TC_MC_3_7Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 2; chip::Optional mNodeId; chip::Optional mCluster; @@ -29310,89 +30813,16 @@ class Test_TC_MC_3_7Suite : public TestCommand NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_8Suite : public TestCommand -{ -public: - Test_TC_MC_3_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_8", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_8Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override + static void OnFailureCallback_1(void * context, CHIP_ERROR error) { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + (static_cast(context))->OnFailureResponse_1(error); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + static void OnSuccessCallback_1( + void * context, + const chip::app::DataModel::DecodableList & channelList) { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); + (static_cast(context))->OnSuccessResponse_1(channelList); } // @@ -29404,98 +30834,37 @@ class Test_TC_MC_3_8Suite : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } -}; -class Test_TC_MC_3_9Suite : public TestCommand -{ -public: - Test_TC_MC_3_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_9", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_9Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadsTheChannelListAttributeFromTheDut_1() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ChannelClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; } - chip::System::Clock::Timeout GetWaitDuration() const override + void OnFailureResponse_1(CHIP_ERROR error) { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + chip::app::StatusIB status(error); + ThrowFailureResponse(); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + void OnSuccessResponse_1( + const chip::app::DataModel::DecodableList & channelList) { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + VerifyOrReturn(CheckConstraintType("channelList", "", "list")); NextTest(); } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } }; -class Test_TC_MC_3_10Suite : public TestCommand +class Test_TC_MC_5_2Suite : public TestCommand { public: - Test_TC_MC_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_10", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_5_2", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29503,7 +30872,7 @@ class Test_TC_MC_3_10Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_10Suite() {} + ~Test_TC_MC_5_2Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29512,12 +30881,12 @@ class Test_TC_MC_3_10Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29534,6 +30903,10 @@ class Test_TC_MC_3_10Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); + break; } if (CHIP_NO_ERROR != err) @@ -29550,7 +30923,7 @@ class Test_TC_MC_3_10Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 2; chip::Optional mNodeId; chip::Optional mCluster; @@ -29574,13 +30947,19 @@ class Test_TC_MC_3_10Suite : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } + + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("verify that the channel has changed on the device."); + } }; -class Test_TC_MC_3_11Suite : public TestCommand +class Test_TC_MC_5_3Suite : public TestCommand { public: - Test_TC_MC_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_11", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_5_3", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29588,7 +30967,7 @@ class Test_TC_MC_3_11Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_11Suite() {} + ~Test_TC_MC_5_3Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29597,12 +30976,12 @@ class Test_TC_MC_3_11Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29619,6 +30998,10 @@ class Test_TC_MC_3_11Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); + break; } if (CHIP_NO_ERROR != err) @@ -29635,7 +31018,7 @@ class Test_TC_MC_3_11Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 2; chip::Optional mNodeId; chip::Optional mCluster; @@ -29659,13 +31042,19 @@ class Test_TC_MC_3_11Suite : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } + + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("verify that the channel has changed on the device"); + } }; -class Test_TC_MC_5_1Suite : public TestCommand +class Test_TC_MC_6_1Suite : public TestCommand { public: - Test_TC_MC_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_5_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_6_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29673,7 +31062,7 @@ class Test_TC_MC_5_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_5_1Suite() {} + ~Test_TC_MC_6_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29682,12 +31071,12 @@ class Test_TC_MC_5_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29705,8 +31094,24 @@ class Test_TC_MC_5_1Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the ChannelList attribute from the DUT\n"); - err = TestReadsTheChannelListAttributeFromTheDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); + err = TestLogACommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the playback state attribute\n"); + err = TestReadsThePlaybackStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); + err = TestLogACommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); break; } @@ -29724,7 +31129,7 @@ class Test_TC_MC_5_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 6; chip::Optional mNodeId; chip::Optional mCluster; @@ -29739,16 +31144,14 @@ class Test_TC_MC_5_1Suite : public TestCommand NextTest(); } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); + (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & channelList) + static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) { - (static_cast(context))->OnSuccessResponse_1(channelList); + (static_cast(context))->OnSuccessResponse_3(currentState); } // @@ -29761,36 +31164,60 @@ class Test_TC_MC_5_1Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsTheChannelListAttributeFromTheDut_1() + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + + CHIP_ERROR TestLogACommand_2() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is playing"); + } + + CHIP_ERROR TestReadsThePlaybackStateAttribute_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; + chip::Controller::MediaPlaybackClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_1(CHIP_ERROR error) + void OnFailureResponse_3(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & channelList) + void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) { - VerifyOrReturn(CheckConstraintType("channelList", "", "list")); + VerifyOrReturn(CheckValue("currentState", currentState, 0)); + NextTest(); } + + CHIP_ERROR TestLogACommand_4() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is paused"); + } + + CHIP_ERROR TestLogACommand_5() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is stoped"); + } }; -class Test_TC_MC_5_2Suite : public TestCommand +class Test_TC_MC_6_2Suite : public TestCommand { public: - Test_TC_MC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_5_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_6_2", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29798,7 +31225,7 @@ class Test_TC_MC_5_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_5_2Suite() {} + ~Test_TC_MC_6_2Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29807,12 +31234,12 @@ class Test_TC_MC_5_2Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29833,6 +31260,34 @@ class Test_TC_MC_5_2Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); err = TestLogACommand_1(); break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); + err = TestLogACommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); + err = TestLogACommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : log a command\n"); + err = TestLogACommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); + err = TestLogACommand_8(); + break; } if (CHIP_NO_ERROR != err) @@ -29849,7 +31304,7 @@ class Test_TC_MC_5_2Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 9; chip::Optional mNodeId; chip::Optional mCluster; @@ -29864,6 +31319,16 @@ class Test_TC_MC_5_2Suite : public TestCommand NextTest(); } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + { + (static_cast(context))->OnSuccessResponse_3(currentState); + } + // // Tests methods // @@ -29877,15 +31342,75 @@ class Test_TC_MC_5_2Suite : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("verify that the channel has changed on the device."); + return UserPrompt("Verify that media is paused"); + } + + CHIP_ERROR TestLogACommand_2() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is playing"); + } + + CHIP_ERROR TestReadsTheCurrentStateAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + { + VerifyOrReturn(CheckValue("currentState", currentState, 0)); + + NextTest(); + } + + CHIP_ERROR TestLogACommand_4() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is started over"); + } + + CHIP_ERROR TestLogACommand_5() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the next media item in the queue has been loaded"); + } + + CHIP_ERROR TestLogACommand_6() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the previous media item in the queue has been loaded"); + } + + CHIP_ERROR TestLogACommand_7() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has skipped forward 10 seconds"); + } + + CHIP_ERROR TestLogACommand_8() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has skipped backward 10 seconds"); } }; -class Test_TC_MC_5_3Suite : public TestCommand +class Test_TC_MC_6_3Suite : public TestCommand { public: - Test_TC_MC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_5_3", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_6_3", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29893,7 +31418,7 @@ class Test_TC_MC_5_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_5_3Suite() {} + ~Test_TC_MC_6_3Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29902,12 +31427,12 @@ class Test_TC_MC_5_3Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -29928,6 +31453,14 @@ class Test_TC_MC_5_3Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); err = TestLogACommand_1(); break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); + err = TestLogACommand_3(); + break; } if (CHIP_NO_ERROR != err) @@ -29944,7 +31477,7 @@ class Test_TC_MC_5_3Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -29972,15 +31505,27 @@ class Test_TC_MC_5_3Suite : public TestCommand CHIP_ERROR TestLogACommand_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("verify that the channel has changed on the device"); + return UserPrompt("Verify that media is paused"); + } + + CHIP_ERROR TestLogACommand_2() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has moved to 10 seconds from the starting point."); + } + + CHIP_ERROR TestLogACommand_3() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("User prompt needed to enter the value beyond the furthest valid position"); } }; -class Test_TC_MC_6_1Suite : public TestCommand +class Test_TC_MC_6_4Suite : public TestCommand { public: - Test_TC_MC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_6_4", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -29988,7 +31533,7 @@ class Test_TC_MC_6_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_1Suite() {} + ~Test_TC_MC_6_4Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -29997,12 +31542,12 @@ class Test_TC_MC_6_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_4\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_4\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -30024,21 +31569,37 @@ class Test_TC_MC_6_1Suite : public TestCommand err = TestLogACommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the PlaybackSpeed attribute from the DUT\n"); + err = TestReadsThePlaybackSpeedAttributeFromTheDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the playback state attribute\n"); - err = TestReadsThePlaybackStateAttribute_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); + err = TestLogACommand_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); - err = TestLogACommand_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_4(); break; case 5: ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); err = TestLogACommand_5(); break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); + err = TestLogACommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); + err = TestLogACommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : log a command\n"); + err = TestLogACommand_9(); + break; } if (CHIP_NO_ERROR != err) @@ -30055,7 +31616,7 @@ class Test_TC_MC_6_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 10; chip::Optional mNodeId; chip::Optional mCluster; @@ -30070,14 +31631,34 @@ class Test_TC_MC_6_1Suite : public TestCommand NextTest(); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) + static void OnFailureCallback_2(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); + (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + static void OnSuccessCallback_2(void * context, float playbackSpeed) { - (static_cast(context))->OnSuccessResponse_3(currentState); + (static_cast(context))->OnSuccessResponse_2(playbackSpeed); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + { + (static_cast(context))->OnSuccessResponse_4(currentState); + } + + static void OnFailureCallback_7(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_7(error); + } + + static void OnSuccessCallback_7(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + { + (static_cast(context))->OnSuccessResponse_7(currentState); } // @@ -30096,54 +31677,114 @@ class Test_TC_MC_6_1Suite : public TestCommand return UserPrompt("Verify that media is paused"); } - CHIP_ERROR TestLogACommand_2() + CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(float playbackSpeed) + { + VerifyOrReturn(CheckValue("playbackSpeed", playbackSpeed, 0.0f)); + + NextTest(); + } + + CHIP_ERROR TestLogACommand_3() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is playing"); + return UserPrompt("Verify that the media is playing"); } - CHIP_ERROR TestReadsThePlaybackStateAttribute_3() + CHIP_ERROR TestReadsTheCurrentStateAttribute_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::MediaPlaybackClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); + this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_3(CHIP_ERROR error) + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + void OnSuccessResponse_4(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) { VerifyOrReturn(CheckValue("currentState", currentState, 0)); NextTest(); } - CHIP_ERROR TestLogACommand_4() + CHIP_ERROR TestLogACommand_5() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is paused"); + return UserPrompt("Verify that the media play speed has increased"); } - CHIP_ERROR TestLogACommand_5() + CHIP_ERROR TestLogACommand_6() { SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is stoped"); + return UserPrompt("Verify that the media play has reversed direction"); + } + + CHIP_ERROR TestReadsTheCurrentStateAttribute_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + { + VerifyOrReturn(CheckValue("currentState", currentState, 0)); + + NextTest(); + } + + CHIP_ERROR TestLogACommand_8() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media play has reversed direction"); + } + + CHIP_ERROR TestLogACommand_9() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media is has resumed playing forward at the default speed"); } }; -class Test_TC_MC_6_2Suite : public TestCommand +class Test_TC_MC_7_1Suite : public TestCommand { public: - Test_TC_MC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_7_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -30151,7 +31792,7 @@ class Test_TC_MC_6_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_2Suite() {} + ~Test_TC_MC_7_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -30160,12 +31801,12 @@ class Test_TC_MC_6_2Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -30182,37 +31823,90 @@ class Test_TC_MC_6_2Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); - err = TestLogACommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); - err = TestLogACommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : log a command\n"); - err = TestLogACommand_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); - err = TestLogACommand_8(); + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } +}; + +class Test_TC_MC_7_2Suite : public TestCommand +{ +public: + Test_TC_MC_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_7_2", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MC_7_2Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; } @@ -30230,7 +31924,7 @@ class Test_TC_MC_6_2Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 1; chip::Optional mNodeId; chip::Optional mCluster; @@ -30245,16 +31939,6 @@ class Test_TC_MC_6_2Suite : public TestCommand NextTest(); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - (static_cast(context))->OnSuccessResponse_3(currentState); - } - // // Tests methods // @@ -30264,79 +31948,13 @@ class Test_TC_MC_6_2Suite : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - - CHIP_ERROR TestLogACommand_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); - } - - CHIP_ERROR TestLogACommand_2() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is playing"); - } - - CHIP_ERROR TestReadsTheCurrentStateAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); - - NextTest(); - } - - CHIP_ERROR TestLogACommand_4() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is started over"); - } - - CHIP_ERROR TestLogACommand_5() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the next media item in the queue has been loaded"); - } - - CHIP_ERROR TestLogACommand_6() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the previous media item in the queue has been loaded"); - } - - CHIP_ERROR TestLogACommand_7() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has skipped forward 10 seconds"); - } - - CHIP_ERROR TestLogACommand_8() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has skipped backward 10 seconds"); - } }; -class Test_TC_MC_6_3Suite : public TestCommand +class Test_TC_MC_8_1Suite : public TestCommand { public: - Test_TC_MC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_3", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_8_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -30344,7 +31962,7 @@ class Test_TC_MC_6_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_3Suite() {} + ~Test_TC_MC_8_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -30353,12 +31971,12 @@ class Test_TC_MC_6_3Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -30376,16 +31994,12 @@ class Test_TC_MC_6_3Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the CurrentTarget attribute\n"); + err = TestReadsTheCurrentTargetAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); - err = TestLogACommand_3(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the TargetList attribute\n"); + err = TestReadsTheTargetListAttribute_2(); break; } @@ -30403,7 +32017,7 @@ class Test_TC_MC_6_3Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -30418,6 +32032,29 @@ class Test_TC_MC_6_3Suite : public TestCommand NextTest(); } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, uint8_t currentTarget) + { + (static_cast(context))->OnSuccessResponse_1(currentTarget); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2( + void * context, + const chip::app::DataModel::DecodableList & + targetList) + { + (static_cast(context))->OnSuccessResponse_2(targetList); + } + // // Tests methods // @@ -30428,30 +32065,60 @@ class Test_TC_MC_6_3Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestLogACommand_1() + CHIP_ERROR TestReadsTheCurrentTargetAttribute_1() { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TargetNavigatorClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_2() + void OnFailureResponse_1(CHIP_ERROR error) { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has moved to 10 seconds from the starting point."); + chip::app::StatusIB status(error); + ThrowFailureResponse(); } - CHIP_ERROR TestLogACommand_3() + void OnSuccessResponse_1(uint8_t currentTarget) { - SetIdentity(kIdentityAlpha); - return UserPrompt("User prompt needed to enter the value beyond the furthest valid position"); + VerifyOrReturn(CheckConstraintType("currentTarget", "", "uint8")); + NextTest(); + } + + CHIP_ERROR TestReadsTheTargetListAttribute_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TargetNavigatorClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2( + const chip::app::DataModel::DecodableList & + targetList) + { + VerifyOrReturn(CheckConstraintType("targetList", "", "list")); + NextTest(); } }; -class Test_TC_MC_6_4Suite : public TestCommand +class Test_TC_MC_9_1Suite : public TestCommand { public: - Test_TC_MC_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_4", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_9_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -30459,7 +32126,7 @@ class Test_TC_MC_6_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_6_4Suite() {} + ~Test_TC_MC_9_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -30468,12 +32135,12 @@ class Test_TC_MC_6_4Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -30491,40 +32158,32 @@ class Test_TC_MC_6_4Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition\n"); + err = TestPrecondition_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the PlaybackSpeed attribute from the DUT\n"); - err = TestReadsThePlaybackSpeedAttributeFromTheDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the VendorName attribute\n"); + err = TestReadsTheVendorNameAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); - err = TestLogACommand_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the VendorID attribute\n"); + err = TestReadsTheVendorIDAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the ApplicationName attribute\n"); + err = TestReadsTheApplicationNameAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the ProductID attribute\n"); + err = TestReadsTheProductIDAttribute_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); - err = TestLogACommand_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the Status attribute\n"); + err = TestReadsTheStatusAttribute_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); - err = TestLogACommand_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : log a command\n"); - err = TestLogACommand_9(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the ApplicationVersion attribute\n"); + err = TestReadsTheApplicationVersionAttribute_7(); break; } @@ -30542,7 +32201,7 @@ class Test_TC_MC_6_4Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -30559,32 +32218,62 @@ class Test_TC_MC_6_4Suite : public TestCommand static void OnFailureCallback_2(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); + (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context, float playbackSpeed) + static void OnSuccessCallback_2(void * context, chip::CharSpan vendorName) { - (static_cast(context))->OnSuccessResponse_2(playbackSpeed); + (static_cast(context))->OnSuccessResponse_2(vendorName); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, uint16_t vendorID) + { + (static_cast(context))->OnSuccessResponse_3(vendorID); } static void OnFailureCallback_4(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); + (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_4(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + static void OnSuccessCallback_4(void * context, chip::CharSpan applicationName) { - (static_cast(context))->OnSuccessResponse_4(currentState); + (static_cast(context))->OnSuccessResponse_4(applicationName); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context, uint16_t productID) + { + (static_cast(context))->OnSuccessResponse_5(productID); + } + + static void OnFailureCallback_6(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_6(error); + } + + static void OnSuccessCallback_6(void * context, chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) + { + (static_cast(context))->OnSuccessResponse_6(status); } static void OnFailureCallback_7(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); + (static_cast(context))->OnFailureResponse_7(error); } - static void OnSuccessCallback_7(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + static void OnSuccessCallback_7(void * context, chip::CharSpan applicationVersion) { - (static_cast(context))->OnSuccessResponse_7(currentState); + (static_cast(context))->OnSuccessResponse_7(applicationVersion); } // @@ -30597,19 +32286,19 @@ class Test_TC_MC_6_4Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestLogACommand_1() + CHIP_ERROR TestPrecondition_1() { SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); + return Log("DUT has one or more Content Apps available"); } - CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_2() + CHIP_ERROR TestReadsTheVendorNameAttribute_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; + chip::Controller::ApplicationBasicClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } @@ -30620,26 +32309,43 @@ class Test_TC_MC_6_4Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(float playbackSpeed) + void OnSuccessResponse_2(chip::CharSpan vendorName) { - VerifyOrReturn(CheckValue("playbackSpeed", playbackSpeed, 0.0f)); - + VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); NextTest(); } - CHIP_ERROR TestLogACommand_3() + CHIP_ERROR TestReadsTheVendorIDAttribute_3() { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media is playing"); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheCurrentStateAttribute_4() + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(uint16_t vendorID) + { + VerifyOrReturn(CheckConstraintType("vendorID", "", "vendor-id")); + NextTest(); + } + + CHIP_ERROR TestReadsTheApplicationNameAttribute_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; + chip::Controller::ApplicationBasicClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } @@ -30650,67 +32356,90 @@ class Test_TC_MC_6_4Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_4(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + void OnSuccessResponse_4(chip::CharSpan applicationName) { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); - + VerifyOrReturn(CheckConstraintType("applicationName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("applicationName", applicationName.size(), 256)); NextTest(); } - CHIP_ERROR TestLogACommand_5() + CHIP_ERROR TestReadsTheProductIDAttribute_5() { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play speed has increased"); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); + return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_6() + void OnFailureResponse_5(CHIP_ERROR error) { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play has reversed direction"); + chip::app::StatusIB status(error); + ThrowFailureResponse(); } - CHIP_ERROR TestReadsTheCurrentStateAttribute_7() + void OnSuccessResponse_5(uint16_t productID) + { + VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadsTheStatusAttribute_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; + chip::Controller::ApplicationBasicClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_7(CHIP_ERROR error) + void OnFailureResponse_6(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_7(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) + void OnSuccessResponse_6(chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); + VerifyOrReturn(CheckValue("status", status, 0)); NextTest(); } - CHIP_ERROR TestLogACommand_8() + CHIP_ERROR TestReadsTheApplicationVersionAttribute_7() { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play has reversed direction"); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; } - CHIP_ERROR TestLogACommand_9() + void OnFailureResponse_7(CHIP_ERROR error) { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media is has resumed playing forward at the default speed"); + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(chip::CharSpan applicationVersion) + { + VerifyOrReturn(CheckConstraintType("applicationVersion", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("applicationVersion", applicationVersion.size(), 32)); + NextTest(); } }; -class Test_TC_MC_7_1Suite : public TestCommand +class Test_TC_MC_10_1Suite : public TestCommand { public: - Test_TC_MC_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_7_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_10_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_10_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -30718,7 +32447,7 @@ class Test_TC_MC_7_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_7_1Suite() {} + ~Test_TC_MC_10_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -30727,12 +32456,12 @@ class Test_TC_MC_7_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -30749,6 +32478,14 @@ class Test_TC_MC_7_1Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the AcceptHeader attribute from the DUT\n"); + err = TestThReadsTheAcceptHeaderAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the SupportedStreamingProtocols attribute from the DUT\n"); + err = TestThReadsTheSupportedStreamingProtocolsAttributeFromTheDut_2(); + break; } if (CHIP_NO_ERROR != err) @@ -30765,7 +32502,7 @@ class Test_TC_MC_7_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -30780,6 +32517,26 @@ class Test_TC_MC_7_1Suite : public TestCommand NextTest(); } + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, const chip::app::DataModel::DecodableList & acceptHeader) + { + (static_cast(context))->OnSuccessResponse_1(acceptHeader); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, uint32_t supportedStreamingProtocols) + { + (static_cast(context))->OnSuccessResponse_2(supportedStreamingProtocols); + } + // // Tests methods // @@ -30789,98 +32546,60 @@ class Test_TC_MC_7_1Suite : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } -}; -class Test_TC_MC_7_2Suite : public TestCommand -{ -public: - Test_TC_MC_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_7_2", credsIssuerConfig), mTestIndex(0) + CHIP_ERROR TestThReadsTheAcceptHeaderAttributeFromTheDut_1() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ContentLauncherClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ~Test_TC_MC_7_2Suite() {} + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; + } - /////////// TestCommand Interface ///////// - void NextTest() override + void OnFailureResponse_1(CHIP_ERROR error) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + chip::app::StatusIB status(error); + ThrowFailureResponse(); } - chip::System::Clock::Timeout GetWaitDuration() const override + void OnSuccessResponse_1(const chip::app::DataModel::DecodableList & acceptHeader) { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + VerifyOrReturn(CheckConstraintType("acceptHeader", "", "list")); + NextTest(); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + CHIP_ERROR TestThReadsTheSupportedStreamingProtocolsAttributeFromTheDut_2() { - bool isExpectedDnssdResult = false; + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ContentLauncherClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; } - // - // Tests methods - // + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + void OnSuccessResponse_2(uint32_t supportedStreamingProtocols) { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + VerifyOrReturn(CheckConstraintType("supportedStreamingProtocols", "", "map32")); + NextTest(); } }; -class Test_TC_MC_8_1Suite : public TestCommand +class Test_TC_MOD_1_1Suite : public TestCommand { public: - Test_TC_MC_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_8_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MOD_1_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -30888,7 +32607,7 @@ class Test_TC_MC_8_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_8_1Suite() {} + ~Test_TC_MOD_1_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -30897,12 +32616,12 @@ class Test_TC_MC_8_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -30920,12 +32639,20 @@ class Test_TC_MC_8_1Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the CurrentTarget attribute\n"); - err = TestReadsTheCurrentTargetAttribute_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); + err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the TargetList attribute\n"); - err = TestReadsTheTargetListAttribute_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the AttributeList attribute from the DUT\n"); + err = TestThReadsTheAttributeListAttributeFromTheDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -30943,7 +32670,7 @@ class Test_TC_MC_8_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -30960,25 +32687,44 @@ class Test_TC_MC_8_1Suite : public TestCommand static void OnFailureCallback_1(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); + (static_cast(context))->OnFailureResponse_1(error); } - static void OnSuccessCallback_1(void * context, uint8_t currentTarget) + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_1(currentTarget); + (static_cast(context))->OnSuccessResponse_1(clusterRevision); } static void OnFailureCallback_2(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); + (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::DecodableList & - targetList) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) { - (static_cast(context))->OnSuccessResponse_2(targetList); + (static_cast(context))->OnSuccessResponse_2(attributeList); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) + { + (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) + { + (static_cast(context))->OnSuccessResponse_4(generatedCommandList); } // @@ -30991,13 +32737,13 @@ class Test_TC_MC_8_1Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsTheCurrentTargetAttribute_1() + CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; + chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_1, OnFailureCallback_1, true)); return CHIP_NO_ERROR; } @@ -31008,19 +32754,20 @@ class Test_TC_MC_8_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t currentTarget) + void OnSuccessResponse_1(uint16_t clusterRevision) { - VerifyOrReturn(CheckConstraintType("currentTarget", "", "uint8")); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); } - CHIP_ERROR TestReadsTheTargetListAttribute_2() + CHIP_ERROR TestThReadsTheAttributeListAttributeFromTheDut_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; + chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } @@ -31031,28 +32778,74 @@ class Test_TC_MC_8_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2( - const chip::app::DataModel::DecodableList & - targetList) + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) { - VerifyOrReturn(CheckConstraintType("targetList", "", "list")); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) + { + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) + { + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); } }; -class Test_TC_MC_9_1Suite : public TestCommand +class Test_TC_MF_1_4Suite : public TestCommand { public: - Test_TC_MC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_9_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_4", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); + AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_9_1Suite() {} + ~Test_TC_MF_1_4Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -31061,12 +32854,12 @@ class Test_TC_MC_9_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_4\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_4\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -31080,36 +32873,68 @@ class Test_TC_MC_9_1Suite : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); + err = TestRebootTargetDevice_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition\n"); - err = TestPrecondition_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : TH_CR1 starts a commissioning process with DUT_CE\n"); + err = TestThCr1StartsACommissioningProcessWithDutCe_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the VendorName attribute\n"); - err = TestReadsTheVendorNameAttribute_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH_CR1 opens a commissioning window on DUT_CE\n"); + err = TestThCr1OpensACommissioningWindowOnDutCe_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the VendorID attribute\n"); - err = TestReadsTheVendorIDAttribute_3(); + ChipLogProgress( + chipTool, + " ***** Test Step 3 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the ApplicationName attribute\n"); - err = TestReadsTheApplicationNameAttribute_4(); + ChipLogProgress( + chipTool, + " ***** Test Step 4 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the ProductID attribute\n"); - err = TestReadsTheProductIDAttribute_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Commission from beta\n"); + err = TestCommissionFromBeta_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the Status attribute\n"); - err = TestReadsTheStatusAttribute_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : TH_CR2 starts a commissioning process with DUT_CE\n"); + err = TestThCr2StartsACommissioningProcessWithDutCe_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the ApplicationVersion attribute\n"); - err = TestReadsTheApplicationVersionAttribute_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Query fabrics list\n"); + err = TestQueryFabricsList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Query fabrics list\n"); + err = TestQueryFabricsList_8(); + break; + case 9: + ChipLogProgress( + chipTool, + " ***** Test Step 9 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9(); + break; + case 10: + ChipLogProgress( + chipTool, + " ***** Test Step 10 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10(); + break; + case 11: + ChipLogProgress( + chipTool, + " ***** Test Step 11 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11(); + break; + case 12: + ChipLogProgress( + chipTool, + " ***** Test Step 12 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12(); break; } @@ -31127,11 +32952,13 @@ class Test_TC_MC_9_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 13; chip::Optional mNodeId; - chip::Optional mCluster; + chip::Optional mNodeId2; chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; chip::Optional mTimeout; void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override @@ -31142,90 +32969,117 @@ class Test_TC_MC_9_1Suite : public TestCommand NextTest(); } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); + (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_2(void * context, chip::CharSpan vendorName) + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) { - (static_cast(context))->OnSuccessResponse_2(vendorName); + (static_cast(context))->OnFailureResponse_4(error); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) + static void OnSuccessCallback_4(void * context, chip::CharSpan nodeLabel) { - (static_cast(context))->OnFailureResponse_3(error); + (static_cast(context))->OnSuccessResponse_4(nodeLabel); } - static void OnSuccessCallback_3(void * context, uint16_t vendorID) + static void OnFailureCallback_7(void * context, CHIP_ERROR error) { - (static_cast(context))->OnSuccessResponse_3(vendorID); + (static_cast(context))->OnFailureResponse_7(error); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) + static void + OnSuccessCallback_7(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) { - (static_cast(context))->OnFailureResponse_4(error); + (static_cast(context))->OnSuccessResponse_7(fabrics); } - static void OnSuccessCallback_4(void * context, chip::CharSpan applicationName) + static void OnFailureCallback_8(void * context, CHIP_ERROR error) { - (static_cast(context))->OnSuccessResponse_4(applicationName); + (static_cast(context))->OnFailureResponse_8(error); } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) + static void + OnSuccessCallback_8(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) { - (static_cast(context))->OnFailureResponse_5(error); + (static_cast(context))->OnSuccessResponse_8(fabrics); } - static void OnSuccessCallback_5(void * context, uint16_t productID) + static void OnFailureCallback_9(void * context, CHIP_ERROR error) { - (static_cast(context))->OnSuccessResponse_5(productID); + (static_cast(context))->OnFailureResponse_9(error); } - static void OnFailureCallback_6(void * context, CHIP_ERROR error) + static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } + + static void OnFailureCallback_10(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); + (static_cast(context))->OnFailureResponse_10(error); } - static void OnSuccessCallback_6(void * context, chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) + static void OnSuccessCallback_10(void * context, chip::CharSpan nodeLabel) { - (static_cast(context))->OnSuccessResponse_6(status); + (static_cast(context))->OnSuccessResponse_10(nodeLabel); } - static void OnFailureCallback_7(void * context, CHIP_ERROR error) + static void OnFailureCallback_11(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); + (static_cast(context))->OnFailureResponse_11(error); } - static void OnSuccessCallback_7(void * context, chip::CharSpan applicationVersion) + static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } + + static void OnFailureCallback_12(void * context, CHIP_ERROR error) { - (static_cast(context))->OnSuccessResponse_7(applicationVersion); + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_12(nodeLabel); } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestRebootTargetDevice_0() { SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); } - CHIP_ERROR TestPrecondition_1() + CHIP_ERROR TestThCr1StartsACommissioningProcessWithDutCe_1() { SetIdentity(kIdentityAlpha); - return Log("DUT has one or more Content Apps available"); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsTheVendorNameAttribute_2() + CHIP_ERROR TestThCr1OpensACommissioningWindowOnDutCe_2() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + RequestType request; + request.commissioningTimeout = 120U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_2(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); return CHIP_NO_ERROR; } @@ -31235,128 +33089,216 @@ class Test_TC_MC_9_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(chip::CharSpan vendorName) + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3() { - VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); - NextTest(); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheVendorIDAttribute_3() + void OnFailureResponse_3(CHIP_ERROR error) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_3(CHIP_ERROR error) + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_3(uint16_t vendorID) + void OnSuccessResponse_4(chip::CharSpan nodeLabel) { - VerifyOrReturn(CheckConstraintType("vendorID", "", "vendor-id")); + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); NextTest(); } - CHIP_ERROR TestReadsTheApplicationNameAttribute_4() + CHIP_ERROR TestCommissionFromBeta_5() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; + SetIdentity(kIdentityBeta); + return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, + mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + + CHIP_ERROR TestThCr2StartsACommissioningProcessWithDutCe_6() + { + SetIdentity(kIdentityBeta); + return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); + } + + CHIP_ERROR TestQueryFabricsList_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::OperationalCredentialsClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_4(CHIP_ERROR error) + void OnFailureResponse_7(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_4(chip::CharSpan applicationName) + void OnSuccessResponse_7(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) { - VerifyOrReturn(CheckConstraintType("applicationName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("applicationName", applicationName.size(), 256)); + { + auto iter_0 = fabrics.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); NextTest(); } - CHIP_ERROR TestReadsTheProductIDAttribute_5() + CHIP_ERROR TestQueryFabricsList_8() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_5(CHIP_ERROR error) + void OnFailureResponse_8(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_5(uint16_t productID) + void OnSuccessResponse_8(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) { - VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); + { + auto iter_0 = fabrics.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); NextTest(); } - CHIP_ERROR TestReadsTheStatusAttribute_6() + CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); return CHIP_NO_ERROR; } - void OnFailureResponse_6(CHIP_ERROR error) + void OnFailureResponse_9(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_6(chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10() { - VerifyOrReturn(CheckValue("status", status, 0)); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + void OnSuccessResponse_10(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); NextTest(); } - CHIP_ERROR TestReadsTheApplicationVersionAttribute_7() + CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); return CHIP_NO_ERROR; } - void OnFailureResponse_7(CHIP_ERROR error) + void OnFailureResponse_11(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_7(chip::CharSpan applicationVersion) + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12() { - VerifyOrReturn(CheckConstraintType("applicationVersion", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("applicationVersion", applicationVersion.size(), 32)); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_12(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); NextTest(); } }; @@ -108213,86 +110155,11 @@ class Test_TC_DIAG_LOG_1_2Suite : public TestCommand // }; -class Test_TC_DIAG_LOG_1_3Suite : public TestCommand -{ -public: - Test_TC_DIAG_LOG_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DIAG_LOG_1_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DIAG_LOG_1_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_LOG_1_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_LOG_1_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); - } - - // - // Tests methods - // -}; - -class Test_TC_DESC_1_1Suite : public TestCommand +class Test_TC_DIAG_LOG_1_3Suite : public TestCommand { public: - Test_TC_DESC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DESC_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_DIAG_LOG_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_DIAG_LOG_1_3", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -108300,7 +110167,7 @@ class Test_TC_DESC_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DESC_1_1Suite() {} + ~Test_TC_DIAG_LOG_1_3Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -108309,12 +110176,12 @@ class Test_TC_DESC_1_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DESC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_LOG_1_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DESC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_LOG_1_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -108363,11 +110230,11 @@ class Test_TC_DESC_1_1Suite : public TestCommand // }; -class Test_TC_ETHDIAG_1_2Suite : public TestCommand +class Test_TC_DESC_1_1Suite : public TestCommand { public: - Test_TC_ETHDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ETHDIAG_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_DESC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_DESC_1_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -108375,7 +110242,7 @@ class Test_TC_ETHDIAG_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ETHDIAG_1_2Suite() {} + ~Test_TC_DESC_1_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -108384,12 +110251,12 @@ class Test_TC_ETHDIAG_1_2Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ETHDIAG_1_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DESC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ETHDIAG_1_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DESC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -108438,11 +110305,11 @@ class Test_TC_ETHDIAG_1_2Suite : public TestCommand // }; -class Test_TC_GC_1_1Suite : public TestCommand +class Test_TC_ETHDIAG_1_2Suite : public TestCommand { public: - Test_TC_GC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_GC_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_ETHDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ETHDIAG_1_2", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -108450,7 +110317,7 @@ class Test_TC_GC_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_GC_1_1Suite() {} + ~Test_TC_ETHDIAG_1_2Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -108459,12 +110326,12 @@ class Test_TC_GC_1_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_GC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ETHDIAG_1_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ETHDIAG_1_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -108963,156 +110830,6 @@ class Test_TC_I_2_2Suite : public TestCommand // }; -class Test_TC_I_2_3Suite : public TestCommand -{ -public: - Test_TC_I_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_I_2_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_I_2_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); - } - - // - // Tests methods - // -}; - -class Test_TC_ILL_2_1Suite : public TestCommand -{ -public: - Test_TC_ILL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ILL_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ILL_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); - } - - // - // Tests methods - // -}; - class Test_TC_ILL_2_2Suite : public TestCommand { public: @@ -110388,86 +112105,11 @@ class Test_TC_MC_3_13Suite : public TestCommand // }; -class Test_TC_MC_4_1Suite : public TestCommand -{ -public: - Test_TC_MC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_4_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_4_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_4_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); - } - - // - // Tests methods - // -}; - -class Test_TC_MC_8_2Suite : public TestCommand +class Test_TC_MC_4_1Suite : public TestCommand { public: - Test_TC_MC_8_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_8_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_4_1", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -110475,7 +112117,7 @@ class Test_TC_MC_8_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_8_2Suite() {} + ~Test_TC_MC_4_1Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -110484,12 +112126,12 @@ class Test_TC_MC_8_2Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_4_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_4_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -110538,11 +112180,11 @@ class Test_TC_MC_8_2Suite : public TestCommand // }; -class Test_TC_MC_9_2Suite : public TestCommand +class Test_TC_MC_8_2Suite : public TestCommand { public: - Test_TC_MC_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_9_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_8_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_8_2", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -110550,7 +112192,7 @@ class Test_TC_MC_9_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_9_2Suite() {} + ~Test_TC_MC_8_2Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -110559,12 +112201,12 @@ class Test_TC_MC_9_2Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -110613,11 +112255,11 @@ class Test_TC_MC_9_2Suite : public TestCommand // }; -class Test_TC_MC_10_1Suite : public TestCommand +class Test_TC_MC_9_2Suite : public TestCommand { public: - Test_TC_MC_10_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_10_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MC_9_2", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -110625,7 +112267,7 @@ class Test_TC_MC_10_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_10_1Suite() {} + ~Test_TC_MC_9_2Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -110634,12 +112276,12 @@ class Test_TC_MC_10_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111213,244 +112855,21 @@ class Test_TC_MF_1_2Suite : public TestCommand // }; -class Test_TC_MF_1_4Suite : public TestCommand -{ -public: - Test_TC_MF_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MF_1_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); - } - - // - // Tests methods - // -}; - -class Test_TC_MF_1_5Suite : public TestCommand -{ -public: - Test_TC_MF_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_5", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MF_1_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); - } - - // - // Tests methods - // -}; - -class Test_TC_MF_1_6Suite : public TestCommand -{ -public: - Test_TC_MF_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_6", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MF_1_6Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override - { - bool isExpectedDnssdResult = false; - - VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); - NextTest(); - } - - // - // Tests methods - // -}; - -class Test_TC_MF_1_7Suite : public TestCommand +class Test_TC_MF_1_3Suite : public TestCommand { public: - Test_TC_MF_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_7", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_3", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); + AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_7Suite() {} + ~Test_TC_MF_1_3Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111459,12 +112878,12 @@ class Test_TC_MF_1_7Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_7\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_7\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111477,6 +112896,70 @@ class Test_TC_MF_1_7Suite : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); + err = TestRebootTargetDevice_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH_CR1 starts a commissioning process with DUT_CE\n"); + err = TestThCr1StartsACommissioningProcessWithDutCe_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Open Commissioning Window\n"); + err = TestOpenCommissioningWindow_2(); + break; + case 3: + ChipLogProgress( + chipTool, + " ***** Test Step 3 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3(); + break; + case 4: + ChipLogProgress( + chipTool, + " ***** Test Step 4 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Commission from beta\n"); + err = TestCommissionFromBeta_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH_CR2 starts a commissioning process with DUT_CE\n"); + err = TestThCr2StartsACommissioningProcessWithDutCe_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Query fabrics list\n"); + err = TestQueryFabricsList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Query fabrics list\n"); + err = TestQueryFabricsList_8(); + break; + case 9: + ChipLogProgress( + chipTool, + " ***** Test Step 9 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9(); + break; + case 10: + ChipLogProgress( + chipTool, + " ***** Test Step 10 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10(); + break; + case 11: + ChipLogProgress( + chipTool, + " ***** Test Step 11 : TH_CR2 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr2WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11(); + break; + case 12: + ChipLogProgress( + chipTool, + " ***** Test Step 12 : TH_CR2 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr2ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12(); + break; } if (CHIP_NO_ERROR != err) @@ -111493,11 +112976,13 @@ class Test_TC_MF_1_7Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 13; chip::Optional mNodeId; - chip::Optional mCluster; + chip::Optional mNodeId2; chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; chip::Optional mTimeout; void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override @@ -111508,16 +112993,358 @@ class Test_TC_MF_1_7Suite : public TestCommand NextTest(); } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_4(nodeLabel); + } + + static void OnFailureCallback_7(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_7(error); + } + + static void + OnSuccessCallback_7(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + (static_cast(context))->OnSuccessResponse_7(fabrics); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void + OnSuccessCallback_8(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + (static_cast(context))->OnSuccessResponse_8(fabrics); + } + + static void OnFailureCallback_9(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_9(error); + } + + static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } + + static void OnFailureCallback_10(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_10(error); + } + + static void OnSuccessCallback_10(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_10(nodeLabel); + } + + static void OnFailureCallback_11(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_11(error); + } + + static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } + + static void OnFailureCallback_12(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_12(nodeLabel); + } + // // Tests methods // + + CHIP_ERROR TestRebootTargetDevice_0() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestThCr1StartsACommissioningProcessWithDutCe_1() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(1); + } + + CHIP_ERROR TestOpenCommissioningWindow_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type; + + RequestType request; + request.commissioningTimeout = 120U; + request.PAKEVerifier = chip::ByteSpan( + chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" + "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" + "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357\326" + "\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), + 97); + request.discriminator = 3840U; + request.iterations = 1000UL; + request.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_2(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest", 8))); + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestCommissionFromBeta_5() + { + SetIdentity(kIdentityBeta); + return PairWithQRCode(1, mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:0000000000I31506010")); + } + + CHIP_ERROR TestThCr2StartsACommissioningProcessWithDutCe_6() + { + SetIdentity(kIdentityBeta); + return WaitForCommissionee(1); + } + + CHIP_ERROR TestQueryFabricsList_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + { + auto iter_0 = fabrics.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); + NextTest(); + } + + CHIP_ERROR TestQueryFabricsList_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, false)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_8(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + { + auto iter_0 = fabrics.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); + VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 2)); + } + VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); + NextTest(); + } + + CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptest1garbage: not in length on purpose", 9); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_10(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest1", 9))); + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestThCr2WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); + + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptest2garbage: not in length on purpose", 9); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestThCr2ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_12(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest2", 9))); + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); + NextTest(); + } }; -class Test_TC_MF_1_8Suite : public TestCommand +class Test_TC_MF_1_5Suite : public TestCommand { public: - Test_TC_MF_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_8", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_5", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111525,7 +113352,7 @@ class Test_TC_MF_1_8Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_8Suite() {} + ~Test_TC_MF_1_5Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111534,12 +113361,12 @@ class Test_TC_MF_1_8Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_8\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_5\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_8\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_5\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111588,11 +113415,11 @@ class Test_TC_MF_1_8Suite : public TestCommand // }; -class Test_TC_MF_1_9Suite : public TestCommand +class Test_TC_MF_1_6Suite : public TestCommand { public: - Test_TC_MF_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_9", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_6", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111600,7 +113427,7 @@ class Test_TC_MF_1_9Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_9Suite() {} + ~Test_TC_MF_1_6Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111609,12 +113436,12 @@ class Test_TC_MF_1_9Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_9\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_6\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_9\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_6\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111663,11 +113490,11 @@ class Test_TC_MF_1_9Suite : public TestCommand // }; -class Test_TC_MF_1_10Suite : public TestCommand +class Test_TC_MF_1_7Suite : public TestCommand { public: - Test_TC_MF_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_10", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_7", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111675,7 +113502,7 @@ class Test_TC_MF_1_10Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_10Suite() {} + ~Test_TC_MF_1_7Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111684,12 +113511,12 @@ class Test_TC_MF_1_10Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_10\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_7\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_10\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_7\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111738,11 +113565,11 @@ class Test_TC_MF_1_10Suite : public TestCommand // }; -class Test_TC_MF_1_11Suite : public TestCommand +class Test_TC_MF_1_8Suite : public TestCommand { public: - Test_TC_MF_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_11", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_8", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111750,7 +113577,7 @@ class Test_TC_MF_1_11Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_11Suite() {} + ~Test_TC_MF_1_8Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111759,12 +113586,12 @@ class Test_TC_MF_1_11Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_11\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_8\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_11\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_8\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111813,11 +113640,11 @@ class Test_TC_MF_1_11Suite : public TestCommand // }; -class Test_TC_MF_1_12Suite : public TestCommand +class Test_TC_MF_1_9Suite : public TestCommand { public: - Test_TC_MF_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_12", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_9", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111825,7 +113652,7 @@ class Test_TC_MF_1_12Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_12Suite() {} + ~Test_TC_MF_1_9Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111834,12 +113661,12 @@ class Test_TC_MF_1_12Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_12\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_9\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_12\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_9\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111888,11 +113715,11 @@ class Test_TC_MF_1_12Suite : public TestCommand // }; -class Test_TC_MF_1_13Suite : public TestCommand +class Test_TC_MF_1_10Suite : public TestCommand { public: - Test_TC_MF_1_13Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_13", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_10", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111900,7 +113727,7 @@ class Test_TC_MF_1_13Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_13Suite() {} + ~Test_TC_MF_1_10Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111909,12 +113736,12 @@ class Test_TC_MF_1_13Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_13\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_10\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_13\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_10\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -111963,11 +113790,11 @@ class Test_TC_MF_1_13Suite : public TestCommand // }; -class Test_TC_MF_1_14Suite : public TestCommand +class Test_TC_MF_1_11Suite : public TestCommand { public: - Test_TC_MF_1_14Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_14", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_11", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111975,7 +113802,7 @@ class Test_TC_MF_1_14Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_14Suite() {} + ~Test_TC_MF_1_11Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -111984,12 +113811,12 @@ class Test_TC_MF_1_14Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_14\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_11\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_14\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_11\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112038,11 +113865,11 @@ class Test_TC_MF_1_14Suite : public TestCommand // }; -class Test_TC_MF_1_15Suite : public TestCommand +class Test_TC_MF_1_12Suite : public TestCommand { public: - Test_TC_MF_1_15Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_15", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_12", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112050,7 +113877,7 @@ class Test_TC_MF_1_15Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_15Suite() {} + ~Test_TC_MF_1_12Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112059,12 +113886,12 @@ class Test_TC_MF_1_15Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_15\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_12\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_15\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_12\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112113,11 +113940,11 @@ class Test_TC_MF_1_15Suite : public TestCommand // }; -class Test_TC_MF_1_16Suite : public TestCommand +class Test_TC_MF_1_13Suite : public TestCommand { public: - Test_TC_MF_1_16Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_16", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_13Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_13", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112125,7 +113952,7 @@ class Test_TC_MF_1_16Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_16Suite() {} + ~Test_TC_MF_1_13Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112134,12 +113961,12 @@ class Test_TC_MF_1_16Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_16\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_13\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_16\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_13\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112188,11 +114015,11 @@ class Test_TC_MF_1_16Suite : public TestCommand // }; -class Test_TC_MF_1_17Suite : public TestCommand +class Test_TC_MF_1_14Suite : public TestCommand { public: - Test_TC_MF_1_17Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_17", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_14Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_14", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112200,7 +114027,7 @@ class Test_TC_MF_1_17Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_17Suite() {} + ~Test_TC_MF_1_14Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112209,12 +114036,12 @@ class Test_TC_MF_1_17Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_17\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_14\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_17\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_14\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112263,11 +114090,11 @@ class Test_TC_MF_1_17Suite : public TestCommand // }; -class Test_TC_MF_1_18Suite : public TestCommand +class Test_TC_MF_1_15Suite : public TestCommand { public: - Test_TC_MF_1_18Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_18", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_15Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_15", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112275,7 +114102,7 @@ class Test_TC_MF_1_18Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_18Suite() {} + ~Test_TC_MF_1_15Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112284,12 +114111,12 @@ class Test_TC_MF_1_18Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_18\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_15\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_18\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_15\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112338,19 +114165,19 @@ class Test_TC_MF_1_18Suite : public TestCommand // }; -class Test_TC_MF_1_19Suite : public TestCommand +class Test_TC_MF_1_16Suite : public TestCommand { public: - Test_TC_MF_1_19Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_19", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_16Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_16", credsIssuerConfig), mTestIndex(0) { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_19Suite() {} + ~Test_TC_MF_1_16Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112359,12 +114186,12 @@ class Test_TC_MF_1_19Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_19\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_16\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_19\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_16\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112395,9 +114222,84 @@ class Test_TC_MF_1_19Suite : public TestCommand std::atomic_uint16_t mTestIndex; const uint16_t mTestCount = 0; + chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // +}; + +class Test_TC_MF_1_17Suite : public TestCommand +{ +public: + Test_TC_MF_1_17Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_17", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MF_1_17Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_17\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_17\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; chip::Optional mTimeout; void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override @@ -112413,11 +114315,11 @@ class Test_TC_MF_1_19Suite : public TestCommand // }; -class Test_TC_MF_1_20Suite : public TestCommand +class Test_TC_MF_1_18Suite : public TestCommand { public: - Test_TC_MF_1_20Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_20", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_18Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_18", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112425,7 +114327,7 @@ class Test_TC_MF_1_20Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_20Suite() {} + ~Test_TC_MF_1_18Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112434,12 +114336,12 @@ class Test_TC_MF_1_20Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_20\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_18\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_20\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_18\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112488,11 +114390,86 @@ class Test_TC_MF_1_20Suite : public TestCommand // }; -class Test_TC_MF_1_21Suite : public TestCommand +class Test_TC_MF_1_19Suite : public TestCommand { public: - Test_TC_MF_1_21Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_21", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_19Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_19", credsIssuerConfig), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_MF_1_19Suite() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_19\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_19\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mNodeId; + chip::Optional mTimeout; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // +}; + +class Test_TC_MF_1_20Suite : public TestCommand +{ +public: + Test_TC_MF_1_20Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_20", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112500,7 +114477,7 @@ class Test_TC_MF_1_21Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_21Suite() {} + ~Test_TC_MF_1_20Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112509,12 +114486,12 @@ class Test_TC_MF_1_21Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_21\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_20\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_21\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_20\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112563,11 +114540,11 @@ class Test_TC_MF_1_21Suite : public TestCommand // }; -class Test_TC_MF_1_22Suite : public TestCommand +class Test_TC_MF_1_21Suite : public TestCommand { public: - Test_TC_MF_1_22Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_22", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_21Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_21", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112575,7 +114552,7 @@ class Test_TC_MF_1_22Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_22Suite() {} + ~Test_TC_MF_1_21Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112584,12 +114561,12 @@ class Test_TC_MF_1_22Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_22\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_21\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_22\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_21\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112638,11 +114615,11 @@ class Test_TC_MF_1_22Suite : public TestCommand // }; -class Test_TC_MF_1_23Suite : public TestCommand +class Test_TC_MF_1_22Suite : public TestCommand { public: - Test_TC_MF_1_23Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_23", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_22Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_22", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112650,7 +114627,7 @@ class Test_TC_MF_1_23Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_23Suite() {} + ~Test_TC_MF_1_22Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112659,12 +114636,12 @@ class Test_TC_MF_1_23Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_23\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_22\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_23\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_22\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112713,11 +114690,11 @@ class Test_TC_MF_1_23Suite : public TestCommand // }; -class Test_TC_MF_1_24Suite : public TestCommand +class Test_TC_MF_1_23Suite : public TestCommand { public: - Test_TC_MF_1_24Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_24", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_23Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_23", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112725,7 +114702,7 @@ class Test_TC_MF_1_24Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_24Suite() {} + ~Test_TC_MF_1_23Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112734,12 +114711,12 @@ class Test_TC_MF_1_24Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_24\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_23\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_24\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_23\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112788,11 +114765,11 @@ class Test_TC_MF_1_24Suite : public TestCommand // }; -class Test_TC_MF_1_25Suite : public TestCommand +class Test_TC_MF_1_24Suite : public TestCommand { public: - Test_TC_MF_1_25Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_25", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_24Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_24", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112800,7 +114777,7 @@ class Test_TC_MF_1_25Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_25Suite() {} + ~Test_TC_MF_1_24Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112809,12 +114786,12 @@ class Test_TC_MF_1_25Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_25\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_24\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_25\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_24\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112863,11 +114840,11 @@ class Test_TC_MF_1_25Suite : public TestCommand // }; -class Test_TC_MF_1_26Suite : public TestCommand +class Test_TC_MF_1_25Suite : public TestCommand { public: - Test_TC_MF_1_26Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_26", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_25Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_25", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112875,7 +114852,7 @@ class Test_TC_MF_1_26Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_26Suite() {} + ~Test_TC_MF_1_25Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112884,12 +114861,12 @@ class Test_TC_MF_1_26Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_26\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_25\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_26\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_25\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -112938,11 +114915,11 @@ class Test_TC_MF_1_26Suite : public TestCommand // }; -class Test_TC_MF_1_27Suite : public TestCommand +class Test_TC_MF_1_26Suite : public TestCommand { public: - Test_TC_MF_1_27Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_27", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_26Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_26", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112950,7 +114927,7 @@ class Test_TC_MF_1_27Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_27Suite() {} + ~Test_TC_MF_1_26Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -112959,12 +114936,12 @@ class Test_TC_MF_1_27Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_27\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_26\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_27\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_26\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -113013,11 +114990,11 @@ class Test_TC_MF_1_27Suite : public TestCommand // }; -class Test_TC_MF_1_28Suite : public TestCommand +class Test_TC_MF_1_27Suite : public TestCommand { public: - Test_TC_MF_1_28Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_28", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_27Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_27", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -113025,7 +115002,7 @@ class Test_TC_MF_1_28Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_28Suite() {} + ~Test_TC_MF_1_27Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -113034,12 +115011,12 @@ class Test_TC_MF_1_28Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_28\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_27\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_28\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_27\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -113088,11 +115065,11 @@ class Test_TC_MF_1_28Suite : public TestCommand // }; -class Test_TC_MOD_1_1Suite : public TestCommand +class Test_TC_MF_1_28Suite : public TestCommand { public: - Test_TC_MOD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_28Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_MF_1_28", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -113100,7 +115077,7 @@ class Test_TC_MOD_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MOD_1_1Suite() {} + ~Test_TC_MF_1_28Suite() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -113109,12 +115086,12 @@ class Test_TC_MOD_1_1Suite : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_28\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_28\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -116284,9 +118261,12 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds 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(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -116329,6 +118309,9 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds 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), @@ -116463,15 +118446,12 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds 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(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -116492,7 +118472,6 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -116500,7 +118479,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -116525,7 +118504,6 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig),